Skip to content

Commit 812025b

Browse files
committed
Merge pull request micropython#693 from iabdalkader/assert
Add __assert_func
2 parents e3cfc0d + 5f6f47a commit 812025b

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

stmhal/main.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,15 @@ void nlr_jump_fail(void *val) {
115115
__fatal_error("");
116116
}
117117

118+
#ifndef NDEBUG
119+
void __attribute__((weak))
120+
__assert_func(const char *file, int line, const char *func, const char *expr) {
121+
(void)func;
122+
printf("Assertion '%s' failed, at file %s:%d\n", expr, file, line);
123+
__fatal_error("");
124+
}
125+
#endif
126+
118127
STATIC mp_obj_t pyb_config_source_dir = MP_OBJ_NULL;
119128
STATIC mp_obj_t pyb_config_main = MP_OBJ_NULL;
120129
STATIC mp_obj_t pyb_config_usb_mode = MP_OBJ_NULL;

0 commit comments

Comments
 (0)