From 2883187c483e54ff875314b88164232eec94cc7f Mon Sep 17 00:00:00 2001 From: Michal Sieron Date: Thu, 19 Aug 2021 14:41:24 +0200 Subject: [PATCH] Make sure crt0 files come first BIOS jumps on boot to the beginning of main_ram. Unless `_start` function of loaded binary is there it won't work correctly. --- litex/soc/software/demo/linker.ld | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/litex/soc/software/demo/linker.ld b/litex/soc/software/demo/linker.ld index 9eb7bd607..d95d86286 100644 --- a/litex/soc/software/demo/linker.ld +++ b/litex/soc/software/demo/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