From 176dc6749c2e3f574a0e244030b1ae5978a4ded7 Mon Sep 17 00:00:00 2001 From: rushire Date: Fri, 3 Feb 2023 23:36:53 +0300 Subject: [PATCH] Fix NDEBUG compilation issue #1074 --- components/esp8266/source/startup.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/components/esp8266/source/startup.c b/components/esp8266/source/startup.c index b9e582cec..7011ea400 100644 --- a/components/esp8266/source/startup.c +++ b/components/esp8266/source/startup.c @@ -37,6 +37,12 @@ #include "esp_newlib.h" +#ifdef NDEBUG +#define verify(expr) if(!(expr)) abort() +#else +#define verify(expr) assert(expr) +#endif + extern esp_err_t esp_pthread_init(void); extern void chip_boot(void); extern int base_gpio_init(void); @@ -69,10 +75,10 @@ static void user_init_entry(void *param) func[0](); esp_phy_init_clk(); - assert(base_gpio_init() == 0); + verify(base_gpio_init() == 0); if (esp_reset_reason_early() != ESP_RST_FAST_SW) { - assert(esp_mac_init() == ESP_OK); + verify(esp_mac_init() == ESP_OK); } #if CONFIG_RESET_REASON @@ -83,7 +89,7 @@ static void user_init_entry(void *param) esp_task_wdt_init(); #endif - assert(esp_pthread_init() == 0); + verify(esp_pthread_init() == 0); #ifdef CONFIG_BOOTLOADER_FAST_BOOT REG_CLR_BIT(DPORT_CTL_REG, DPORT_CTL_DOUBLE_CLK); @@ -160,12 +166,12 @@ void call_start_cpu(size_t start_addr) #ifdef CONFIG_INIT_OS_BEFORE_START extern int __esp_os_init(void); - assert(__esp_os_init() == 0); + verify(__esp_os_init() == 0); #endif - assert(esp_newlib_init() == 0); + verify(esp_newlib_init() == 0); - assert(xTaskCreate(user_init_entry, "uiT", ESP_TASK_MAIN_STACK, NULL, ESP_TASK_MAIN_PRIO, NULL) == pdPASS); + verify(xTaskCreate(user_init_entry, "uiT", ESP_TASK_MAIN_STACK, NULL, ESP_TASK_MAIN_PRIO, NULL) == pdPASS); vTaskStartScheduler(); }