diff options
| author | Damien George <damien@micropython.org> | 2024-08-12 11:17:26 +1000 |
|---|---|---|
| committer | Damien George <damien@micropython.org> | 2024-08-28 11:52:08 +1000 |
| commit | 1090f1a60c730cd589f65047e105a22a0445721d (patch) | |
| tree | 84cf3fcd1b8c4bb6677b03042953fa4f222ffcc7 /shared/runtime/semihosting_arm.c | |
| parent | 70a6791b09f9fad55b99e5996433888cee0a7a64 (diff) | |
shared/runtime/semihosting_arm: Add mp_semihosting_exit.
Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'shared/runtime/semihosting_arm.c')
| -rw-r--r-- | shared/runtime/semihosting_arm.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/shared/runtime/semihosting_arm.c b/shared/runtime/semihosting_arm.c index d44124faa..f4d168f79 100644 --- a/shared/runtime/semihosting_arm.c +++ b/shared/runtime/semihosting_arm.c @@ -36,6 +36,7 @@ #define SYS_WRITE 0x05 #define SYS_READ 0x06 #define SYS_READC 0x07 +#define SYS_EXIT 0x18 // Constants: #define OPEN_MODE_READ (0) // mode "r" @@ -88,6 +89,13 @@ void mp_semihosting_init() { mp_semihosting_stdout = mp_semihosting_open_console(OPEN_MODE_WRITE); } +void mp_semihosting_exit(int status) { + if (status == 0) { + status = 0x20026; + } + mp_semihosting_call(SYS_EXIT, (void *)(uintptr_t)status); +} + int mp_semihosting_rx_char() { return mp_semihosting_call(SYS_READC, NULL); } |
