runBootloader

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

runBootloader

1,209 Views
carsoftlai
Contributor II

Hi,

I'm  trying to implement enable boot mode from application, and I'm using runBootloader(&bootloader_Enable) for enable bootloader instead of application, but in bl_flashloader.c just cannot capture the parameter from application by MKS22FN256 MCU, what am I miss? 

//Application source code

// Read the function address from the ROM API tree.
runBootloaderAddress = **(uint32_t **)(0x1c00001c);
runBootloader = (void (*)(void *arg))runBootloaderAddress;
// Start the bootloader.
runBootloader(&bootloader_Enable);

//Bootloader

//bl_flashloader.c

void main(void* arg)

{

   if(arg = bootloader_Enable)  bootloader_run()   //just for description 

}

6 Replies

976 Views
carsoftlai
Contributor II

Hi Kerry,

Thank you for reply.

Originally, I'm using GPIO ping for bootloader to switch between DFU or API, by now I just wanna remove this GPIO then control bootloader by software,  so I already using software reset for API jump to bootloader 0x00 flash area, but in the bootloader if without this GPIO how can I do?  

0 Kudos

976 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Carsoft,

   Yes, you are right.

   About this type question, I have talked it with our flash bootloader author, he also tells me that, if customer want to jumper to the bootloader from the app, in the app need to use the GPIO to determined enter the DFU or goto APP.

  Now, why you need to remove the GPIO? Because this type design need to check the code should stay in bootloader or jump to APP. Maybe you can consider some other communication to get the commander instead of the GPIO.

  But from my viewpoint, it's better use the GPIO to judge the mode.


Have a great day,
Kerry

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

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos

976 Views
carsoftlai
Contributor II

Hi Kerry,

Thank you very much.

Actually the system is ready to go for customer's testing, but issue is the PBC board will be block in a box, if kept GPIO once FW need to DFU then customer need to open it up and..., which we don't wanna customer to do so.

Another way we're thinking is come out a button on the box for DFU enable, once software enable be sure cannot do that, Although we have a PC GUI can communication with MCU will. 

By the way, is that possible to set a value in the specific flash address for bootloader to determined enter the DFU or goto APP? Off course we need to make sure this value cannot be clear in bootloader initial.

 

Have a nice day,

Carsoft

0 Kudos

976 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Carsoft,

   Good thought about the code located in the specific flash address.

  I think you can divide one sector as the specific flash to store your data, but please note, when you design the bootloader code, you need make sure even you erase it, you should write the data back to that special area.

  You can divide flash as: BOOTLOADER+USER area+ APP

  It's totally your application design question, from the chip side, you can do it like that.


Have a great day,
Kerry

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

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos

976 Views
mjbcswitzerland
Specialist V

Hi

If you have difficulties doing what you need you can also solve it with the uTasker KBOOT compatible loader which contains an application to loader mailbox for such commands. See Appendix C of
http://www.utasker.com/docs/uTasker/uTaskerSerialLoader.pdf

It also has advanced features such as secure/authenticated loading:

https://www.youtube.com/watch?v=MXsJvTdCcH4&list=PLWKlVb_MqDQFZAulrUywU30v869JBYi9Q&index=25


Application code to restart to loader:
*BOOT_MAIL_BOX = RESET_TO_SERIAL_LOADER;                         // put a message in the boot mailbox and reset the board (if the serial loader is installed and uses the mailbox it will cause the loader to start)
APPLICATION_INT_RESET_CTR_REG = (VECTKEY | SYSRESETREQ);             // request Cortex core reset, which will cause the software reset bit to be set in the mode controller for recognition after restart


Regards

Mark

Complete Kinetis solutions, training and support:http://www.utasker.com/kinetis.html

976 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Carsoft Lai,

    KS22 don't have the internal ROM bootloader, so you need to use the flash bootloader.

   Then, you can't use the ROM API to jumper to run bootloader, but you can use the software reset to reset the chip, then the chip will run from flash 0X00, which is the flash bootloader area.

  

Wish it helps you!

If you still have question about it, please kindly let me know.

Have a great day,
Kerry

 

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

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------