I'm currently working on a bare metal bootloader using AN2295 as our launch pad. We have found the need for using the runtime library (malloc & scatterloading) but discovered that using the standardlib causes a crash the instant we branch to __main. Here's what I've done to assess the problem.
1. --thumb & --library_type=standardlib are both explicitly specified (confirmed with --info=libraries to the linker).
2. Created a startup.S file with low level initialization that disables the watchdog before jumping into the standardlib __main function.
3. Main function in bootloader.c uses the following signature: int main(void);
4. The 16 entries of the vector table all point to a reset handler with the exception of index 0 which is the stack pointer location and index 1 which is a pointer to the startup assembly.
During execution, I can see that my low level initialization of the watchdog and peripheral clocks is happening correctly. Watchdog is disabled and all peripherals are on. However, as soon as we try the branch to __main, I fault into one of my reset vectors!
My current workaround is to use the microlib, which appears to be working with the exact same codebase and set up described above. My suspicion is that maybe I'm missing a compiler/linker flag that is causing the wrong stuff to get linked in? Or is it simply that the standardlib is not available for the K60?
While the workaround is getting me past the initial hurdle, I'd like to know if anyone has had any luck linking the standardlib so that I'm able to do it just in case.
Platform: K60 (MK60FN1M0)
IDE: Eclipse Indigo /w Keil uVision 5 plugin
Debug: P&E Micro debug driver
Thanks in advance,