
- 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.
56 строки
1,2 КиБ
Text
56 строки
1,2 КиБ
Text
|
|
MEMORY
|
|
{
|
|
FLASH_TEXT (rw) : ORIGIN = 0, LENGTH = __flash_size - _bootloader_size
|
|
RAM (xrw) : ORIGIN = 0x800000 + __ram_start, LENGTH = __ram_size
|
|
}
|
|
|
|
ENTRY(__vector_RESET)
|
|
|
|
SECTIONS
|
|
{
|
|
.text :
|
|
{
|
|
KEEP(*(.vectors))
|
|
KEEP(*(.text.__vector_RESET))
|
|
KEEP(*(.text.main)) /* main must follow the reset handler */
|
|
*(.text)
|
|
*(.text.*)
|
|
*(.progmem)
|
|
*(.progmem.*)
|
|
. = ALIGN(16); /* needed with ld.lld for some reasoon */
|
|
}
|
|
|
|
.stack (NOLOAD) :
|
|
{
|
|
. += _stack_size;
|
|
_stack_top = .;
|
|
} >RAM
|
|
|
|
_sidata = LOADADDR(.data);
|
|
|
|
.data :
|
|
{
|
|
_sdata = .; /* used by startup code */
|
|
*(.rodata)
|
|
*(.rodata.*)
|
|
*(.data)
|
|
*(.data*)
|
|
_edata = .; /* used by startup code */
|
|
} >RAM AT>FLASH_TEXT
|
|
|
|
.bss :
|
|
{
|
|
_sbss = .; /* used by startup code */
|
|
*(.bss)
|
|
*(.bss*)
|
|
*(COMMON)
|
|
_ebss = .; /* used by startup code */
|
|
} >RAM
|
|
}
|
|
|
|
/* For the memory allocator. */
|
|
_heap_start = _ebss;
|
|
_heap_end = ORIGIN(RAM) + LENGTH(RAM);
|
|
_globals_start = _sdata;
|
|
_globals_end = _ebss;
|