move common source files from esp32 to esp_common

This commit is contained in:
morris 2019-03-21 12:21:01 +08:00
parent 80dd3ae749
commit fcedf442ce
27 changed files with 56 additions and 35 deletions

View File

@ -16,15 +16,11 @@ else()
"coexist.c" "coexist.c"
"cpu_start.c" "cpu_start.c"
"crosscore_int.c" "crosscore_int.c"
"dbg_stubs.c"
"dport_access.c" "dport_access.c"
"dport_panic_highint_hdl.S" "dport_panic_highint_hdl.S"
"esp_adapter.c" "esp_adapter.c"
"esp_err_to_name.c"
"esp_timer.c"
"esp_timer_esp32.c" "esp_timer_esp32.c"
"esp_himem.c" "esp_himem.c"
"ets_timer_legacy.c"
"fast_crypto_ops.c" "fast_crypto_ops.c"
"freertos_hooks.c" "freertos_hooks.c"
"gdbstub.c" "gdbstub.c"
@ -36,14 +32,12 @@ else()
"panic.c" "panic.c"
"phy_init.c" "phy_init.c"
"pm_esp32.c" "pm_esp32.c"
"pm_locks.c"
"pm_trace.c" "pm_trace.c"
"reset_reason.c" "reset_reason.c"
"restore.c" "restore.c"
"sleep_modes.c" "sleep_modes.c"
"spiram.c" "spiram.c"
"spiram_psram.c" "spiram_psram.c"
"stack_check.c"
"system_api.c" "system_api.c"
"task_wdt.c" "task_wdt.c"
"wifi_init.c" "wifi_init.c"
@ -56,7 +50,7 @@ else()
# app_update is added here because cpu_start.c uses esp_ota_get_app_description() function. # app_update is added here because cpu_start.c uses esp_ota_get_app_description() function.
set(COMPONENT_PRIV_REQUIRES set(COMPONENT_PRIV_REQUIRES
app_trace app_update bootloader_support log mbedtls nvs_flash app_trace app_update bootloader_support log mbedtls nvs_flash
pthread smartconfig_ack spi_flash vfs wpa_supplicant xtensa-debug-module espcoredump) pthread smartconfig_ack spi_flash vfs wpa_supplicant xtensa-debug-module espcoredump esp_common)
set(COMPONENT_ADD_LDFRAGMENTS linker.lf ld/esp32_fragments.lf) set(COMPONENT_ADD_LDFRAGMENTS linker.lf ld/esp32_fragments.lf)
@ -134,7 +128,7 @@ else()
# disable stack protection in files which are involved in initialization of that feature # disable stack protection in files which are involved in initialization of that feature
set_source_files_properties( set_source_files_properties(
stack_check.c cpu_start.c cpu_start.c
PROPERTIES COMPILE_FLAGS PROPERTIES COMPILE_FLAGS
-fno-stack-protector) -fno-stack-protector)
endif() endif()

View File

@ -21,7 +21,7 @@
#include "soc/cpu.h" #include "soc/cpu.h"
#include "soc/rtc_cntl_reg.h" #include "soc/rtc_cntl_reg.h"
#include "esp32/rom/ets_sys.h" #include "esp32/rom/ets_sys.h"
#include "esp_system_internal.h" #include "esp_private/system_internal.h"
#include "driver/rtc_cntl.h" #include "driver/rtc_cntl.h"
#include "freertos/FreeRTOS.h" #include "freertos/FreeRTOS.h"

View File

@ -53,5 +53,4 @@ esp32_out.ld: $(COMPONENT_PATH)/ld/esp32.ld ../include/sdkconfig.h
COMPONENT_EXTRA_CLEAN := esp32_out.ld $(COMPONENT_BUILD_DIR)/esp32.project.ld COMPONENT_EXTRA_CLEAN := esp32_out.ld $(COMPONENT_BUILD_DIR)/esp32.project.ld
# disable stack protection in files which are involved in initialization of that feature # disable stack protection in files which are involved in initialization of that feature
stack_check.o: CFLAGS := $(filter-out -fstack-protector%, $(CFLAGS))
cpu_start.o: CFLAGS := $(filter-out -fstack-protector%, $(CFLAGS)) cpu_start.o: CFLAGS := $(filter-out -fstack-protector%, $(CFLAGS))

View File

@ -69,7 +69,7 @@
#include "esp_clk_internal.h" #include "esp_clk_internal.h"
#include "esp_timer.h" #include "esp_timer.h"
#include "esp_pm.h" #include "esp_pm.h"
#include "pm_impl.h" #include "esp_private/pm_impl.h"
#include "trax.h" #include "trax.h"
#include "esp_ota_ops.h" #include "esp_ota_ops.h"

