I'm writing a boot script for an ARM-Cortex M3 based device. If I compile the assembler boot script and the C application code and then combine the object files and transfer them to my device everything works.
However, if I use ar
to create an archive (libboot.a) and combine that archive with the C application there is a problem:
I've put the boot code in a section:
.section .boot, "ax"
.global _start
_start:
.word 0x10000800 /* Initial stack pointer (FIXME!) */
.word start
.word nmi_handler
.word hard_fault_handler
... etc ...
I've found that ld
strips this from the final binary (the section "boot" is not available). This is quite natural as there is no dependency on it that ld
knows about, but it causes the device to not boot correctly.
So my question is: what is the best way to force this code to be included?