diff options
| author | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2015-12-29 20:44:55 +0200 |
|---|---|---|
| committer | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2016-03-05 11:30:15 +0200 |
| commit | 8ab16b6af041ffd756c66e05bfc3068064dcda06 (patch) | |
| tree | fb1c7b723c12b9b899037384efec3d300bbb6fda /esp8266/esp_mphal.c | |
| parent | c70637bc00425a0b0076e4f7cb7ba5553b54335d (diff) | |
esp8266: Add custom _assert() function.
Enabling standard assert() (by removing -DNDEBUG) produces non-bootable
binary (because all messages go to .rodata which silently overflows).
So, for once-off debugging, have a custom _assert().
Diffstat (limited to 'esp8266/esp_mphal.c')
| -rw-r--r-- | esp8266/esp_mphal.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/esp8266/esp_mphal.c b/esp8266/esp_mphal.c index 1a46c5f24..cc0eb3eae 100644 --- a/esp8266/esp_mphal.c +++ b/esp8266/esp_mphal.c @@ -30,6 +30,8 @@ #include "uart.h" #include "esp_mphal.h" #include "user_interface.h" +#include "py/obj.h" +#include "py/mpstate.h" extern void ets_wdt_disable(void); extern void wdt_feed(void); @@ -98,3 +100,9 @@ void mp_hal_delay_ms(uint32_t delay) { void mp_hal_set_interrupt_char(int c) { // TODO } + +void __assert_func(const char *file, int line, const char *func, const char *expr) { + printf("assert:%s:%d:%s: %s\n", file, line, func, expr); + nlr_raise(mp_obj_new_exception_msg(&mp_type_AssertionError, + "C-level assert")); +} |
