derive esp_wifi from esp32 component

pull/3266/head
morris 2019-03-22 14:21:15 +08:00 zatwierdzone przez suda-morris
rodzic 5b2247df2d
commit 79bb5de426
48 zmienionych plików z 162 dodań i 130 usunięć

Wyświetl plik

@ -163,7 +163,7 @@ build_template_app:
- sed -i.bak -e's/CONFIG_OPTIMIZATION_LEVEL_DEBUG\=y/CONFIG_OPTIMIZATION_LEVEL_RELEASE=y/' sdkconfig
- make all V=1
# Check if there are any stray printf/ets_printf references in WiFi libs
- cd ../components/esp32/lib
- cd ../components/esp_wifi/lib_esp32
- test $(xtensa-esp32-elf-nm *.a | grep -w printf | wc -l) -eq 0
- test $(xtensa-esp32-elf-nm *.a | grep -w ets_printf | wc -l) -eq 0

8
.gitmodules vendored
Wyświetl plik

@ -1,7 +1,3 @@
[submodule "components/esp32/lib"]
path = components/esp32/lib
url = https://github.com/espressif/esp32-wifi-lib.git
[submodule "components/esptool_py/esptool"]
path = components/esptool_py/esptool
url = https://github.com/espressif/esptool.git
@ -69,3 +65,7 @@
[submodule "examples/build_system/cmake/import_lib/main/lib/tinyxml2"]
path = examples/build_system/cmake/import_lib/main/lib/tinyxml2
url = https://github.com/leethomason/tinyxml2
[submodule "components/esp_wifi/lib_esp32"]
path = components/esp_wifi/lib_esp32
url = https://github.com/espressif/esp32-wifi-lib.git

Wyświetl plik

@ -1,4 +1,4 @@
# Submodules normally added in component.mk, but fully qualified
# paths can be added at this level (we need binary librtc to be
# available to link bootloader).
COMPONENT_SUBMODULES += $(IDF_PATH)/components/esp32/lib
COMPONENT_SUBMODULES += $(IDF_PATH)/components/esp_wifi/lib_esp32

Wyświetl plik

@ -13,7 +13,6 @@ else()
"cache_err_int.c"
"cache_sram_mmu.c"
"clk.c"
"coexist.c"
"cpu_start.c"
"crosscore_int.c"
"dport_access.c"
@ -21,26 +20,21 @@ else()
"esp_adapter.c"
"esp_timer_esp32.c"
"esp_himem.c"
"fast_crypto_ops.c"
"freertos_hooks.c"
"gdbstub.c"
"hw_random.c"
"int_wdt.c"
"intr_alloc.c"
"ipc.c"
"lib_printf.c"
"panic.c"
"phy_init.c"
"pm_esp32.c"
"pm_trace.c"
"reset_reason.c"
"restore.c"
"sleep_modes.c"
"spiram.c"
"spiram_psram.c"
"system_api.c"
"task_wdt.c"
"wifi_init.c")
"task_wdt.c")
set(COMPONENT_ADD_INCLUDEDIRS "include")
set(COMPONENT_REQUIRES driver esp_event efuse)
@ -48,16 +42,12 @@ else()
# app_update is added here because cpu_start.c uses esp_ota_get_app_description() function.
set(COMPONENT_PRIV_REQUIRES
app_trace app_update bootloader_support log mbedtls nvs_flash
pthread smartconfig_ack spi_flash vfs wpa_supplicant espcoredump esp_common)
pthread smartconfig_ack spi_flash vfs wpa_supplicant espcoredump esp_common esp_wifi)
set(COMPONENT_ADD_LDFRAGMENTS linker.lf ld/esp32_fragments.lf)
register_component()
target_link_libraries(${COMPONENT_TARGET} "-L ${CMAKE_CURRENT_SOURCE_DIR}/lib")
if(NOT CONFIG_NO_BLOBS)
target_link_libraries(${COMPONENT_TARGET} coexist core espnow mesh net80211 phy pp rtc smartconfig wpa2 wpa wps)
endif()
target_linker_script(${COMPONENT_TARGET} "${CMAKE_CURRENT_BINARY_DIR}/esp32_out.ld")
if(CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY)
@ -101,27 +91,6 @@ else()
add_custom_target(esp32_linker_script DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/esp32_out.ld)
add_dependencies(${COMPONENT_TARGET} esp32_linker_script)
if(CONFIG_ESP32_PHY_INIT_DATA_IN_PARTITION AND IDF_BUILD_ARTIFACTS)
partition_table_get_partition_info(phy_partition_offset "--partition-type data --partition-subtype phy" "offset")
set(phy_init_data_bin "${IDF_BUILD_ARTIFACTS_DIR}/phy_init_data.bin")
# To get the phy_init_data.bin file, compile phy_init_data.h as a C file and then objcopy
# the object file to a raw binary
add_custom_command(
OUTPUT ${phy_init_data_bin}
DEPENDS ${CMAKE_CURRENT_LIST_DIR}/phy_init_data.h
COMMAND ${CMAKE_C_COMPILER} -x c -c
-I ${CMAKE_CURRENT_LIST_DIR} -I ${CMAKE_CURRENT_LIST_DIR}/include -I ${IDF_BUILD_ARTIFACTS_DIR}
-o phy_init_data.obj
${CMAKE_CURRENT_LIST_DIR}/phy_init_data.h
COMMAND ${CMAKE_OBJCOPY} -O binary phy_init_data.obj ${phy_init_data_bin}
)
add_custom_target(phy_init_data ALL DEPENDS ${phy_init_data_bin})
add_dependencies(flash phy_init_data)
esptool_py_flash_project_args(phy ${phy_partition_offset} ${phy_init_data_bin} FLASH_IN_PROJECT)
endif()
# Enable dynamic esp_timer overflow value if building unit tests
if(esp32_test IN_LIST BUILD_TEST_COMPONENTS)
add_definitions(-DESP_TIMER_DYNAMIC_OVERFLOW_VAL)