View File

@ -20,7 +20,7 @@
#include "esp_intr_alloc.h" #include "esp_intr_alloc.h"
#include "esp_log.h" #include "esp_log.h"
#include "esp32/clk.h" #include "esp32/clk.h"
#include "esp_timer_impl.h" #include "esp_private/esp_timer_impl.h"
#include "soc/frc_timer_reg.h" #include "soc/frc_timer_reg.h"
#include "soc/rtc.h" #include "soc/rtc.h"
#include "freertos/FreeRTOS.h" #include "freertos/FreeRTOS.h"
@ -78,7 +78,7 @@
/* ALARM_OVERFLOW_VAL is used as timer alarm value when there are not timers /* ALARM_OVERFLOW_VAL is used as timer alarm value when there are not timers
* enabled which need to fire within the next timer overflow period. This alarm * enabled which need to fire within the next timer overflow period. This alarm
* is used to perform timekeeping (i.e. to track timer overflows). * is used to perform timekeeping (i.e. to track timer overflows).
* Due to the 0xffffffff cannot recognize the real overflow or the scenario that * Due to the 0xffffffff cannot recognize the real overflow or the scenario that
* ISR happens follow set_alarm, so change the ALARM_OVERFLOW_VAL to resolve this problem. * ISR happens follow set_alarm, so change the ALARM_OVERFLOW_VAL to resolve this problem.
* Set it to 0xefffffffUL. The remain 0x10000000UL(about 3 second) is enough to handle ISR. * Set it to 0xefffffffUL. The remain 0x10000000UL(about 3 second) is enough to handle ISR.
*/ */
@ -129,9 +129,9 @@ static bool s_mask_overflow;
//The timer_overflow_happened read alarm register to tell if overflow happened. //The timer_overflow_happened read alarm register to tell if overflow happened.
//However, there is a monent that overflow happens, and before ISR function called //However, there is a monent that overflow happens, and before ISR function called
//alarm register is set to another value, then you call timer_overflow_happened, //alarm register is set to another value, then you call timer_overflow_happened,
//it will return false. //it will return false.
//So we store the overflow value when new alarm is to be set. //So we store the overflow value when new alarm is to be set.
static bool s_overflow_happened; static bool s_overflow_happened;
#ifdef CONFIG_PM_DFS_USE_RTC_TIMER_REF #ifdef CONFIG_PM_DFS_USE_RTC_TIMER_REF
@ -157,7 +157,7 @@ static inline bool IRAM_ATTR timer_overflow_happened()
} }
return ((REG_READ(FRC_TIMER_CTRL_REG(1)) & FRC_TIMER_INT_STATUS) != 0 && return ((REG_READ(FRC_TIMER_CTRL_REG(1)) & FRC_TIMER_INT_STATUS) != 0 &&
((REG_READ(FRC_TIMER_ALARM_REG(1)) == ALARM_OVERFLOW_VAL && TIMER_IS_AFTER_OVERFLOW(REG_READ(FRC_TIMER_COUNT_REG(1))) && !s_mask_overflow) || ((REG_READ(FRC_TIMER_ALARM_REG(1)) == ALARM_OVERFLOW_VAL && TIMER_IS_AFTER_OVERFLOW(REG_READ(FRC_TIMER_COUNT_REG(1))) && !s_mask_overflow) ||
(!TIMER_IS_AFTER_OVERFLOW(REG_READ(FRC_TIMER_ALARM_REG(1))) && TIMER_IS_AFTER_OVERFLOW(REG_READ(FRC_TIMER_COUNT_REG(1)))))); (!TIMER_IS_AFTER_OVERFLOW(REG_READ(FRC_TIMER_ALARM_REG(1))) && TIMER_IS_AFTER_OVERFLOW(REG_READ(FRC_TIMER_COUNT_REG(1))))));
} }

View File

@ -22,7 +22,7 @@
#include "sdkconfig.h" #include "sdkconfig.h"
#include "esp_pm.h" #include "esp_pm.h"
#include "pm_impl.h" #include "esp_private/pm_impl.h"
//We use just a static array here because it's not expected many components will need //We use just a static array here because it's not expected many components will need
//an idle or tick hook. //an idle or tick hook.

View File

