Hi,
We would like to migrate to a microcontroller without memory (LPC540xx) for one of our products.
Therefore I have to write a new bootloader which jumps to the main program which is located in the external flash (SPIFI). I have to run the main program as a Plain Load Image, because the flash is too slow. However, jumping to the main program does not work for me as soon as I set the main program as a Plain Load Image.
I have written a short test program that only blinks an LED three times and then jumps back to the beginning of the test program.
If I run the test program as XIP, the LED blinks endlessly.
As a Plain Load Image, the LED only flashes three times because the jump does not work.
Do I have to set the jump address differently for a Plain Load Image?
I set the start address for the stack pointers with the following define:
#define APPL_ADDRESS ((uint32_t)0x10000000) /* Application start address */
In the .map file, my XIP program says:
0x0000000010000000 _image_start = LOADADDR (.text)
0x0000000010000e38 _image_end = (LOADADDR (.data) + SIZEOF (.data))
0x0000000000000e38 _image_size = (_image_end - _image_start)
0x0000000010000000 __imghdr_loadaddress = LOADADDR (.text)
0x0000000000000003 __imghdr_imagetype = 0x3
And as Plain Load Image:
0x0000000010000000 _image_start = LOADADDR (.text)
0x0000000010000e38 _image_end = (LOADADDR (.data) + SIZEOF (.data))
0x0000000000000e38 _image_size = (_image_end - _image_start)
0x0000000000000000 __imghdr_loadaddress = ADDR (.text)
0x0000000000000001 __imghdr_imagetype = 0x1
I also looked at the program flashloader from NXP, because this can jump to a program in flash which is a Plain Load Image. But I can't figure out what I'm doing differently.
I am grateful for any hint!
Regards Mareike
Solved! Go to Solution.
Thanks for your answer!
I was able to solve the problem now!
I noticed that the flashloader from NXP also does not jump to the Plain Load Image. After flashing a reset is necessary, because only the onchip bootloader copies the program from flash to SRAM when it is marked as Plain Load Image.
So the solution to my problem is that before jumping to the main program, my own bootloader must copy it to SRAM and then jump to the beginning of SRAM at address 0x0. Similar to what is described in the application note AN12830 for the processor LPC5500
Thanks for your answer!
I was able to solve the problem now!
I noticed that the flashloader from NXP also does not jump to the Plain Load Image. After flashing a reset is necessary, because only the onchip bootloader copies the program from flash to SRAM when it is marked as Plain Load Image.
So the solution to my problem is that before jumping to the main program, my own bootloader must copy it to SRAM and then jump to the beginning of SRAM at address 0x0. Similar to what is described in the application note AN12830 for the processor LPC5500
HI
We don't have many reference besides flashloader code.
You can also refer this TN
https://www.nxp.com/docs/en/application-note/TN00037.zip
Thanks,
Jun Zhang