From 2233b3dd0195395719ee43ac5e85cf4fd1e4bf43 Mon Sep 17 00:00:00 2001 From: Mike Date: Wed, 10 Jan 2024 11:55:47 +0000 Subject: [PATCH] Fix esp8266 'no network' build of HostTests (#2702) Implementations of `system_get_sdk_version()` and `system_get_chip_id()` required. --- .../Esp8266/Components/esp_no_wifi/component.mk | 6 +++++- .../Esp8266/Components/esp_no_wifi/user_interface.c | 13 +++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/Sming/Arch/Esp8266/Components/esp_no_wifi/component.mk b/Sming/Arch/Esp8266/Components/esp_no_wifi/component.mk index 3a7b21c311..b545090127 100644 --- a/Sming/Arch/Esp8266/Components/esp_no_wifi/component.mk +++ b/Sming/Arch/Esp8266/Components/esp_no_wifi/component.mk @@ -23,6 +23,7 @@ EXTRA_OBJ := extra.o $(COMPONENT_RULE)$(EXTRA_OBJ): sdk/user_interface.o $(Q) $(OBJCOPY) \ -j *UND* \ + -j .sdk.version.* \ $(addprefix -j .text.,$(NOWIFI_SYMS)) \ $(foreach f,$(NOWIFI_SYMS),--rename-section .text.$f=.iram.text) \ $< $@ @@ -40,7 +41,10 @@ endef LIBMAIN_COMMANDS += $(NOWIFI_LIBMAIN_COMMANDS) LIBDIRS += $(COMPONENT_PATH) -EXTRA_LDFLAGS := -Tno.wifi.ld -u call_user_start_local +EXTRA_LDFLAGS := \ + -Tno.wifi.ld \ + -u call_user_start_local \ + -u SDK_VERSION ## diff --git a/Sming/Arch/Esp8266/Components/esp_no_wifi/user_interface.c b/Sming/Arch/Esp8266/Components/esp_no_wifi/user_interface.c index 8bbf3e0e2f..e5cf764c8d 100644 --- a/Sming/Arch/Esp8266/Components/esp_no_wifi/user_interface.c +++ b/Sming/Arch/Esp8266/Components/esp_no_wifi/user_interface.c @@ -1,6 +1,7 @@ #include #include #include +#include bool protect_flag; bool timer2_ms_flag; @@ -337,3 +338,15 @@ int os_printf_plus(const char* format, ...) return n; } + +const char* system_get_sdk_version() +{ + extern char SDK_VERSION[]; + return SDK_VERSION; +} + +uint32_t system_get_chip_id() +{ + // from chip_id() method in esptool.py + return (MAC0 >> 24) | ((MAC1 & 0x00ffffff) << 8); +}