Merge branch 'refactor/move_esp_adapter' into 'master'

esp_wifi: Move wifi OS adapter structures into esp_wifi component

See merge request espressif/esp-idf!6546
This commit is contained in:
Angus Gratton 2020-01-09 07:35:19 +08:00
commit ca8fac876f
11 changed files with 51 additions and 52 deletions

View file

@ -20,7 +20,6 @@ else()
"crosscore_int.c" "crosscore_int.c"
"dport_access.c" "dport_access.c"
"dport_panic_highint_hdl.S" "dport_panic_highint_hdl.S"
"esp_adapter.c"
"esp_timer_esp32.c" "esp_timer_esp32.c"
"esp_himem.c" "esp_himem.c"
"hw_random.c" "hw_random.c"
@ -37,12 +36,12 @@ else()
"task_wdt.c") "task_wdt.c")
set(include_dirs "include") set(include_dirs "include")
set(requires driver esp_event efuse soc) #unfortunately rom/uart uses SOC registers directly set(requires driver efuse soc) #unfortunately rom/uart uses SOC registers directly
# driver is a public requirement because esp_sleep.h uses gpio_num_t & touch_pad_t # driver is a public requirement because esp_sleep.h uses gpio_num_t & touch_pad_t
# 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(priv_requires app_trace app_update bootloader_support log mbedtls nvs_flash pthread set(priv_requires app_trace app_update bootloader_support log mbedtls nvs_flash pthread
spi_flash vfs wpa_supplicant espcoredump esp_common esp_wifi perfmon) spi_flash vfs espcoredump esp_common perfmon)
set(fragments linker.lf ld/esp32_fragments.lf) set(fragments linker.lf ld/esp32_fragments.lf)
idf_component_register(SRCS "${srcs}" idf_component_register(SRCS "${srcs}"

View file

@ -45,7 +45,6 @@
#include "esp_spi_flash.h" #include "esp_spi_flash.h"
#include "esp_flash_internal.h" #include "esp_flash_internal.h"
#include "nvs_flash.h" #include "nvs_flash.h"
#include "esp_event.h"
#include "esp_spi_flash.h" #include "esp_spi_flash.h"
#include "esp_private/crosscore_int.h" #include "esp_private/crosscore_int.h"
#include "esp_log.h" #include "esp_log.h"

View file

@ -144,15 +144,6 @@ void IRAM_ATTR esp_dport_access_stall_other_cpu_end(void)
#endif /* CONFIG_FREERTOS_UNICORE */ #endif /* CONFIG_FREERTOS_UNICORE */
} }
void IRAM_ATTR esp_dport_access_stall_other_cpu_start_wrap(void)
{
DPORT_STALL_OTHER_CPU_START();
}
void IRAM_ATTR esp_dport_access_stall_other_cpu_end_wrap(void)
{
DPORT_STALL_OTHER_CPU_END();
}
#ifndef CONFIG_FREERTOS_UNICORE #ifndef CONFIG_FREERTOS_UNICORE
static void dport_access_init_core(void *arg) static void dport_access_init_core(void *arg)

View file

@ -18,7 +18,6 @@ else()
"crosscore_int.c" "crosscore_int.c"
"dport_access.c" "dport_access.c"
"dport_panic_highint_hdl.S" "dport_panic_highint_hdl.S"
"esp_adapter.c"
"esp_timer_esp32s2beta.c" "esp_timer_esp32s2beta.c"
"hw_random.c" "hw_random.c"
"int_wdt.c" "int_wdt.c"
@ -34,13 +33,13 @@ else()
"task_wdt.c") "task_wdt.c")
set(include_dirs "include") set(include_dirs "include")
set(requires driver esp_event efuse soc) #unfortunately rom/uart uses SOC registers directly set(requires driver efuse soc) #unfortunately rom/uart uses SOC registers directly
# driver is a public requirement because esp_sleep.h uses gpio_num_t & touch_pad_t # driver is a public requirement because esp_sleep.h uses gpio_num_t & touch_pad_t
# 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(priv_requires set(priv_requires
app_trace app_update bootloader_support log mbedtls nvs_flash app_trace app_update bootloader_support log mbedtls nvs_flash
pthread spi_flash vfs wpa_supplicant espcoredump esp_common esp_wifi) pthread spi_flash vfs espcoredump esp_common)
set(fragments linker.lf ld/esp32s2beta_fragments.lf) set(fragments linker.lf ld/esp32s2beta_fragments.lf)

