From c8b80e4740baa0f3bdf025a23f92c3a1ff2bf6fc Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Sat, 30 Jul 2016 00:35:50 +0300 Subject: 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. --- lib/embed/abort_.c | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 lib/embed/abort_.c (limited to 'lib/embed') diff --git a/lib/embed/abort_.c b/lib/embed/abort_.c new file mode 100644 index 000000000..b54d08f2c --- /dev/null +++ b/lib/embed/abort_.c @@ -0,0 +1,5 @@ +#include + +void abort_(void) { + nlr_raise(mp_obj_new_exception_msg(&mp_type_RuntimeError, "abort() called")); +} -- cgit v1.2.3