Hi :
I am currently practicing a topic to update firmware via UART, and I chose the Mbed LPC1768 to implement it. I expected to write a BootLoader program and a program that simply controls the LED light. My thoughts are as follows:
My question is: After I put my BootLoader program on the Mbed LPC1768 via USB, how do I write the LED1 flashing program in to flash? And how do I make the BootLoader program jump to execute the LED1 flashing program?
Thank you.
Hello Jun Zhe Yang ,
1. Regarding to your description, I think you mean to make a secondary bootloader.
About your question 1 "how do I write the LED1 flashing program in to flash?"
-> After finished your UART secondary bootloader , receive application through UART, then use IAP command
to flash it , a detailed description of the IAP commands can be found in the chip user manual.
About second question" And how do I make the BootLoader program jump to execute the LED1 flashing program?"
->Execution of the user application is performed by updating the stack pointer (SP) and program counter (PC) registers. The first two 32-bit words of a binary image contain new SP and PC values that are to be loaded into their respective registers.The SP points to the new location where the user application has allocated the top of its stack (the stack grows downwards in memory). The PC on the other hand contains the location of the first executable instruction in the user application. The code just like below :
About the detail about secondary bootloader on LPC17xx, there is a application note and code about based on USB ,
while the processing is the same with UART, you can have a look : AN10866
2. By the way, there is ISP in lpc1768, The ISP routines are located in the primary bootloader. can be used to flash the microcontroller while it is in the end-user system. The ISP protocol consists of commands that are sent in ASCII format via the UART0 interface. So maybe you can use it . A detailed description of the ISP commands can be found in the chip user manual.
3. And about when enter into bootloader code or application code , there are not only one option, yours is right , also can
check one pin , if low when reset , we can run into bootloader . Also you can refer to AN10866 .
Hope it helps,
Have a great day,
TIC
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------