aboutsummaryrefslogtreecommitdiff
path: root/linker
diff options
context:
space:
mode:
authorJosh Rahm <joshuarahm@gmail.com>2024-11-14 02:19:09 -0700
committerJosh Rahm <joshuarahm@gmail.com>2024-11-14 02:19:09 -0700
commitd1ebd3bd806f4b4e1f74703f682ca64994c79a28 (patch)
tree248a6a35a3b7c5232bcdafe6a6bfbe556be8ad0f /linker
parentc9402e5a5d67ef877fa7f5f67c07a794574ded35 (diff)
downloadch573-d1ebd3bd806f4b4e1f74703f682ca64994c79a28.tar.gz
ch573-d1ebd3bd806f4b4e1f74703f682ca64994c79a28.tar.bz2
ch573-d1ebd3bd806f4b4e1f74703f682ca64994c79a28.zip
Get a good, basic framework for ISRs and properly handle the data sections.
Diffstat (limited to 'linker')
-rw-r--r--linker/ls.ld22
1 files changed, 18 insertions, 4 deletions
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) {