diff --git a/lab004/firmware/Makefile b/lab004/firmware/Makefile index 577de49..9a0990b 100644 --- a/lab004/firmware/Makefile +++ b/lab004/firmware/Makefile @@ -3,7 +3,7 @@ BUILD_DIR=../build/ include $(BUILD_DIR)/software/include/generated/variables.mak include $(SOC_DIRECTORY)/software/common.mak -OBJECTS=isr.o main.o +OBJECTS=isr.o main.o crt0.o all: firmware.bin diff --git a/lab004/firmware/linker.ld b/lab004/firmware/linker.ld index 36af682..fba8124 100644 --- a/lab004/firmware/linker.ld +++ b/lab004/firmware/linker.ld @@ -10,6 +10,12 @@ SECTIONS .text : { _ftext = .; + /* Make sure crt0 files come first, and they, and the isr */ + /* don't get disposed of by greedy optimisation */ + *crt0*(.text) + KEEP(*crt0*(.text)) + KEEP(*(.text.isr)) + *(.text .stub .text.* .gnu.linkonce.t.*) _etext = .; } > main_ram