ensure the avr example keeps compiling (#17663)

* ensure the avr example keeps compiling

* Update tests/avr/thello.nim

* now compiles properly
This commit is contained in:
Andreas Rumpf
2021-04-07 13:40:57 +02:00
committed by GitHub
parent d3702a4dc3
commit 939df8cbda
4 changed files with 35 additions and 0 deletions

View File

@@ -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")

12
tests/avr/nim.cfg Normal file
View File

@@ -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"

View File

@@ -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.}

6
tests/avr/thello.nim Normal file
View File

@@ -0,0 +1,6 @@
discard """
cmd: "nim c --compileOnly --os:standalone --exceptions:quirky -d:noSignalHandler -d:danger $file"
action: "compile"
"""
echo "hi"