diff options
author | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2016-07-30 00:35:50 +0300 |
---|---|---|
committer | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2016-07-30 00:35:50 +0300 |
commit | c8b80e4740baa0f3bdf025a23f92c3a1ff2bf6fc (patch) | |
tree | be51ce5d193bc6db7e96c4d647d1dd6d0237c6a7 /lib/embed/abort_.c | |
parent | 4f1b0292dbc5920457673a31cadfd894239cc1b9 (diff) | |
download | micropython-c8b80e4740baa0f3bdf025a23f92c3a1ff2bf6fc.tar.gz micropython-c8b80e4740baa0f3bdf025a23f92c3a1ff2bf6fc.zip |
lib/embed/abort_: Implementation of abort_() function raising uPy exception.
Helpful when porting existing C libraries to MicroPython. abort()ing in
embedded environment isn't a good idea, so when compiling such library,
-Dabort=abort_ option can be given to redirect standard abort() to this
"safe" version.
Diffstat (limited to 'lib/embed/abort_.c')
-rw-r--r-- | lib/embed/abort_.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/embed/abort_.c b/lib/embed/abort_.c new file mode 100644 index 0000000000..b54d08f2c9 --- /dev/null +++ b/lib/embed/abort_.c @@ -0,0 +1,5 @@ +#include <py/runtime.h> + +void abort_(void) { + nlr_raise(mp_obj_new_exception_msg(&mp_type_RuntimeError, "abort() called")); +} |