diff --git a/py/mpconfig.h b/py/mpconfig.h index 4a3288a3d1..0aefd1b356 100644 --- a/py/mpconfig.h +++ b/py/mpconfig.h @@ -381,3 +381,8 @@ typedef double mp_float_t; #ifndef NORETURN #define NORETURN __attribute__((noreturn)) #endif + +// Modifier for weak functions +#ifndef MP_WEAK +#define MP_WEAK __attribute__((weak)) +#endif diff --git a/stmhal/main.c b/stmhal/main.c index e264fdf4b3..b74fa73186 100644 --- a/stmhal/main.c +++ b/stmhal/main.c @@ -111,11 +111,11 @@ 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(""); + while (1); } #endif