meta data for this page
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | |||
sw:gcc [2025/02/27 07:36] – removed - external edit (Unknown date) 127.0.0.1 | sw:gcc [2025/02/27 07:36] (current) – ↷ Page moved from gcc to sw:gcc niziak | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== GCC ====== | ||
+ | ===== preprocesor files ===== | ||
+ | |||
+ | '' | ||
+ | |||
+ | |||
+ | ===== Linker ===== | ||
+ | * **--as-needed** | ||
+ | |||
+ | * **--hash-style** - insert faster GNU hash table instead of SysV table. But looses compatiblity with older systems. [[http:// | ||
+ | |||
+ | ===== ld script ===== | ||
+ | |||
+ | [[https:// | ||
+ | [[https:// | ||
+ | [[https:// | ||
+ | [[https:// | ||
+ | [[https:// | ||
+ | [[http:// | ||
+ | |||
+ | |||
+ | === Place const variables === | ||
+ | < | ||
+ | .crc 0x7FFE : { | ||
+ | </ | ||
+ | or | ||
+ | < | ||
+ | .crc (ORIGIN(rom)+LENGTH(rom)-2): | ||
+ | { | ||
+ | | ||
+ | KEEP(*(.crc)) | ||
+ | _crcend = .; | ||
+ | } >rom | ||
+ | </ | ||
+ | |||
+ | <code c> | ||
+ | const uint32_t crcValue __attribute__ ((section (" | ||
+ | </ | ||
+ | |||
+ | === Place some symbols === | ||
+ | < | ||
+ | .bss : | ||
+ | { | ||
+ | _bss = .; | ||
+ | *(EXCLUDE_FILE (*redoznes.co) .bss*) | ||
+ | /* *(.bss*)*/ | ||
+ | *(COMMON) | ||
+ | _ebss = .; | ||
+ | } > SRAM | ||
+ | | ||
+ | | ||
+ | { | ||
+ | *redzones.co(.bss.redzone1) | ||
+ | . = ALIGN(4); | ||
+ | end = .; | ||
+ | _heap = .; /* " | ||
+ | . = . + _Min_Heap_Size; | ||
+ | _eheap = .; | ||
+ | *redoznes.co(.bss.redzone2) | ||
+ | . = . + _Min_Stack_Size; | ||
+ | . = ALIGN(4); | ||
+ | } > SRAM | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | _redzone2_begin = .; | ||
+ | . = . + 16; | ||
+ | _redzone2_end = .; | ||
+ | </ | ||
+ | |||
+ | and access them from C code: | ||
+ | |||
+ | <code C> | ||
+ | extern uint8_t _redzone1_begin; | ||
+ | extern uint8_t _redzone1_end; | ||
+ | ... | ||
+ | checkRedzone(& | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | | ||
+ | . = . + empty_ram_size; | ||
+ | </ | ||
+ | |||
+ | |||
+ | ===== Optimize per function ===== | ||
+ | <code c>int foo(int i) __attribute__((optimize(" |