diff --git a/components/esp8266/Kconfig b/components/esp8266/Kconfig index 050f6d85..019d406f 100644 --- a/components/esp8266/Kconfig +++ b/components/esp8266/Kconfig @@ -236,6 +236,15 @@ config CRYSTAL_USED_40MHZ bool "40MHz" endchoice +config INIT_OS_BEFORE_START + bool "Init OS before starting it" + default n + depends on DISABLE_FREERTOS + help + Some OSes should initialize their global data structure before starting them. rt-thread is like this one. + + FreeRTOS need not do this. + config ESP8266_OTA_FROM_OLD bool "(**Expected**)ESP8266 update from old SDK by OTA" default n diff --git a/components/esp8266/source/startup.c b/components/esp8266/source/startup.c index 4d06575d..3770eb4d 100644 --- a/components/esp8266/source/startup.c +++ b/components/esp8266/source/startup.c @@ -155,6 +155,11 @@ void call_user_start(size_t start_addr) heap_caps_init(); +#ifdef CONFIG_INIT_OS_BEFORE_START + extern int __esp_os_init(void); + assert(__esp_os_init() == 0); +#endif + #if defined(CONFIG_NEWLIB_LIBRARY_LEVEL_NORMAL) || defined(CONFIG_NEWLIB_LIBRARY_LEVEL_NANO) esp_newlib_init(); #endif