esp_hw_support: Removed deprecated CPU util functions

The following files were deleted:
- components/esp_hw_support/include/soc/cpu.h
- components/soc/esp32s3/include/soc/cpu.h

The following functions are deprecated:
- get_sp()

The following functions declared in soc/cpu.h are now moved to esp_cpu.h:
- esp_cpu_configure_region_protection()

The following functions declared in soc/cpu.h are now moved to components/xtensa/include/esp_cpu_utils.h:
- esp_cpu_process_stack_pc()

All files with soc/cpu.h inclusion are updated to include esp_cpu.h instead.

Signed-off-by: Sudeep Mohanty <sudeep.mohanty@espressif.com>
This commit is contained in:
Sudeep Mohanty
2021-12-14 10:08:15 +05:30
parent 355e8bba76
commit e22b4007d3
67 changed files with 128 additions and 367 deletions

View File

@@ -17,9 +17,9 @@
extern "C" {
#endif
#define ESP_WATCHPOINT_LOAD 0x40000000
#define ESP_WATCHPOINT_STORE 0x80000000
#define ESP_WATCHPOINT_ACCESS 0xC0000000
#define ESP_CPU_WATCHPOINT_LOAD 0x40000000
#define ESP_CPU_WATCHPOINT_STORE 0x80000000
#define ESP_CPU_WATCHPOINT_ACCESS 0xC0000000
typedef uint32_t esp_cpu_ccount_t;
@@ -68,6 +68,12 @@ static inline void esp_cpu_set_ccount(esp_cpu_ccount_t val)
cpu_hal_set_cycle_count(val);
}
/**
* @brief Configure CPU to disable access to invalid memory regions
*
*/
void esp_cpu_configure_region_protection(void);
/**
* @brief Set a watchpoint to break/panic when a certain memory range is accessed.
*
@@ -75,7 +81,7 @@ static inline void esp_cpu_set_ccount(esp_cpu_ccount_t val)
* @param adr Base address to watch
* @param size Size of the region, starting at the base address, to watch. Must
* be one of 2^n, with n in [0..6].
* @param flags One of ESP_WATCHPOINT_* flags
* @param flags One of ESP_CPU_WATCHPOINT_* flags
*
* @return ESP_ERR_INVALID_ARG on invalid arg, ESP_OK otherwise
*

View File

@@ -8,7 +8,7 @@
#include <stdint.h>
#include <stdbool.h>
#include "soc/cpu.h"
#include "esp_cpu.h"
#include "soc/soc_memory_types.h"
#if __XTENSA__

View File

@@ -1,58 +0,0 @@
/*
* SPDX-FileCopyrightText: 2010-2021 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef _SOC_CPU_H
#define _SOC_CPU_H
#include <stdint.h>
#include <stdbool.h>
#include <stddef.h>
#include "esp_cpu.h"
#if __XTENSA__
#include "xt_instr_macros.h"
// [refactor-todo] not actually needed in this header now,
// but kept for compatibility
#include "xtensa/corebits.h"
#include "xtensa/config/core.h"
#include "xtensa/config/specreg.h"
#endif
#ifdef __cplusplus
extern "C" {
#endif
/** @brief Read current stack pointer address.
* Superseded by esp_cpu_get_sp in esp_cpu.h.
*/
static inline __attribute__((deprecated)) void *get_sp(void)
{
return esp_cpu_get_sp();
}
static inline uint32_t esp_cpu_process_stack_pc(uint32_t pc)
{
if (pc & 0x80000000) {
//Top two bits of a0 (return address) specify window increment. Overwrite to map to address space.
pc = (pc & 0x3fffffff) | 0x40000000;
}
//Minus 3 to get PC of previous instruction (i.e. instruction executed before return address)
return pc - 3;
}
/**
* @brief Configure CPU to disable access to invalid memory regions
*
*/
void esp_cpu_configure_region_protection(void);
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -8,7 +8,6 @@
#include <stdint.h>
#include <stdbool.h>
#include "sdkconfig.h"
#include "soc/cpu.h"
#include "hal/cpu_hal.h"
#include "soc/compare_set.h"