Wyświetl plik

@ -3,10 +3,6 @@
#
COMPONENT_SRCDIRS := .
LIBS ?=
ifndef CONFIG_NO_BLOBS
LIBS += core rtc net80211 pp wpa smartconfig coexist wps wpa2 espnow phy mesh
endif
ifdef CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY
# This linker script must come before esp32.project.ld
@ -22,8 +18,6 @@ LINKER_SCRIPTS += $(COMPONENT_BUILD_DIR)/esp32.project.ld esp32.peripherals.ld
#linker will ignore panic_highint_hdl.S as it has no other files depending on any
#symbols in it.
COMPONENT_ADD_LDFLAGS += $(COMPONENT_PATH)/libhal.a \
-L$(COMPONENT_PATH)/lib \
$(addprefix -l,$(LIBS)) \
-L $(COMPONENT_PATH)/ld \
-T esp32_out.ld \
-u ld_include_panic_highint_hdl \
@ -31,14 +25,9 @@ COMPONENT_ADD_LDFLAGS += $(COMPONENT_PATH)/libhal.a \
COMPONENT_ADD_LDFRAGMENTS += ld/esp32_fragments.lf linker.lf
ALL_LIB_FILES := $(patsubst %,$(COMPONENT_PATH)/lib/lib%.a,$(LIBS))
COMPONENT_SUBMODULES += lib
# final linking of project ELF depends on all binary libraries, and
# all linker scripts (except esp32_out.ld, as this is code generated here.)
COMPONENT_ADD_LINKER_DEPS := $(ALL_LIB_FILES) \
$(addprefix ld/, $(filter-out $(COMPONENT_BUILD_DIR)/esp32.project.ld, $(LINKER_SCRIPTS))) \
COMPONENT_ADD_LINKER_DEPS := $(addprefix ld/, $(filter-out $(COMPONENT_BUILD_DIR)/esp32.project.ld, $(LINKER_SCRIPTS))) \
$(COMPONENT_BUILD_DIR)/esp32.project.ld
# Preprocess esp32.ld linker script into esp32_out.ld

Wyświetl plik

