diff --git a/lib/embed/abort_.c b/lib/embed/abort_.c
new file mode 100644
index 0000000000000000000000000000000000000000..b54d08f2c9831738d8dff3490acb50ce2ac2632d
--- /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"));
+}
diff --git a/py/py.mk b/py/py.mk
index 678150429316fd7b98617e0fca35d57397b07721..948d7a67f326c70c68521d43921ebde969883243 100644
--- a/py/py.mk
+++ b/py/py.mk
@@ -221,6 +221,7 @@ PY_O_BASENAME = \
 	../extmod/vfs_fat_lexer.o \
 	../extmod/vfs_fat_misc.o \
 	../extmod/moduos_dupterm.o \
+	../lib/embed/abort_.o \
 
 # prepend the build destination prefix to the py object files
 PY_O = $(addprefix $(PY_BUILD)/, $(PY_O_BASENAME))