
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.
50 строки
1 008 Б
Text
50 строки
1 008 Б
Text
|
|
MEMORY
|
|
{
|
|
FLASH_TEXT (rw) : ORIGIN = 0, LENGTH = __flash_size - _bootloader_size
|
|
RAM (xrw) : ORIGIN = 0, LENGTH = __ram_size
|
|
}
|
|
|
|
SECTIONS
|
|
{
|
|
.text :
|
|
{
|
|
KEEP(*(.vectors))
|
|
KEEP(*(.text.__vector_RESET))
|
|
KEEP(*(.text.main)) /* main must follow the reset handler */
|
|
*(.text.*)
|
|
*(.rodata)
|
|
*(.rodata.*)
|
|
}
|
|
|
|
.stack (NOLOAD) :
|
|
{
|
|
. += _stack_size;
|
|
_stack_top = .;
|
|
} >RAM
|
|
|
|
_sidata = LOADADDR(.data);
|
|
|
|
.data :
|
|
{
|
|
_sdata = .; /* used by startup code */
|
|
*(.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;
|