I'd like to boot the C5535 from different images based on specific situations in different sectors of the SPI flash. How do I modify the bootloader to boot from a different address other than the first page of the SPI flash ?
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
I'd like to boot the C5535 from different images based on specific situations in different sectors of the SPI flash. How do I modify the bootloader to boot from a different address other than the first page of the SPI flash ?
Ron said:I'd like to boot the C5535 from different images based on specific situations in different sectors of the SPI flash. How do I modify the bootloader to boot from a different address other than the first page of the SPI flash ?
If you are referring to the ROM bootloader of the C5535 then you don't have the ability to change the address of where it retrieves the image from SPI flash.
What you would need to implement for your scenario is a secondary bootloader which is the thing the ROM bootloader of the C5535 retrieves. In this secondary bootloader, you can then have the flexibility to retrieve different images at different addresses depending on your specific conditions/situations.
Ron said:Basically I would be copying words from SPI flash to RAM
Correct.
Ron said:how do I give control to the new loaded program then ?
Usually this is done by the use of a function pointer in C. You would assign the address of the entry point in your application image to the function pointer and then your secondary bootloader would then call that function pointer. Something like the following.
static void (*appEntry)();
unsigned int entryPoint = 0;
<somewhere within your bootloader after copying the image to RAM and assigning the address to the variable entryPoint, you then:
/* Giving control to the application */
appEntry = (void (*)(void)) entryPoint;
(*appEntry)( );