KL25 FRDM Bootloader initialization location

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

KL25 FRDM Bootloader initialization location

Jump to solution
757 Views
allgood38
Contributor I

Hello,

I am using the serial bootloader with processor expert, which is really, cool, I just have question about the way that it is initialized.

Bootloader here: Serial Bootloader for the Freedom Board with Processor Expert | MCU on Eclipse

Why does the check for a button press need to happen before the main loop is reached? Could the check for whether or not the bootloader runs not go into the main loop?

I.E. Why do we need the check here:

void __init_hardware(void)

{

  /*** User code before PE initialization ***/

  BL_CheckForUserApp(); /* check if we shall directly call the user app */

  /*** End of user code before PE initialization ***/

Instead of here:

int main(void)

/*lint -restore Enable MISRA rule (6.3) checking. */

{

  /* Write your local variable definition here */

  /*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/

  PE_low_level_init();

  /*** End of Processor Expert internal initialization.                    ***/

  BL_Run();

I ask because I need to initialize a Bluetooth device, which after initialization becomes transparent as a UART device.


Thanks,

Stephen

0 Kudos
1 Solution
413 Views
Hui_Ma
NXP TechSupport
NXP TechSupport

Hi Stephen,

The bootloader needs to decide at startup if it shall run the Bootloader or the application. For this we need to have a decision criteria, which is typically a jumper or a push button to be pressed at power up to enter bootloader mode.

The check before the PE_low_level_init() routine in order to avoid some modules initialization affect application routine, such as MCG module working mode, pins multiplexed function setting and etc.

Wish it helps.


Have a great day,
best regards,

Ma Hui

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

View solution in original post

0 Kudos
1 Reply
414 Views
Hui_Ma
NXP TechSupport
NXP TechSupport

Hi Stephen,

The bootloader needs to decide at startup if it shall run the Bootloader or the application. For this we need to have a decision criteria, which is typically a jumper or a push button to be pressed at power up to enter bootloader mode.

The check before the PE_low_level_init() routine in order to avoid some modules initialization affect application routine, such as MCG module working mode, pins multiplexed function setting and etc.

Wish it helps.


Have a great day,
best regards,

Ma Hui

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos