Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix NDEBUG compilation issue #1074 (GIT8266O-804) #1227

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions components/esp8266/source/startup.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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
Expand All @@ -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);
Expand Down Expand Up @@ -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();
}