aboutsummaryrefslogtreecommitdiff
path: root/stmhal
diff options
context:
space:
mode:
authorPaul Sokolovsky2014-05-10 16:51:28 +0300
committerPaul Sokolovsky2014-05-10 16:56:21 +0300
commit0f14fdea0cbb836071083213bfaf83fe5e826933 (patch)
tree8ca17b1ca927cc76a96f6b60beebe0bda5e7a7b5 /stmhal
parentd99e9083cb7fc854db0ff506caf50d81842aff0e (diff)
stmhal: Implement draft version of sys.exit().
Diffstat (limited to 'stmhal')
-rw-r--r--stmhal/main.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/stmhal/main.c b/stmhal/main.c
index ac5e82ab9..a0ee4dab4 100644
--- a/stmhal/main.c
+++ b/stmhal/main.c
@@ -35,6 +35,7 @@
#include "mpconfig.h"
#include "qstr.h"
#include "misc.h"
+#include "nlr.h"
#include "lexer.h"
#include "parse.h"
#include "obj.h"
@@ -549,3 +550,13 @@ soft_reset:
first_soft_reset = false;
goto soft_reset;
}
+
+STATIC NORETURN mp_obj_t mp_sys_exit(uint n_args, const mp_obj_t *args) {
+ int rc = 0;
+ if (n_args > 0) {
+ rc = mp_obj_get_int(args[0]);
+ }
+ nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_NotImplementedError,
+ "sys.exit(%d) called, is not fully implemented", rc));
+}
+MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_sys_exit_obj, 0, 1, mp_sys_exit);