diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2021-04-07 13:40:57 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-07 13:40:57 +0200 |
commit | 939df8cbdaf8b65966c60b4e368ba317cf4d194f (patch) | |
tree | 7003001c7e71780ae3f8d5799a4fd4650f626ba8 | |
parent | d3702a4dc3f4226ae601f503bc3f2244f9e1bdce (diff) | |
download | Nim-939df8cbdaf8b65966c60b4e368ba317cf4d194f.tar.gz |
ensure the avr example keeps compiling (#17663)
* ensure the avr example keeps compiling * Update tests/avr/thello.nim * now compiles properly
-rw-r--r-- | lib/system/embedded.nim | 4 | ||||
-rw-r--r-- | tests/avr/nim.cfg | 12 | ||||
-rw-r--r-- | tests/avr/panicoverride.nim | 13 | ||||
-rw-r--r-- | tests/avr/thello.nim | 6 |
4 files changed, 35 insertions, 0 deletions
diff --git a/lib/system/embedded.nim b/lib/system/embedded.nim index 258558c3f..e0b053c7b 100644 --- a/lib/system/embedded.nim +++ b/lib/system/embedded.nim @@ -34,6 +34,10 @@ proc quitOrDebug() {.noreturn, importc: "abort", header: "<stdlib.h>", nodecl.} proc raiseException(e: ref Exception, ename: cstring) {.compilerRtl.} = sysFatal(ReraiseDefect, "exception handling is not available") +proc raiseExceptionEx(e: sink(ref Exception), ename, procname, filename: cstring, + line: int) {.compilerRtl.} = + sysFatal(ReraiseDefect, "exception handling is not available") + proc reraiseException() {.compilerRtl.} = sysFatal(ReraiseDefect, "no exception to reraise") diff --git a/tests/avr/nim.cfg b/tests/avr/nim.cfg new file mode 100644 index 000000000..d6eba8eda --- /dev/null +++ b/tests/avr/nim.cfg @@ -0,0 +1,12 @@ +avr.standalone.gcc.path = "/usr/bin" +avr.standalone.gcc.exe = "avr-gcc" +avr.standalone.gcc.linkerexe = "avr-gcc" +passC = "-Os" +passC = "-DF_CPU=16000000UL" +passC = "-mmcu=atmega328p" +passL = "-mmcu=atmega328p" +passC = "-flto" +passL = "-flto" +cpu = "avr" +deadCodeElim = "on" +gc = "arc" diff --git a/tests/avr/panicoverride.nim b/tests/avr/panicoverride.nim new file mode 100644 index 000000000..770933ddd --- /dev/null +++ b/tests/avr/panicoverride.nim @@ -0,0 +1,13 @@ +proc printf(frmt: cstring) {.varargs, importc, header: "<stdio.h>", cdecl.} +proc exit(code: int) {.importc, header: "<stdlib.h>", cdecl.} + +{.push stack_trace: off, profiler:off.} + +proc rawoutput(s: string) = + printf("%s\n", s) + +proc panic(s: string) = + rawoutput(s) + exit(1) + +{.pop.} diff --git a/tests/avr/thello.nim b/tests/avr/thello.nim new file mode 100644 index 000000000..a0191815c --- /dev/null +++ b/tests/avr/thello.nim @@ -0,0 +1,6 @@ +discard """ + cmd: "nim c --compileOnly --os:standalone --exceptions:quirky -d:noSignalHandler -d:danger $file" + action: "compile" +""" + +echo "hi" |