Avoiding reinitialising board after bootloader

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Avoiding reinitialising board after bootloader

715 Views
dansmithers
Contributor III

Hi,

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.

thanks

dan

Labels (1)
Tags (1)
3 Replies

628 Views
dansmithers
Contributor III

In the end, I found that the problem was with the application overlapping in the memory space with the bootloader. Once I had enforced separation, the reinitialisation worked. The clocks are getting reset in the jump function so the need to be reconfigured. Thanks for looking

628 Views
dansmithers
Contributor III

Further update:

It seems that the problem lies in the clock configurations. The clocks are re-initialised by the jump function, and I am seeing a failure when trying to return from  CLOCK_SetXtalFreq().

thanks for looking

dan

0 Kudos

628 Views
FelipeGarcia
NXP Employee
NXP Employee

Hello Dan,

 

I am sorry for the late reply. Are you still having this issue? If the problem is due to the clocks then the easiest solution is to let the bootloader configure the clock as required later by the application and avoid the reinitialization of the clocks.

 

Best regards,

Felipe

0 Kudos