From c378e0723262429d5489d1bcbf6b5bfc3940cc76 Mon Sep 17 00:00:00 2001 From: dongheng Date: Mon, 25 Mar 2019 20:12:58 +0800 Subject: [PATCH] feat(esp8266): Add option to init OS before starting it --- components/esp8266/Kconfig | 9 +++++++++ components/esp8266/source/startup.c | 5 +++++ 2 files changed, 14 insertions(+) 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