diff --git a/fusee/fusee-secondary/linker.ld b/fusee/fusee-secondary/linker.ld index afbb589dd..e9fc76e24 100644 --- a/fusee/fusee-secondary/linker.ld +++ b/fusee/fusee-secondary/linker.ld @@ -15,13 +15,32 @@ SECTIONS PROVIDE(__start__ = 0xFFF00000); . = __start__; . = ALIGN(32); - .text : + + .crt0 : { . = ALIGN(32); - /* .init */ KEEP( *(.text.start) ) KEEP( *(.init) ) . = ALIGN(4); + } >main + + .chainloader : + { + . = ALIGN(32); + PROVIDE (__chainloader_start = .); + KEEP(*(.chainloader.text.start)) + build/chainloader.o(.text*) + build/chainloader.o(.rodata*) + build/chainloader.o(.data*) + . = ALIGN(8); + build/chainloader.o(.bss* COMMON) + . = ALIGN(8); + PROVIDE (__chainloader_end = .); + } >low_iram AT>main + + .text : + { + . = ALIGN(4); /* .text */ *(.text) @@ -102,20 +121,6 @@ SECTIONS . = ALIGN(4); } >main - .chainloader : - { - . = ALIGN(32); - PROVIDE (__chainloader_start = .); - KEEP(*(.chainloader.text.start)) - build/chainloader.o(.text*) - build/chainloader.o(.rodata*) - build/chainloader.o(.data*) - . = ALIGN(8); - build/chainloader.o(.bss*) - . = ALIGN(32); - PROVIDE (__chainloader_end = .); - } >low_iram AT>main - .bss : { __bss_start__ = ALIGN(32); diff --git a/fusee/fusee-secondary/src/chainloader.c b/fusee/fusee-secondary/src/chainloader.c index 144095353..6b13a1607 100644 --- a/fusee/fusee-secondary/src/chainloader.c +++ b/fusee/fusee-secondary/src/chainloader.c @@ -1,6 +1,6 @@ #include "chainloader.h" -uint8_t g_payload_arg_data[PAYLOAD_ARG_DATA_MAX_SIZE] = {1}; +uint8_t __attribute__((used)) g_payload_arg_data[PAYLOAD_ARG_DATA_MAX_SIZE] = {0}; #pragma GCC optimize (3) void relocate_and_chainload_main(uintptr_t load_address, uintptr_t src_address, size_t size, int argc) {