I am writing a second stage bootloader that is XIP in flash and then runs another application, also XIP in flash.
My problem is that if I read the entry point from the header, then this calls Redlib __main__ which fails trying to free memory that was not initialised.before reaching my main. This is predictably during a call to _initio().
Alternatively, if I inspect the map file, I can find the address of my main() in the image and jump directly to that address. In this case, it fails in a call to PRINTF - DbgConsole_Printf(). When I step through the assembly language, the last argument it set, incorrectly, to 0x0.
I am printing debug output through the UART so i have set the CR_PRINTF_CHAR preprocessor directive to avoid allocating space during the PRINTF.
Please can some one tell me how I can avoid the reinitialisation stage through RedLib, or if I can call directly into main.