64 lines
1.9 KiB
Plaintext
64 lines
1.9 KiB
Plaintext
|
/* Define the memory regions: Flash and RAM */
|
||
|
MEMORY
|
||
|
{
|
||
|
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 64K
|
||
|
RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 20K
|
||
|
}
|
||
|
|
||
|
/* Define entry point (usually the reset handler defined in startup code) */
|
||
|
ENTRY(Reset_Handler)
|
||
|
|
||
|
/* Define the sections of the program */
|
||
|
SECTIONS
|
||
|
{
|
||
|
/* Code section, mapped to Flash memory */
|
||
|
.text :
|
||
|
{
|
||
|
KEEP(*(.isr_vector)) /* Vector table, which must be at the beginning of Flash */
|
||
|
*(.text) /* All code goes here */
|
||
|
*(.rodata) /* Read-only data (e.g., const variables) */
|
||
|
_etext = .; /* Mark the end of text section */
|
||
|
} > FLASH
|
||
|
|
||
|
/* Initialized data section, copied from Flash to RAM at startup */
|
||
|
.data :
|
||
|
{
|
||
|
_sdata = .; /* Start of data section */
|
||
|
*(.data) /* Initialized data */
|
||
|
_edata = .; /* End of data section */
|
||
|
} > RAM AT > FLASH
|
||
|
|
||
|
/* Uninitialized data section, placed in RAM but not stored in Flash */
|
||
|
.bss :
|
||
|
{
|
||
|
_sbss = .; /* Start of BSS */
|
||
|
*(.bss) /* Uninitialized data */
|
||
|
*(COMMON) /* Common symbols (zero-initialized) */
|
||
|
_ebss = .; /* End of BSS */
|
||
|
} > RAM
|
||
|
|
||
|
/* Stack section */
|
||
|
._stack :
|
||
|
{
|
||
|
. = ALIGN(8); /* Align to 8-byte boundary */
|
||
|
_estack = .; /* End of stack (top of the stack) */
|
||
|
. = . + 2048; /* Reserve 2 KB for stack */
|
||
|
_sstack = .; /* Start of stack */
|
||
|
} > RAM
|
||
|
|
||
|
/* Heap section */
|
||
|
.heap :
|
||
|
{
|
||
|
_sheap = .; /* Start of heap */
|
||
|
. = . + 2048; /* Reserve 2 KB for heap */
|
||
|
_eheap = .; /* End of heap */
|
||
|
} > RAM
|
||
|
}
|
||
|
|
||
|
/* Provide symbols to be used in the startup code */
|
||
|
PROVIDE(_stack_start = _sstack);
|
||
|
PROVIDE(_stack_end = _estack);
|
||
|
PROVIDE(_heap_start = _sheap);
|
||
|
PROVIDE(_heap_end = _eheap);
|
||
|
|