KL25 FRDM Bootloader initialization location

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

KL25 FRDM Bootloader initialization location

跳至解决方案
767 次查看
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 项奖励
1 解答
423 次查看
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 项奖励
1 回复
424 次查看
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 项奖励