diff options
author | Ayke van Laethem <[email protected]> | 2021-08-14 01:41:01 +0200 |
---|---|---|
committer | Ron Evans <[email protected]> | 2021-10-06 09:04:06 +0200 |
commit | 98f84a497da93b9cf9d09e74edfbfb0a1bdebaf9 (patch) | |
tree | 793f17deb5b1cf48b84f37b1c7ea0b6c16bb23c7 /src/runtime/runtime_stm32.go | |
parent | 00c73d62ad1361ab5a814ab8844f13217027112a (diff) | |
download | tinygo-98f84a497da93b9cf9d09e74edfbfb0a1bdebaf9.tar.gz tinygo-98f84a497da93b9cf9d09e74edfbfb0a1bdebaf9.zip |
qemu: signal correct exit code to QEMU
There were a few issues that were causing qemu-system-arm and
qemu-system-riscv to give the wrong exit codes. They are in fact capable
of exiting with 0 or 1 signalled from the running application, but this
functionality wasn't used. This commit changes this in the following
ways:
* It fixes SemiHosting codes, which were incorrectly written in
decimal while they should have been written in hexadecimal (oops!).
* It modifies all the baremetal main functions (aka reset handlers) to
exit with `exit(0)` instead of `abort()`.
* It changes `syscall.Exit` to call `exit(code)` instead of `abort()`
on baremetal targets.
* It adds these new exit functions where necessary, implemented in a
way that signals the correct exit status if running under QEMU.
All in all, this means that `tinygo test` doesn't have to look at the
output of a test to determine the outcome. It can simply look at the
exit code.
Diffstat (limited to 'src/runtime/runtime_stm32.go')
-rw-r--r-- | src/runtime/runtime_stm32.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/runtime/runtime_stm32.go b/src/runtime/runtime_stm32.go index 4eaafe207..08dde0dd6 100644 --- a/src/runtime/runtime_stm32.go +++ b/src/runtime/runtime_stm32.go @@ -12,7 +12,7 @@ func postinit() {} func main() { preinit() run() - abort() + exit(0) } func waitForEvents() { |