View file

@ -8,6 +8,13 @@ else()
set(ldfragments "linker.lf") set(ldfragments "linker.lf")
endif() endif()
if(IDF_TARGET_ESP32)
# dport workaround headers are in esp32 component
set(extra_priv_requires esp32)
else()
set(extra_priv_requires)
endif()
idf_component_register(SRCS "src/coexist.c" idf_component_register(SRCS "src/coexist.c"
"src/lib_printf.c" "src/lib_printf.c"
"src/mesh_event.c" "src/mesh_event.c"
@ -17,8 +24,10 @@ idf_component_register(SRCS "src/coexist.c"
"src/wifi_init.c" "src/wifi_init.c"
"src/wifi_default.c" "src/wifi_default.c"
"src/wifi_netif.c" "src/wifi_netif.c"
"${idf_target}/esp_adapter.c"
INCLUDE_DIRS "include" "${idf_target}/include" INCLUDE_DIRS "include" "${idf_target}/include"
PRIV_REQUIRES wpa_supplicant nvs_flash esp_netif REQUIRES esp_event
PRIV_REQUIRES wpa_supplicant nvs_flash esp_netif ${extra_priv_requires}
LDFRAGMENTS "${ldfragments}") LDFRAGMENTS "${ldfragments}")
idf_build_get_property(build_dir BUILD_DIR) idf_build_get_property(build_dir BUILD_DIR)

View file

@ -3,7 +3,7 @@
# #
COMPONENT_ADD_INCLUDEDIRS := include $(IDF_TARGET)/include COMPONENT_ADD_INCLUDEDIRS := include $(IDF_TARGET)/include
COMPONENT_SRCDIRS := src COMPONENT_SRCDIRS := src $(IDF_TARGET)
ifndef CONFIG_ESP32_NO_BLOBS ifndef CONFIG_ESP32_NO_BLOBS
LIBS := core rtc net80211 pp smartconfig coexist espnow phy mesh LIBS := core rtc net80211 pp smartconfig coexist espnow phy mesh

View file

@ -44,13 +44,20 @@
#include "esp_smartconfig.h" #include "esp_smartconfig.h"
#include "esp_coexist_internal.h" #include "esp_coexist_internal.h"
#include "esp_coexist_adapter.h" #include "esp_coexist_adapter.h"
#include "esp32/dport_access.h"
extern void esp_dport_access_stall_other_cpu_start_wrap(void);
extern void esp_dport_access_stall_other_cpu_end_wrap(void);
#define TAG "esp_adapter" #define TAG "esp_adapter"
static void IRAM_ATTR s_esp_dport_access_stall_other_cpu_start(void)
{
DPORT_STALL_OTHER_CPU_START();
}
static void IRAM_ATTR s_esp_dport_access_stall_other_cpu_end(void)
{
DPORT_STALL_OTHER_CPU_END();
}
/* /*
If CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP is enabled. Prefer to allocate a chunk of memory in SPIRAM firstly. If CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP is enabled. Prefer to allocate a chunk of memory in SPIRAM firstly.
If failed, try to allocate it in internal memory then. If failed, try to allocate it in internal memory then.
@ -557,8 +564,8 @@ wifi_osi_funcs_t g_wifi_osi_funcs = {
._event_post = esp_event_post_wrapper, ._event_post = esp_event_post_wrapper,
._get_free_heap_size = esp_get_free_heap_size, ._get_free_heap_size = esp_get_free_heap_size,
._rand = esp_random, ._rand = esp_random,
._dport_access_stall_other_cpu_start_wrap = esp_dport_access_stall_other_cpu_start_wrap, ._dport_access_stall_other_cpu_start_wrap = s_esp_dport_access_stall_other_cpu_start,
._dport_access_stall_other_cpu_end_wrap = esp_dport_access_stall_other_cpu_end_wrap, ._dport_access_stall_other_cpu_end_wrap = s_esp_dport_access_stall_other_cpu_end,
._phy_rf_deinit = esp_phy_rf_deinit, ._phy_rf_deinit = esp_phy_rf_deinit,
._phy_load_cal_and_init = esp_phy_load_cal_and_init, ._phy_load_cal_and_init = esp_phy_load_cal_and_init,
._phy_common_clock_enable = esp_phy_common_clock_enable, ._phy_common_clock_enable = esp_phy_common_clock_enable,

View file

@ -45,3 +45,4 @@ set_property(TARGET mbedcrypto APPEND PROPERTY LINK_INTERFACE_LIBRARIES mbedtls)
# Link mbedtls libraries to component library # Link mbedtls libraries to component library
target_link_libraries(${COMPONENT_LIB} INTERFACE ${mbedtls_targets}) target_link_libraries(${COMPONENT_LIB} INTERFACE ${mbedtls_targets})

View file

@ -267,7 +267,6 @@ function run_tests()
mv main/Kconfig.projbuild_bak main/Kconfig.projbuild mv main/Kconfig.projbuild_bak main/Kconfig.projbuild
assert_built ${APP_BINS} ${BOOTLOADER_BINS} ${PARTITION_BIN} assert_built ${APP_BINS} ${BOOTLOADER_BINS} ${PARTITION_BIN}
print_status "can build with phy_init_data" print_status "can build with phy_init_data"
idf.py clean > /dev/null idf.py clean > /dev/null
idf.py fullclean > /dev/null idf.py fullclean > /dev/null
@ -293,49 +292,42 @@ function run_tests()
rm sdkconfig rm sdkconfig
rm sdkconfig.defaults rm sdkconfig.defaults
# Next two tests will use this fake 'esp31b' target # the next four tests use the esp32s2beta target
export fake_target=esp31b export other_target=esp32s2beta
mkdir -p components/$fake_target
mkdir -p ${IDF_PATH}/components/xtensa/$fake_target/include
touch components/$fake_target/CMakeLists.txt
cp ${IDF_PATH}/tools/cmake/toolchain-esp32.cmake components/$fake_target/toolchain-$fake_target.cmake
${SED} -i.bak '/cmake_minimum_required/ a\
set(COMPONENTS esptool_py)' CMakeLists.txt
print_status "Can override IDF_TARGET from environment" print_status "Can override IDF_TARGET from environment"
clean_build_dir clean_build_dir
rm sdkconfig rm sdkconfig
export IDF_TARGET=$fake_target export IDF_TARGET=$other_target
(cd build && cmake -G Ninja .. ) || failure "Failed to configure with IDF_TARGET set in environment" (cd build && cmake -G Ninja .. ) || failure "Failed to configure with IDF_TARGET set in environment"
grep "CONFIG_IDF_TARGET=\"${fake_target}\"" sdkconfig || failure "Project not configured for IDF_TARGET correctly" grep "CONFIG_IDF_TARGET=\"${other_target}\"" sdkconfig || failure "Project not configured for IDF_TARGET correctly"
grep "IDF_TARGET:STRING=${fake_target}" build/CMakeCache.txt || failure "IDF_TARGET not set in CMakeCache.txt" grep "IDF_TARGET:STRING=${other_target}" build/CMakeCache.txt || failure "IDF_TARGET not set in CMakeCache.txt"
unset IDF_TARGET unset IDF_TARGET
print_status "Can set target using idf.py -D" print_status "Can set target using idf.py -D"
clean_build_dir clean_build_dir
rm sdkconfig rm sdkconfig
idf.py -DIDF_TARGET=$fake_target reconfigure || failure "Failed to set target via idf.py" idf.py -DIDF_TARGET=$other_target reconfigure || failure "Failed to set target via idf.py"
grep "CONFIG_IDF_TARGET=\"${fake_target}\"" sdkconfig || failure "Project not configured correctly using idf.py -D" grep "CONFIG_IDF_TARGET=\"${other_target}\"" sdkconfig || failure "Project not configured correctly using idf.py -D"
grep "IDF_TARGET:STRING=${fake_target}" build/CMakeCache.txt || failure "IDF_TARGET not set in CMakeCache.txt using idf.py -D" grep "IDF_TARGET:STRING=${other_target}" build/CMakeCache.txt || failure "IDF_TARGET not set in CMakeCache.txt using idf.py -D"
print_status "Can set target using -D as subcommand parameter for idf.py" print_status "Can set target using -D as subcommand parameter for idf.py"
clean_build_dir clean_build_dir
rm sdkconfig rm sdkconfig
idf.py reconfigure -DIDF_TARGET=$fake_target || failure "Failed to set target via idf.py subcommand -D parameter" idf.py reconfigure -DIDF_TARGET=$other_target || failure "Failed to set target via idf.py subcommand -D parameter"
grep "CONFIG_IDF_TARGET=\"${fake_target}\"" sdkconfig || failure "Project not configured correctly using idf.py reconfigure -D" grep "CONFIG_IDF_TARGET=\"${other_target}\"" sdkconfig || failure "Project not configured correctly using idf.py reconfigure -D"
grep "IDF_TARGET:STRING=${fake_target}" build/CMakeCache.txt || failure "IDF_TARGET not set in CMakeCache.txt using idf.py reconfigure -D" grep "IDF_TARGET:STRING=${other_target}" build/CMakeCache.txt || failure "IDF_TARGET not set in CMakeCache.txt using idf.py reconfigure -D"
real_target=esp32s2beta
print_status "Can set target using idf.py set-target" print_status "Can set target using idf.py set-target"
clean_build_dir clean_build_dir
rm sdkconfig rm sdkconfig
idf.py set-target ${real_target} || failure "Failed to set target via idf.py set-target" idf.py set-target ${other_target} || failure "Failed to set target via idf.py set-target"
grep "CONFIG_IDF_TARGET=\"${real_target}\"" sdkconfig || failure "Project not configured correctly using idf.py set-target" grep "CONFIG_IDF_TARGET=\"${other_target}\"" sdkconfig || failure "Project not configured correctly using idf.py set-target"
grep "IDF_TARGET:STRING=${real_target}" build/CMakeCache.txt || failure "IDF_TARGET not set in CMakeCache.txt using idf.py set-target" grep "IDF_TARGET:STRING=${other_target}" build/CMakeCache.txt || failure "IDF_TARGET not set in CMakeCache.txt using idf.py set-target"
# Clean up modifications for the fake target unset other_target # done changing target from the default
mv CMakeLists.txt.bak CMakeLists.txt clean_build_dir
rm -rf components sdkconfig build rm sdkconfig
print_status "Can build with auto generated CMakeLists.txt" print_status "Can build with auto generated CMakeLists.txt"
clean_build_dir clean_build_dir

View file

@ -152,7 +152,9 @@ function(__build_init idf_path)
endforeach() endforeach()
# Set components required by all other components in the build # Set components required by all other components in the build
set(requires_common cxx newlib freertos heap log soc esp_rom esp_common xtensa) #
# - lwip is here so that #include <sys/socket.h> works without any special provisions
set(requires_common cxx newlib freertos heap log lwip soc esp_rom esp_common xtensa)
idf_build_set_property(__COMPONENT_REQUIRES_COMMON "${requires_common}") idf_build_set_property(__COMPONENT_REQUIRES_COMMON "${requires_common}")
__build_get_idf_git_revision() __build_get_idf_git_revision()