Граф коммитов

13 коммитов

Автор SHA1 Сообщение Дата
Ayke van Laethem
4d14d3cd54 avr: support ThinLTO
ThinLTO results in a small code size reduction, which is nice
(especially on these very small chips). It also brings us one step
closer to using ThinLTO everywhere.
2022-11-18 18:40:38 +01:00
Ayke van Laethem
df888acd5e avr: drop GNU toolchain dependency
- Use compiler-rt and picolibc instead of avr-libc.
  - Use ld.lld instead of avr-ld (or avr-gcc).

This makes it much easier to get started with TinyGo on AVR because
installing these extra tools (gcc-avr, avr-libc) can be a hassle.
It also opens the door for future improvements such as ThinLTO.

There is a code size increase but I think it's worth it in the long run.
The code size increase can hopefully be reduced with improvements to the
LLVM AVR backend and to compiler-rt.
2022-11-06 09:05:05 +01:00
Ayke van Laethem
171f793c1e avr: properly support the .rodata section
Unfortunately, the .rodata section can't be stored in flash. Instead, an
explicit .progmem section should be used, which is supported in LLVM as
address space 1 but not exposed to normal programs.

Eventually a pass should be written that converts trivial const globals
of which all loads are visible to be in addrspace 1, to get the benefits
of storing those globals directly in ROM.
2020-10-31 21:06:26 +01:00
Ayke van Laethem
213a6240a1 avr: move data address space to 0x800000
This convention is followed by most of the avr-gcc toolchain but older
versions of binutils don't mind overlapping program/data spaces.
However, newer versions start complaining about an overlap in address
space:

    avr-ld: section .stack VMA [0000000000000100,00000000000002ff] overlaps section .text VMA [0000000000000000,0000000000000225]

This commit moves the data space in the linker script to 0x800000, like
the rest of the toolchain does.
2020-03-20 15:12:38 +01:00
Ayke van Laethem
5bace979ea avr: use the correct RAM start address
Previously, the RAM was set to start at address 0. This is incorrect: on
AVR, the first few addresses are taken up by memory-mapped I/O. The
reason this didn't lead to problems (yet) was because the stack was
usually big enough to avoid real problems.
2020-03-17 14:46:56 +01:00
Ayke van Laethem
15c7d93ea9 avr: use a garbage collector
This might sound crazy, but I think it's better to enable the GC by
default to avoid surprises. It costs 1130 bytes of flash and 16 bytes of
RAM (plus heap overhead) so it's not exactly free, but if needed it can
easily be disabled with `-gc=leaking`. On the Uno (32kB flash, 2kB RAM)
that's not massive, on the DigiSpark (8kB flash, 0.5kB RAM) that may be
too much depending on the application.
2020-01-27 19:01:55 +01:00
Ayke van Laethem
c6255e4d0a targets: explicitly mark the stack as NOLOAD
This prevents it from being of type PROGBITS in lld 9, it should always
be NOBITS. It should fix the following error in lld 9:

    ROM segments are non-contiguous
2019-11-12 17:10:13 +01:00
Ayke van Laethem
a96e2879b2
avr: make stack size configurable 2018-11-20 18:20:24 +01:00
Ayke van Laethem
b09f7a5e6c
avr: make linker script generic 2018-09-23 20:50:12 +02:00
Ayke van Laethem
b9638315d2
avr: automatically generate interrupt vectors 2018-09-23 20:37:22 +02:00
Ayke van Laethem
5b0aaf0d39
targets: clean up and unify linker scripts
Especially arm.ld needed some cleaning up. Other than that, I've made
sure the two linker scripts look similar where possible.
2018-09-21 15:38:55 +02:00
Ayke van Laethem
a02426948b
avr: implement .data section
This doesn't completely work for some reason as the first character of
.data is corrupted, but otherwise it works.
2018-09-16 16:26:04 +02:00
Ayke van Laethem
76e77917d8
targets: move target-specific files to this directory 2018-09-13 00:59:39 +02:00
Переименован с avr.ld (Смотреть далее)