@ -33,8 +33,8 @@
#include "esp_attr.h"
#include "esp_log.h"
#include "esp_heap_caps.h"
#include "esp_wifi_os_adapter.h"
#include "esp_wifi_internal.h"
#include "esp_private/wifi_os_adapter.h"
#include "esp_private/wifi.h"
#include "esp_phy_init.h"
#include "crypto/md5.h"
#include "crypto/sha1.h"

Wyświetl plik

@ -1,42 +1,19 @@
[mapping]
archive: libesp32.a
entries:
entries:
panic (noflash)
[mapping]
archive: libphy.a
entries:
* (noflash_data)
[mapping]
archive: libhal.a
entries:
* (noflash_text)
[mapping]
archive: librtc.a
entries:
entries:
* (noflash_text)
[mapping]
archive: libgcc.a
entries:
entries:
lib2funcs (noflash_text)
[mapping]
archive: libgcov.a
entries:
entries:
* (noflash)
[mapping]
archive: libpp.a
entries:
: ESP32_WIFI_IRAM_OPT = y
* (wifi_iram)
[mapping]
archive: libnet80211.a
entries:
: ESP32_WIFI_IRAM_OPT = y
* (wifi_iram)

Wyświetl plik

@ -17,7 +17,7 @@
#include "esp_system.h"
#include "esp_attr.h"
#include "esp_wifi.h"
#include "esp_wifi_internal.h"
#include "esp_private/wifi.h"
#include "esp_log.h"
#include "sdkconfig.h"
#include "esp32/rom/efuse.h"

Wyświetl plik

