From 452bfda367296286df0ccde407fba8ac567378f4 Mon Sep 17 00:00:00 2001 From: Renz Bagaporo Date: Fri, 19 Mar 2021 14:30:56 +0800 Subject: [PATCH] esp32: move dport_access --- components/esp32/CMakeLists.txt | 1 - components/esp32c3/CMakeLists.txt | 5 ++--- components/esp32s2/CMakeLists.txt | 3 +-- components/esp32s3/CMakeLists.txt | 1 + components/esp_hw_support/component.mk | 2 +- .../include/soc}/esp32/dport_access.h | 0 .../include/soc}/esp32c3/dport_access.h | 0 .../include/soc}/esp32s2/dport_access.h | 2 ++ .../include/soc}/esp32s3/dport_access.h | 2 ++ components/esp_hw_support/port/esp32/CMakeLists.txt | 4 ++++ .../{ => esp_hw_support/port}/esp32/dport_access.c | 0 components/esp_hw_support/port/esp32c3/CMakeLists.txt | 3 ++- .../{ => esp_hw_support/port}/esp32c3/dport_access.c | 0 components/esp_hw_support/port/esp32s2/CMakeLists.txt | 3 ++- .../{ => esp_hw_support/port}/esp32s2/dport_access.c | 0 components/esp_hw_support/port/esp32s3/CMakeLists.txt | 1 + .../{ => esp_hw_support/port}/esp32s3/dport_access.c | 0 components/{esp32 => esp_hw_support}/test/test_dport.c | 6 ++++++ .../test/test_dport_xt_highint5.S | 6 +++++- .../test/{test_aes_sha_rsa.c.bak => test_aes_sha_rsa.c} | 9 +++++++-- 20 files changed, 36 insertions(+), 12 deletions(-) rename components/{esp32/include => esp_hw_support/include/soc}/esp32/dport_access.h (100%) rename components/{esp32c3/include => esp_hw_support/include/soc}/esp32c3/dport_access.h (100%) rename components/{esp32s2/include => esp_hw_support/include/soc}/esp32s2/dport_access.h (98%) rename components/{esp32s3/include => esp_hw_support/include/soc}/esp32s3/dport_access.h (98%) rename components/{ => esp_hw_support/port}/esp32/dport_access.c (100%) rename components/{ => esp_hw_support/port}/esp32c3/dport_access.c (100%) rename components/{ => esp_hw_support/port}/esp32s2/dport_access.c (100%) rename components/{ => esp_hw_support/port}/esp32s3/dport_access.c (100%) rename components/{esp32 => esp_hw_support}/test/test_dport.c (99%) rename components/{esp32 => esp_hw_support}/test/test_dport_xt_highint5.S (96%) rename components/mbedtls/test/{test_aes_sha_rsa.c.bak => test_aes_sha_rsa.c} (99%) diff --git a/components/esp32/CMakeLists.txt b/components/esp32/CMakeLists.txt index 03b6385ead..fc666157a0 100644 --- a/components/esp32/CMakeLists.txt +++ b/components/esp32/CMakeLists.txt @@ -13,7 +13,6 @@ else() # Regular app build set(srcs "cache_sram_mmu.c" - "dport_access.c" "esp_himem.c" "spiram.c" "spiram_psram.c") diff --git a/components/esp32c3/CMakeLists.txt b/components/esp32c3/CMakeLists.txt index eda76c3379..91b5c84222 100644 --- a/components/esp32c3/CMakeLists.txt +++ b/components/esp32c3/CMakeLists.txt @@ -11,7 +11,7 @@ if(BOOTLOADER_BUILD) else() # Regular app build - set(srcs "dport_access.c") + set(srcs) set(include_dirs "include") set(requires driver efuse soc riscv) #unfortunately rom/uart uses SOC registers directly @@ -36,8 +36,7 @@ else() target_linker_script(${COMPONENT_LIB} INTERFACE "${CMAKE_CURRENT_LIST_DIR}/ld/esp32c3.project.ld.in" PROCESS "${CMAKE_CURRENT_BINARY_DIR}/ld/esp32c3.project.ld") target_linker_script(${COMPONENT_LIB} INTERFACE "ld/esp32c3.peripherals.ld") - - target_link_libraries(${COMPONENT_LIB} PUBLIC gcc) + target_link_libraries(${COMPONENT_LIB} INTERFACE gcc) target_link_libraries(${COMPONENT_LIB} INTERFACE "-u call_user_start_cpu0") idf_build_get_property(config_dir CONFIG_DIR) diff --git a/components/esp32s2/CMakeLists.txt b/components/esp32s2/CMakeLists.txt index c229ea1ddc..eacfb4da22 100644 --- a/components/esp32s2/CMakeLists.txt +++ b/components/esp32s2/CMakeLists.txt @@ -11,8 +11,7 @@ if(BOOTLOADER_BUILD) else() # Regular app build - set(srcs "dport_access.c" - "spiram.c" + set(srcs "spiram.c" "spiram_psram.c") set(include_dirs "include") diff --git a/components/esp32s3/CMakeLists.txt b/components/esp32s3/CMakeLists.txt index d07f001ae7..1b161c0606 100644 --- a/components/esp32s3/CMakeLists.txt +++ b/components/esp32s3/CMakeLists.txt @@ -14,6 +14,7 @@ else() set(srcs "dport_access.c" "spiram.c" + "spiram_psram.c" "spi_timing_config.c") set(include_dirs "include") diff --git a/components/esp_hw_support/component.mk b/components/esp_hw_support/component.mk index 5a670db3bb..47a4f18c80 100644 --- a/components/esp_hw_support/component.mk +++ b/components/esp_hw_support/component.mk @@ -3,7 +3,7 @@ COMPONENT_ADD_INCLUDEDIRS := . include port/$(IDF_TARGET)/ include/soc port/$(ID COMPONENT_ADD_LDFRAGMENTS := linker.lf ifdef IS_BOOTLOADER_BUILD -COMPONENT_OBJEXCLUDE += clk_ctrl_os.o mac_addr.o sp_async_memcpy.o intr_alloc.o sleep_modes.o regi2c_ctrl.o +COMPONENT_OBJEXCLUDE += clk_ctrl_os.o mac_addr.o esp_async_memcpy.o intr_alloc.o sleep_modes.o regi2c_ctrl.o port/$(IDF_TARGET)/dport_access.o endif COMPONENT_OBJEXCLUDE += esp_async_memcpy.o diff --git a/components/esp32/include/esp32/dport_access.h b/components/esp_hw_support/include/soc/esp32/dport_access.h similarity index 100% rename from components/esp32/include/esp32/dport_access.h rename to components/esp_hw_support/include/soc/esp32/dport_access.h diff --git a/components/esp32c3/include/esp32c3/dport_access.h b/components/esp_hw_support/include/soc/esp32c3/dport_access.h similarity index 100% rename from components/esp32c3/include/esp32c3/dport_access.h rename to components/esp_hw_support/include/soc/esp32c3/dport_access.h diff --git a/components/esp32s2/include/esp32s2/dport_access.h b/components/esp_hw_support/include/soc/esp32s2/dport_access.h similarity index 98% rename from components/esp32s2/include/esp32s2/dport_access.h rename to components/esp_hw_support/include/soc/esp32s2/dport_access.h index ffb43c07a5..6ba6fd6555 100644 --- a/components/esp32s2/include/esp32s2/dport_access.h +++ b/components/esp_hw_support/include/soc/esp32s2/dport_access.h @@ -15,6 +15,8 @@ #ifndef _ESP_DPORT_ACCESS_H_ #define _ESP_DPORT_ACCESS_H_ +#include + #ifdef __cplusplus extern "C" { #endif diff --git a/components/esp32s3/include/esp32s3/dport_access.h b/components/esp_hw_support/include/soc/esp32s3/dport_access.h similarity index 98% rename from components/esp32s3/include/esp32s3/dport_access.h rename to components/esp_hw_support/include/soc/esp32s3/dport_access.h index 96f9363b28..f3f7007a9c 100644 --- a/components/esp32s3/include/esp32s3/dport_access.h +++ b/components/esp_hw_support/include/soc/esp32s3/dport_access.h @@ -15,6 +15,8 @@ #ifndef _ESP_DPORT_ACCESS_H_ #define _ESP_DPORT_ACCESS_H_ +#include + #ifdef __cplusplus extern "C" { #endif diff --git a/components/esp_hw_support/port/esp32/CMakeLists.txt b/components/esp_hw_support/port/esp32/CMakeLists.txt index 2bbd509c18..7e2acd0226 100644 --- a/components/esp_hw_support/port/esp32/CMakeLists.txt +++ b/components/esp_hw_support/port/esp32/CMakeLists.txt @@ -11,5 +11,9 @@ set(srcs "rtc_wdt.c" "chip_info.c") +if(NOT BOOTLOADER_BUILD) + list(APPEND srcs "dport_access.c") +endif() + add_prefix(srcs "${CMAKE_CURRENT_LIST_DIR}/" "${srcs}") target_sources(${COMPONENT_LIB} PRIVATE "${srcs}") diff --git a/components/esp32/dport_access.c b/components/esp_hw_support/port/esp32/dport_access.c similarity index 100% rename from components/esp32/dport_access.c rename to components/esp_hw_support/port/esp32/dport_access.c diff --git a/components/esp_hw_support/port/esp32c3/CMakeLists.txt b/components/esp_hw_support/port/esp32c3/CMakeLists.txt index 5b93a6e004..f72abaac20 100644 --- a/components/esp_hw_support/port/esp32c3/CMakeLists.txt +++ b/components/esp_hw_support/port/esp32c3/CMakeLists.txt @@ -13,7 +13,8 @@ if(NOT BOOTLOADER_BUILD) "memprot.c" "esp_hmac.c" "esp_crypto_lock.c" - "esp_ds.c") + "esp_ds.c" + "dport_access.c") endif() add_prefix(srcs "${CMAKE_CURRENT_LIST_DIR}/" "${srcs}") diff --git a/components/esp32c3/dport_access.c b/components/esp_hw_support/port/esp32c3/dport_access.c similarity index 100% rename from components/esp32c3/dport_access.c rename to components/esp_hw_support/port/esp32c3/dport_access.c diff --git a/components/esp_hw_support/port/esp32s2/CMakeLists.txt b/components/esp_hw_support/port/esp32s2/CMakeLists.txt index e379a61cb2..b5417ccecf 100644 --- a/components/esp_hw_support/port/esp32s2/CMakeLists.txt +++ b/components/esp_hw_support/port/esp32s2/CMakeLists.txt @@ -18,7 +18,8 @@ if(NOT BOOTLOADER_BUILD) "memprot.c" "esp_hmac.c" "esp_crypto_lock.c" - "esp_ds.c") + "esp_ds.c" + "dport_access.c") endif() add_prefix(srcs "${CMAKE_CURRENT_LIST_DIR}/" "${srcs}") diff --git a/components/esp32s2/dport_access.c b/components/esp_hw_support/port/esp32s2/dport_access.c similarity index 100% rename from components/esp32s2/dport_access.c rename to components/esp_hw_support/port/esp32s2/dport_access.c diff --git a/components/esp_hw_support/port/esp32s3/CMakeLists.txt b/components/esp_hw_support/port/esp32s3/CMakeLists.txt index 6f12e969ea..13d812c00e 100644 --- a/components/esp_hw_support/port/esp32s3/CMakeLists.txt +++ b/components/esp_hw_support/port/esp32s3/CMakeLists.txt @@ -14,6 +14,7 @@ set(srcs if(NOT BOOTLOADER_BUILD) list(APPEND srcs "../async_memcpy_impl_gdma.c" + "dport_access.c" "esp_crypto_lock.c" "memprot.c") endif() diff --git a/components/esp32s3/dport_access.c b/components/esp_hw_support/port/esp32s3/dport_access.c similarity index 100% rename from components/esp32s3/dport_access.c rename to components/esp_hw_support/port/esp32s3/dport_access.c diff --git a/components/esp32/test/test_dport.c b/components/esp_hw_support/test/test_dport.c similarity index 99% rename from components/esp32/test/test_dport.c rename to components/esp_hw_support/test/test_dport.c index 36172dbbc0..039e183b8c 100644 --- a/components/esp32/test/test_dport.c +++ b/components/esp_hw_support/test/test_dport.c @@ -3,6 +3,9 @@ * * SPDX-License-Identifier: Apache-2.0 */ +#include "sdkconfig.h" + +#if CONFIG_IDF_TARGET_ESP32 #include #include #include "xtensa/core-macros.h" @@ -26,6 +29,7 @@ #include "esp_intr_alloc.h" #include "driver/timer.h" + #define MHZ (1000000) static volatile bool exit_flag; static bool dport_test_result; @@ -501,3 +505,5 @@ TEST_CASE("Check pre-read workaround DPORT and Hi-interrupt (2)", "[esp32]") run_tasks("accessAPB", accessAPB, "accessDPORT3", accessDPORT3, 10000); } #endif // CONFIG_FREERTOS_UNICORE + +#endif // CONFIG_IDF_TARGET_ESP32 diff --git a/components/esp32/test/test_dport_xt_highint5.S b/components/esp_hw_support/test/test_dport_xt_highint5.S similarity index 96% rename from components/esp32/test/test_dport_xt_highint5.S rename to components/esp_hw_support/test/test_dport_xt_highint5.S index 7a603a5462..223a2a8924 100644 --- a/components/esp32/test/test_dport_xt_highint5.S +++ b/components/esp_hw_support/test/test_dport_xt_highint5.S @@ -1,9 +1,11 @@ +#include "sdkconfig.h" + +#if CONFIG_IDF_TARGET_ESP32 #include #include #include #include "freertos/xtensa_context.h" #include "esp_private/panic_reason.h" -#include "sdkconfig.h" #include "soc/soc.h" #include "soc/dport_reg.h" @@ -76,3 +78,5 @@ xt_highint5: .global ld_include_test_dport_xt_highint5 ld_include_test_dport_xt_highint5: #endif // CONFIG_FREERTOS_UNICORE + +#endif // CONFIG_IDF_TARGET_ESP32 diff --git a/components/mbedtls/test/test_aes_sha_rsa.c.bak b/components/mbedtls/test/test_aes_sha_rsa.c similarity index 99% rename from components/mbedtls/test/test_aes_sha_rsa.c.bak rename to components/mbedtls/test/test_aes_sha_rsa.c index 2f27750543..e1d26d8b5d 100644 --- a/components/mbedtls/test/test_aes_sha_rsa.c.bak +++ b/components/mbedtls/test/test_aes_sha_rsa.c @@ -6,8 +6,11 @@ #include #include #include -#include "esp_types.h" +#include +#if CONFIG_IDF_TARGET_ESP32 + +#include "esp_types.h" #include "freertos/FreeRTOS.h" #include "freertos/task.h" #include "freertos/semphr.h" @@ -20,10 +23,10 @@ #include "soc/dport_reg.h" #include "soc/rtc.h" #include "esp_log.h" -#include "mbedtls/sha256.h" #include "sha/sha_parallel_engine.h" #include "aes/esp_aes.h" #include "mbedtls/rsa.h" +#include "mbedtls/sha256.h" static const char *TAG = "test"; static volatile bool exit_flag = false; @@ -289,3 +292,5 @@ TEST_CASE("Test shared using AES SHA RSA", "[hw_crypto]") vSemaphoreDelete(exit_sema[i]); } } + +#endif // CONFIG_IDF_TARGET_ESP32