@ -40,7 +40,7 @@
#include "esp_spi_flash.h" #include "esp_spi_flash.h"
#include "esp32/cache_err_int.h" #include "esp32/cache_err_int.h"
#include "esp_app_trace.h" #include "esp_app_trace.h"
#include "esp_system_internal.h" #include "esp_private/system_internal.h"
#include "sdkconfig.h" #include "sdkconfig.h"
#include "esp_ota_ops.h" #include "esp_ota_ops.h"
#if CONFIG_SYSVIEW_ENABLE #if CONFIG_SYSVIEW_ENABLE

View File

@ -31,9 +31,9 @@
#include "freertos/xtensa_timer.h" #include "freertos/xtensa_timer.h"
#include "xtensa/core-macros.h" #include "xtensa/core-macros.h"
#include "pm_impl.h" #include "esp_private/pm_impl.h"
#include "pm_trace.h" #include "esp_private/pm_trace.h"
#include "esp_timer_impl.h" #include "esp_private/esp_timer_impl.h"
#include "esp32/pm.h" #include "esp32/pm.h"
/* CCOMPARE update timeout, in CPU cycles. Any value above ~600 cycles will work /* CCOMPARE update timeout, in CPU cycles. Any value above ~600 cycles will work

View File

@ -13,7 +13,7 @@
// limitations under the License. // limitations under the License.
#include "pm_trace.h" #include "esp_private/pm_trace.h"
#include "driver/gpio.h" #include "driver/gpio.h"
#include "soc/gpio_reg.h" #include "soc/gpio_reg.h"

View File

@ -13,8 +13,8 @@
// limitations under the License. // limitations under the License.
#include "esp_system.h" #include "esp_system.h"
#include "esp_system_internal.h"
#include "esp32/rom/rtc.h" #include "esp32/rom/rtc.h"
#include "esp_private/system_internal.h"
#include "soc/rtc_cntl_reg.h" #include "soc/rtc_cntl_reg.h"
static void esp_reset_reason_clear_hint(); static void esp_reset_reason_clear_hint();

View File

@ -17,7 +17,7 @@
#include <sys/param.h> #include <sys/param.h>
#include "esp_attr.h" #include "esp_attr.h"
#include "esp_sleep.h" #include "esp_sleep.h"
#include "esp_timer_impl.h" #include "esp_private/esp_timer_impl.h"
#include "esp_log.h" #include "esp_log.h"
#include "esp32/clk.h" #include "esp32/clk.h"
#include "esp_newlib.h" #include "esp_newlib.h"

View File

@ -36,7 +36,7 @@
#include "freertos/task.h" #include "freertos/task.h"
#include "freertos/xtensa_api.h" #include "freertos/xtensa_api.h"
#include "esp_heap_caps.h" #include "esp_heap_caps.h"
#include "esp_system_internal.h" #include "esp_private/system_internal.h"
#include "esp_efuse.h" #include "esp_efuse.h"
#include "esp_efuse_table.h" #include "esp_efuse_table.h"

View File

@ -35,7 +35,7 @@
#include "driver/timer.h" #include "driver/timer.h"
#include "driver/periph_ctrl.h" #include "driver/periph_ctrl.h"
#include "esp_task_wdt.h" #include "esp_task_wdt.h"
#include "esp_system_internal.h" #include "esp_private/system_internal.h"
static const char *TAG = "task_wdt"; static const char *TAG = "task_wdt";

View File

@ -1,7 +1,7 @@
set(COMPONENT_SRCDIRS ".") set(COMPONENT_SRCDIRS ".")
set(COMPONENT_ADD_INCLUDEDIRS ". ${CMAKE_CURRENT_BINARY_DIR}") set(COMPONENT_ADD_INCLUDEDIRS ". ${CMAKE_CURRENT_BINARY_DIR}")
set(COMPONENT_REQUIRES unity test_utils nvs_flash ulp) set(COMPONENT_REQUIRES unity test_utils nvs_flash ulp esp_common)
register_component() register_component()
@ -21,7 +21,7 @@ execute_process(COMMAND md5sum ${IDF_PATH}/components/esp32/include/esp_wifi_cry
COMMAND cut -c 1-7 COMMAND cut -c 1-7
OUTPUT_VARIABLE WIFI_CRYPTO_MD5 OUTPUT_VARIABLE WIFI_CRYPTO_MD5
OUTPUT_STRIP_TRAILING_WHITESPACE) OUTPUT_STRIP_TRAILING_WHITESPACE)
# Calculate MD5 value of header file esp_coexist_adapter.h # Calculate MD5 value of header file esp_coexist_adapter.h
execute_process(COMMAND md5sum ${IDF_PATH}/components/esp32/include/esp_coexist_adapter.h execute_process(COMMAND md5sum ${IDF_PATH}/components/esp32/include/esp_coexist_adapter.h
COMMAND cut -c 1-7 COMMAND cut -c 1-7
@ -34,4 +34,4 @@ add_definitions(-DCOEX_ADAPTER_MD5=\"${COEX_ADAPTER_MD5}\")
add_custom_target(esp32_test_logo DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/test_tjpgd_logo.h") add_custom_target(esp32_test_logo DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/test_tjpgd_logo.h")
add_dependencies(${COMPONENT_TARGET} esp32_test_logo) add_dependencies(${COMPONENT_TARGET} esp32_test_logo)

View File

@ -10,7 +10,7 @@
#include "freertos/task.h" #include "freertos/task.h"
#include "freertos/semphr.h" #include "freertos/semphr.h"
#include "test_utils.h" #include "test_utils.h"
#include "../esp_timer_impl.h" #include "esp_private/esp_timer_impl.h"
#ifdef CONFIG_ESP_TIMER_PROFILING #ifdef CONFIG_ESP_TIMER_PROFILING
#define WITH_PROFILING 1 #define WITH_PROFILING 1

View File

@ -0,0 +1,19 @@
set(COMPONENT_SRCS
"src/dbg_stubs.c"
"src/esp_err_to_name.c"
"src/esp_timer.c"
"src/ets_timer_legacy.c"
"src/pm_locks.c"
"src/stack_check.c")
set(COMPONENT_ADD_INCLUDEDIRS "include")
set(COMPONENT_PRIV_INCLUDEDIRS)
set(COMPONENT_REQUIRES)
# dbg_stubs.c needs eri.h from xtensa-debug-module
set(COMPONENT_PRIV_REQUIRES "xtensa-debug-module")
register_component()
set_source_files_properties(
"src/stack_check.c"
PROPERTIES COMPILE_FLAGS
-fno-stack-protector)

View File

@ -0,0 +1,9 @@
#
# Component Makefile
#
COMPONENT_ADD_INCLUDEDIRS := include
COMPONENT_SRCDIRS := src
# disable stack protection in files which are involved in initialization of that feature
stack_check.o: CFLAGS := $(filter-out -fstack-protector%, $(CFLAGS))

View File

@ -15,7 +15,7 @@
#pragma once #pragma once
/** /**
* @file esp_timer_impl.h * @file esp_private/esp_timer_impl.h
* *
* @brief Interface between common and platform-specific parts of esp_timer. * @brief Interface between common and platform-specific parts of esp_timer.
* *

View File

@ -15,7 +15,7 @@
#pragma once #pragma once
/** /**
* @file pm_impl.h * @file esp_private/pm_impl.h
* *
* This header file defines interface between PM lock functions (pm_locks.c) * This header file defines interface between PM lock functions (pm_locks.c)
* and the chip-specific power management (DFS/light sleep) implementation. * and the chip-specific power management (DFS/light sleep) implementation.

View File

@ -26,7 +26,7 @@
#include "freertos/xtensa_api.h" #include "freertos/xtensa_api.h"
#include "sdkconfig.h" #include "sdkconfig.h"
#include "esp_timer_impl.h" #include "esp_private/esp_timer_impl.h"
#ifdef CONFIG_ESP_TIMER_PROFILING #ifdef CONFIG_ESP_TIMER_PROFILING
#define WITH_PROFILING 1 #define WITH_PROFILING 1

View File

@ -32,7 +32,7 @@
#include "freertos/xtensa_api.h" #include "freertos/xtensa_api.h"
#include "sdkconfig.h" #include "sdkconfig.h"
#include "esp_timer.h" #include "esp_timer.h"
#include "esp_timer_impl.h" #include "esp_private/esp_timer_impl.h"
/* We abuse 'timer_arg' field of ETSTimer structure to hold a pointer to esp_timer */ /* We abuse 'timer_arg' field of ETSTimer structure to hold a pointer to esp_timer */
#define ESP_TIMER(p_ets_timer) ((esp_timer_handle_t) (p_ets_timer)->timer_arg) #define ESP_TIMER(p_ets_timer) ((esp_timer_handle_t) (p_ets_timer)->timer_arg)

View File

@ -19,7 +19,7 @@
#include "esp_system.h" #include "esp_system.h"
#include "sys/queue.h" #include "sys/queue.h"
#include "freertos/FreeRTOS.h" #include "freertos/FreeRTOS.h"
#include "pm_impl.h" #include "esp_private/pm_impl.h"
#include "esp_timer.h" #include "esp_timer.h"
#include "sdkconfig.h" #include "sdkconfig.h"