@ -10,28 +10,6 @@ add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/test_tjpgd_logo.h"
WORKING_DIRECTORY ${COMPONENT_PATH}
DEPENDS "${CMAKE_CURRENT_LIST_DIR}/logo.jpg")
# Calculate MD5 value of header file esp_wifi_os_adapter.h
execute_process(COMMAND md5sum ${IDF_PATH}/components/esp32/include/esp_wifi_os_adapter.h
COMMAND cut -c 1-7
OUTPUT_VARIABLE WIFI_OS_ADAPTER_MD5
OUTPUT_STRIP_TRAILING_WHITESPACE)
# Calculate MD5 value of header file esp_wifi_crypto_types.h
execute_process(COMMAND md5sum ${IDF_PATH}/components/esp32/include/esp_wifi_crypto_types.h
COMMAND cut -c 1-7
OUTPUT_VARIABLE WIFI_CRYPTO_MD5
OUTPUT_STRIP_TRAILING_WHITESPACE)
# Calculate MD5 value of header file esp_coexist_adapter.h
execute_process(COMMAND md5sum ${IDF_PATH}/components/esp32/include/esp_coexist_adapter.h
COMMAND cut -c 1-7
OUTPUT_VARIABLE COEX_ADAPTER_MD5
OUTPUT_STRIP_TRAILING_WHITESPACE)
add_definitions(-DWIFI_OS_ADAPTER_MD5=\"${WIFI_OS_ADAPTER_MD5}\")
add_definitions(-DWIFI_CRYPTO_MD5=\"${WIFI_CRYPTO_MD5}\")
add_definitions(-DCOEX_ADAPTER_MD5=\"${COEX_ADAPTER_MD5}\")
add_custom_target(esp32_test_logo DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/test_tjpgd_logo.h")
add_dependencies(${COMPONENT_TARGET} esp32_test_logo)

Wyświetl plik

@ -8,18 +8,6 @@ COMPONENT_ADD_LDFLAGS = -Wl,--whole-archive -l$(COMPONENT_NAME) -Wl,--no-whole-a
COMPONENT_SRCDIRS := .
# Calculate MD5 value of header file esp_wifi_os_adapter.h
WIFI_OS_ADAPTER_MD5_VAL=\"$(shell md5sum $(IDF_PATH)/components/esp32/include/esp_wifi_os_adapter.h | cut -c 1-7)\"
CFLAGS+=-DWIFI_OS_ADAPTER_MD5=$(WIFI_OS_ADAPTER_MD5_VAL)
# Calculate MD5 value of header file esp_wifi_crypto_types.h
WIFI_CRYPTO_MD5_VAL=\"$(shell md5sum $(IDF_PATH)/components/esp32/include/esp_wifi_crypto_types.h | cut -c 1-7)\"
CFLAGS+=-DWIFI_CRYPTO_MD5=$(WIFI_CRYPTO_MD5_VAL)
# Calculate MD5 value of header file esp_coexist_adapter.h
COEX_ADAPTER_MD5_VAL=\"$(shell md5sum $(IDF_PATH)/components/esp32/include/esp_coexist_adapter.h | cut -c 1-7)\"
CFLAGS+=-DCOEX_ADAPTER_MD5=$(COEX_ADAPTER_MD5_VAL)
test_tjpgd.o: test_tjpgd_logo.h
test_tjpgd_logo.h: $(COMPONENT_PATH)/logo.jpg

Wyświetl plik

@ -18,7 +18,7 @@
#include "esp_err.h"
#include "esp_wifi.h"
#include "esp_wifi_internal.h"
#include "esp_private/wifi.h"
#include "esp_event.h"
#include "esp_event_loop.h"
#include "esp_task.h"

Wyświetl plik

@ -0,0 +1,41 @@
set(COMPONENT_SRCS
"src/coexist.c"
"src/fast_crypto_ops.c"
"src/lib_printf.c"
"src/phy_init.c"
"src/restore.c"
"src/wifi_init.c")
set(COMPONENT_ADD_INCLUDEDIRS "include")
set(COMPONENT_PRIV_INCLUDEDIRS)
set(COMPONENT_REQUIRES)
set(COMPONENT_PRIV_REQUIRES "wpa_supplicant" "nvs_flash")
set(COMPONENT_ADD_LDFRAGMENTS "linker.lf")
register_component()
target_link_libraries(${COMPONENT_TARGET} "-L ${CMAKE_CURRENT_SOURCE_DIR}/lib_${IDF_TARGET}")
if(NOT CONFIG_NO_BLOBS)
target_link_libraries(${COMPONENT_TARGET} coexist core espnow mesh net80211 phy pp rtc smartconfig wpa2 wpa wps)
endif()
if(CONFIG_ESP32_PHY_INIT_DATA_IN_PARTITION AND IDF_BUILD_ARTIFACTS)
partition_table_get_partition_info(phy_partition_offset "--partition-type data --partition-subtype phy" "offset")
set(phy_init_data_bin "${IDF_BUILD_ARTIFACTS_DIR}/phy_init_data.bin")
# To get the phy_init_data.bin file, compile phy_init_data.h as a C file and then objcopy
# the object file to a raw binary
add_custom_command(
OUTPUT ${phy_init_data_bin}
DEPENDS ${CMAKE_CURRENT_LIST_DIR}/include/phy_init_data.h
COMMAND ${CMAKE_C_COMPILER} -x c -c
-I ${CMAKE_CURRENT_LIST_DIR} -I ${CMAKE_CURRENT_LIST_DIR}/include -I ${IDF_BUILD_ARTIFACTS_DIR}
-o phy_init_data.obj
${CMAKE_CURRENT_LIST_DIR}/include/phy_init_data.h
COMMAND ${CMAKE_OBJCOPY} -O binary phy_init_data.obj ${phy_init_data_bin}
)
add_custom_target(phy_init_data ALL DEPENDS ${phy_init_data_bin})
add_dependencies(flash phy_init_data)
esptool_py_flash_project_args(phy ${phy_partition_offset} ${phy_init_data_bin} FLASH_IN_PROJECT)
endif()

Wyświetl plik

@ -0,0 +1,21 @@
#
# Component Makefile
#
COMPONENT_ADD_INCLUDEDIRS := include
COMPONENT_SRCDIRS := src
LIBS ?=
ifndef CONFIG_NO_BLOBS
LIBS += core rtc net80211 pp wpa smartconfig coexist wps wpa2 espnow phy mesh
endif
COMPONENT_ADD_LDFLAGS += -L$(COMPONENT_PATH)/lib_esp32 \
$(addprefix -l,$(LIBS)) \
COMPONENT_ADD_LDFRAGMENTS += linker.lf
COMPONENT_SUBMODULES += lib_esp32
ALL_LIB_FILES := $(patsubst %,$(COMPONENT_PATH)/lib_esp32/lib%.a,$(LIBS))
COMPONENT_ADD_LINKER_DEPS += $(ALL_LIB_FILES)

Wyświetl plik

@ -18,7 +18,7 @@
#include "esp_err.h"
#include "esp_wifi.h"
#include "esp_wifi_types.h"
#include "esp_wifi_internal.h"
#include "esp_private/wifi.h"
#include "esp_wifi_crypto_types.h"
#ifdef __cplusplus

Wyświetl plik

@ -67,7 +67,7 @@
#include "esp_wifi_types.h"
#include "esp_wifi_crypto_types.h"
#include "esp_event.h"
#include "esp_wifi_os_adapter.h"
#include "esp_private/wifi_os_adapter.h"
#ifdef __cplusplus
extern "C" {

Wyświetl plik

@ -0,0 +1,22 @@
[mapping]
archive: libphy.a
entries:
* (noflash_data)
[mapping]
archive: librtc.a
entries:
* (noflash_text)
[mapping]
archive: libpp.a
entries:
: ESP32_WIFI_IRAM_OPT = y
* (wifi_iram)
[mapping]
archive: libnet80211.a
entries:
: ESP32_WIFI_IRAM_OPT = y
* (wifi_iram)

Wyświetl plik

@ -38,7 +38,7 @@
#include "phy_init_data.h"
#include "esp_coexist_internal.h"
#include "driver/periph_ctrl.h"
#include "esp_wifi_internal.h"
#include "esp_private/wifi.h"
extern wifi_mac_time_update_cb_t s_wifi_mac_time_update_cb;

Wyświetl plik

@ -15,7 +15,7 @@
#include <esp_event.h>
#include <esp_wifi.h>
#include "esp_log.h"
#include "esp_wifi_internal.h"
#include "esp_private/wifi.h"
#include "esp_pm.h"
#include "soc/rtc.h"
#include "esp_mesh.h"

Wyświetl plik

@ -0,0 +1,28 @@
set(COMPONENT_SRCDIRS ".")
set(COMPONENT_ADD_INCLUDEDIRS ". ${CMAKE_CURRENT_BINARY_DIR}")
set(COMPONENT_REQUIRES unity test_utils nvs_flash ulp esp_common)
register_component()
# Calculate MD5 value of header file esp_wifi_os_adapter.h
execute_process(COMMAND md5sum ${IDF_PATH}/components/esp_wifi/include/esp_private/wifi_os_adapter.h
COMMAND cut -c 1-7
OUTPUT_VARIABLE WIFI_OS_ADAPTER_MD5
OUTPUT_STRIP_TRAILING_WHITESPACE)
# Calculate MD5 value of header file esp_wifi_crypto_types.h
execute_process(COMMAND md5sum ${IDF_PATH}/components/esp_wifi/include/esp_wifi_crypto_types.h
COMMAND cut -c 1-7
OUTPUT_VARIABLE WIFI_CRYPTO_MD5
OUTPUT_STRIP_TRAILING_WHITESPACE)
# Calculate MD5 value of header file esp_coexist_adapter.h
execute_process(COMMAND md5sum ${IDF_PATH}/components/esp_wifi/include/esp_coexist_adapter.h
COMMAND cut -c 1-7
OUTPUT_VARIABLE COEX_ADAPTER_MD5
OUTPUT_STRIP_TRAILING_WHITESPACE)
add_definitions(-DWIFI_OS_ADAPTER_MD5=\"${WIFI_OS_ADAPTER_MD5}\")
add_definitions(-DWIFI_CRYPTO_MD5=\"${WIFI_CRYPTO_MD5}\")
add_definitions(-DCOEX_ADAPTER_MD5=\"${COEX_ADAPTER_MD5}\")

Wyświetl plik

@ -0,0 +1,19 @@
#
#Component Makefile
#
COMPONENT_ADD_LDFLAGS = -Wl,--whole-archive -l$(COMPONENT_NAME) -Wl,--no-whole-archive
COMPONENT_SRCDIRS := .
# Calculate MD5 value of header file esp_wifi_os_adapter.h
WIFI_OS_ADAPTER_MD5_VAL=\"$(shell md5sum $(IDF_PATH)/components/esp_wifi/include/esp_private/wifi_os_adapter.h | cut -c 1-7)\"
CFLAGS+=-DWIFI_OS_ADAPTER_MD5=$(WIFI_OS_ADAPTER_MD5_VAL)
# Calculate MD5 value of header file esp_wifi_crypto_types.h
WIFI_CRYPTO_MD5_VAL=\"$(shell md5sum $(IDF_PATH)/components/esp_wifi/include/esp_wifi_crypto_types.h | cut -c 1-7)\"
CFLAGS+=-DWIFI_CRYPTO_MD5=$(WIFI_CRYPTO_MD5_VAL)
# Calculate MD5 value of header file esp_coexist_adapter.h
COEX_ADAPTER_MD5_VAL=\"$(shell md5sum $(IDF_PATH)/components/esp_wifi/include/esp_coexist_adapter.h | cut -c 1-7)\"
CFLAGS+=-DCOEX_ADAPTER_MD5=$(COEX_ADAPTER_MD5_VAL)

Wyświetl plik

@ -3,7 +3,7 @@
*/
#include "unity.h"
#include "esp_log.h"
#include "esp_wifi_internal.h"
#include "esp_private/wifi.h"
#include "esp_coexist_internal.h"
static const char* TAG = "test_header_files_md5";

Wyświetl plik

@ -3,7 +3,7 @@
*/
#include "unity.h"
#include "esp_log.h"
#include "esp_wifi_internal.h"
#include "esp_private/wifi.h"
TEST_CASE("wifi lib git commit id","[wifi]")
{

Wyświetl plik

@ -121,7 +121,7 @@ if(CONFIG_PPP_SUPPORT)
"lwip/src/netif/ppp/polarssl/sha1.c")
endif()
set(COMPONENT_REQUIRES vfs)
set(COMPONENT_REQUIRES vfs esp_wifi)
set(COMPONENT_PRIV_REQUIRES ethernet tcpip_adapter nvs_flash)
set(COMPONENT_ADD_LDFRAGMENTS linker.lf)

Wyświetl plik

@ -18,7 +18,7 @@
#include "esp_wifi.h"
#include "esp_wifi_internal.h"
#include "esp_private/wifi.h"
#include "lwip/err.h"

Wyświetl plik

@ -24,12 +24,12 @@ INPUT = \
##
## Wi-Fi - API Reference
##
../../components/esp32/include/esp_wifi.h \
../../components/esp32/include/esp_wifi_types.h \
../../components/esp32/include/esp_smartconfig.h \
../../components/esp32/include/esp_now.h \
../../components/esp_wifi/include/esp_wifi.h \
../../components/esp_wifi/include/esp_wifi_types.h \
../../components/esp_wifi/include/esp_smartconfig.h \
../../components/esp_wifi/include/esp_now.h \
## Mesh - API Reference
../../components/esp32/include/esp_mesh.h \
../../components/esp_wifi/include/esp_mesh.h \
## Bluetooth - API Reference
## Controller && VHCI
../../components/bt/include/esp_bt.h \

Wyświetl plik

@ -1,4 +1,4 @@
components/esp32/lib @GENERAL_MIRROR_SERVER@/idf/esp32-wifi-lib.git
components/esp_wifi/lib_esp32 @GENERAL_MIRROR_SERVER@/idf/esp32-wifi-lib.git
components/bt/lib @GENERAL_MIRROR_SERVER@/idf/esp32-bt-lib.git
components/esptool_py/esptool @GENERAL_MIRROR_SERVER@/idf/esptool.git
components/aws_iot/aws-iot-device-sdk-embedded-C @GENERAL_MIRROR_SERVER@/idf/aws-iot-device-sdk-embedded-C.git ALLOW_TO_SYNC_FROM_PUBLIC