diff --git a/Sming/Arch/Esp8266/Components/esp8266/startup.cpp b/Sming/Arch/Esp8266/Components/esp8266/startup.cpp index 79d1d9794b..f8f6aa807d 100644 --- a/Sming/Arch/Esp8266/Components/esp8266/startup.cpp +++ b/Sming/Arch/Esp8266/Components/esp8266/startup.cpp @@ -18,6 +18,7 @@ extern void init(); extern void cpp_core_initialize(); +// Normal entry point for user application code from SDK extern "C" void user_init(void) { // Initialise hardware timers @@ -39,12 +40,20 @@ extern "C" void user_init(void) gdb_init(); + /* + * Load partition information. + * Normally this is done in user_pre_init() but if building without WiFi + * (via esp_no_wifi Component) then user_pre_init() is not called as none of the + * SDK-related partitions are required. + * Calling this a second time is a no-op. + */ Storage::initialize(); init(); // User code init } -extern "C" void ICACHE_FLASH_ATTR WEAK_ATTR user_pre_init(void) +// SDK 3+ calls this method to configure partitions +extern "C" void user_pre_init(void) { Storage::initialize(); diff --git a/Sming/Arch/Esp8266/Components/esp_no_wifi/README.rst b/Sming/Arch/Esp8266/Components/esp_no_wifi/README.rst index a81ca6fc75..2127075d74 100644 --- a/Sming/Arch/Esp8266/Components/esp_no_wifi/README.rst +++ b/Sming/Arch/Esp8266/Components/esp_no_wifi/README.rst @@ -24,6 +24,12 @@ The SDKnoWiFi implements the startup code and some system functions but contains which is provided by the SDK and in other parts of the Sming framework. We need to provide replacement functions to interoperate correctly with the remaining SDK code. +Advantages +---------- + +- Reduces code image size when networking/WiFi is not required +- Eliminates need for SDK-specific partitions (rf_cal, phy_init, sys_param) + Process -------