Files
tinygo/targets/avr.json
Ayke van Laethem eca9120e21 avr: use precise GC by default
AVR is especially sensitive to false positives in the GC for a few
reasons:

  * Pointer values are only two bytes, instead of four on most other
    microcontrollers.
  * Pointers are not aligned, so any two-byte value in an object coud be
    a pointer.
  * Memory typically starts at a low address, which makes it much more
    likely to clash with a regular integer value (which tend to be small
    values).

Therefore, use the precise GC (instead of the conservative GC) by
default. This increases binary size by around 350 bytes, but I think
it's a good tradeoff in most cases: it avoids some runtime errors and
generally RAM tends to be a lot more scarce than flash on AVR chips. If
this is too much, `-gc=conservative` or `-gc=leaking` can be used
instead.
2024-02-25 15:18:05 +01:00

25 lines
450 B
JSON

{
"llvm-target": "avr",
"build-tags": ["avr", "baremetal", "linux", "arm"],
"goos": "linux",
"goarch": "arm",
"gc": "precise",
"linker": "ld.lld",
"scheduler": "none",
"rtlib": "compiler-rt",
"libc": "picolibc",
"default-stack-size": 256,
"cflags": [
"-Werror"
],
"ldflags": [
"-T", "targets/avr.ld",
"--gc-sections"
],
"extra-files": [
"src/internal/task/task_stack_avr.S",
"src/runtime/asm_avr.S"
],
"gdb": ["avr-gdb"]
}