diff options
Diffstat (limited to 'stmhal/main.c')
-rw-r--r-- | stmhal/main.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/stmhal/main.c b/stmhal/main.c index 9751dcac2e..0e260e18cd 100644 --- a/stmhal/main.c +++ b/stmhal/main.c @@ -29,10 +29,10 @@ #include "stm32f4xx_hal.h" +#include "mpconfig.h" #include "misc.h" #include "systick.h" #include "pendsv.h" -#include "mpconfig.h" #include "qstr.h" #include "misc.h" #include "nlr.h" @@ -40,6 +40,7 @@ #include "parse.h" #include "obj.h" #include "runtime.h" +#include "stackctrl.h" #include "gc.h" #include "gccollect.h" #include "pybstdio.h" @@ -85,7 +86,7 @@ void flash_error(int n) { led_state(PYB_LED_R2, 0); } -void __fatal_error(const char *msg) { +void NORETURN __fatal_error(const char *msg) { for (volatile uint delay = 0; delay < 10000000; delay++) { } led_state(1, 1); @@ -111,8 +112,7 @@ void nlr_jump_fail(void *val) { } #ifndef NDEBUG -void __attribute__((weak)) - __assert_func(const char *file, int line, const char *func, const char *expr) { +void MP_WEAK __assert_func(const char *file, int line, const char *func, const char *expr) { (void)func; printf("Assertion '%s' failed, at file %s:%d\n", expr, file, line); __fatal_error(""); @@ -186,6 +186,10 @@ static const char fresh_readme_txt[] = int main(void) { // TODO disable JTAG + // Stack limit should be less than real stack size, so we + // had chance to recover from limit hit. + mp_stack_set_limit(&_ram_end - &_heap_end - 512); + /* STM32F4xx HAL library initialization: - Configure the Flash prefetch, instruction and Data caches - Configure the Systick to generate an interrupt each 1 msec @@ -308,7 +312,7 @@ soft_reset: MP_OBJ_NEW_SMALL_INT(115200), }; pyb_uart_global_debug = pyb_uart_type.make_new((mp_obj_t)&pyb_uart_type, - ARRAY_SIZE(args), + MP_ARRAY_SIZE(args), 0, args); } #else |