From d1ebd3bd806f4b4e1f74703f682ca64994c79a28 Mon Sep 17 00:00:00 2001 From: Josh Rahm Date: Thu, 14 Nov 2024 02:19:09 -0700 Subject: Get a good, basic framework for ISRs and properly handle the data sections. --- linker/ls.ld | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'linker') diff --git a/linker/ls.ld b/linker/ls.ld index e4cc0af..18ee181 100644 --- a/linker/ls.ld +++ b/linker/ls.ld @@ -7,22 +7,36 @@ MEMORY SECTIONS { . = ORIGIN(flash); + .text : ALIGN(0x04) { - *(.isr_vector); - . = ALIGN(0x100); + *(.sinit); + + /* The ch573 starts execution at address 0x0000, so we have to make sure the + * on_reset function is put at the beginning of the flash. */ + *(.isr_routines.on_reset); + + /* The rest of the code. */ *(.text); } >flash AT>flash - DATA_VALUES_IN_FLASH = LOADADDR(.data); + ISR_VECTOR_IN_FLASH = LOADADDR(.isr_vector); + .isr_vector : ALIGN(0x04) { + ISR_VECTOR_START = .; + *(.isr_vector); + ISR_VECTOR_STOP = .; + } >sram AT>flash + DATA_VALUES_IN_FLASH = LOADADDR(.data); .data : ALIGN(0x04) { . = ALIGN(0x04); DATA_SEGMENT_START = .; *(.data); *(.data.*); + *(.sdata); *(.rodata.*); - DATA_SEGMENT_STOP = .; + *(.srodata.*); . = ALIGN(0x04); + DATA_SEGMENT_STOP = .; } >sram AT>flash .bss : ALIGN(0x04) { -- cgit