diff options
author | Josh Rahm <joshuarahm@gmail.com> | 2024-11-16 15:03:22 -0700 |
---|---|---|
committer | Josh Rahm <joshuarahm@gmail.com> | 2024-11-16 15:03:22 -0700 |
commit | 9a29506823896c53b4334c5ee202ce01306d921f (patch) | |
tree | a21d6fc0d583a25e087841df80984b5c7079cff4 | |
parent | 7b1008111baa95b4a8c3195f9f5a94bfdbe8d7d2 (diff) | |
download | ch573-9a29506823896c53b4334c5ee202ce01306d921f.tar.gz ch573-9a29506823896c53b4334c5ee202ce01306d921f.tar.bz2 ch573-9a29506823896c53b4334c5ee202ce01306d921f.zip |
Fix exception handlers not being included during linking.
-rw-r--r-- | CMakeLists.txt | 6 | ||||
-rw-r--r-- | linker/ls.ld | 6 | ||||
-rw-r--r-- | src/exc.c (renamed from include/exc.c) | 0 |
3 files changed, 7 insertions, 5 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 1fdfa58..e53af7f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -56,9 +56,11 @@ add_custom_command( DEPENDS libmain libgloss_stub COMMENT "Link main.elf" COMMAND ${TC_PREFIX}gcc -nostartfiles -lgcc - -static -L ${CMAKE_BINARY_DIR}/lib -lmain -T ${LINKER_SCRIPT} + -static -L ${CMAKE_BINARY_DIR}/lib -T ${LINKER_SCRIPT} -o ${CMAKE_BINARY_DIR}/main.elf - ${CMAKE_BINARY_DIR}/lib/libmain.a + -Wl,--no-whole-archive + -Wl,--whole-archive ${CMAKE_BINARY_DIR}/lib/libmain.a + -Wl,--no-whole-archive ) # Generates the binary with objcopy. diff --git a/linker/ls.ld b/linker/ls.ld index 4ecac96..6f11aee 100644 --- a/linker/ls.ld +++ b/linker/ls.ld @@ -16,7 +16,7 @@ SECTIONS /* 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); + KEEP(*(.isr_routines.on_reset)); /* The rest of the code. */ *(.text); @@ -33,8 +33,8 @@ SECTIONS ISR_VECTOR_IN_FLASH = LOADADDR(.isr_vector); .isr_vector : ALIGN(0x04) { ISR_VECTOR_START = .; - *(.isr_vector); - *(.isr_vector.routines); + KEEP(*(.isr_vector)) + KEEP(*(.isr_vector.routines)) ISR_VECTOR_STOP = .; } >sram AT>flash diff --git a/include/exc.c b/src/exc.c index 707d3b0..707d3b0 100644 --- a/include/exc.c +++ b/src/exc.c |