/* Define memory regions */ MEMORY { RAM (wxa) : ORIGIN = 0x20000000, LENGTH = 1M /* Adjust these values for your target */ ROM (rx) : ORIGIN = 0x08000000, LENGTH = 512K /* Adjust these values for your target */ } /* Define the entry point of the program */ ENTRY(_start) SECTIONS { /* Place the program code at the beginning of ROM */ .text : { *(.text) *(.text*) } > ROM /* Initialize data section in ROM, copy to RAM at startup */ .data : { *(.data) *(.data*) } > RAM AT > ROM /* Uninitialized data section in RAM */ .bss : { *(.bss) *(.bss*) *(COMMON) } > RAM /* Constructor array section */ .init_array : { __start_init_array = .; /* Define the start symbol */ KEEP(*(SORT(.init_array.*))) KEEP(*(.init_array)) __stop_init_array = .; /* Define the end symbol */ } > ROM .fini_array : { __start_fini_array = .; /* Define the start symbol for destructors */ KEEP(*(SORT(.fini_array.*))) KEEP(*(.fini_array)) __stop_fini_array = .; /* Define the end symbol for destructors */ } > ROM /* Add other sections as needed */ }