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.
hello,
1. I observed that the bootloader code is run from RAM and loaded in Flash.
Could any one tell me why is it so?
is there any other reason than performance?
2. I also see that part of the application is also run from same RAM location. Won't this corrupt the code overlapping segments?
Thank you,
--
Regards,
Vishwanatha
Vishwanath,
The USB bootloader is a very complex piece of code, there are a lot of different options that can be enabled. The biggest option is the failsafe option which performs the erase and program in the safest way possible...minimizing the amount of time that if power was pulled the bootloader would be bricked. The code is run from RAM so that I only have to have one copy of the bootloader that can be stored in two different flash locations. It is not for performance reasons.
The bootloader has two entry points in flash. One is in sector G the other is in sector H. The bootloader kernel is loaded into flash and run from RAM. At boot time one of the flash entry points copies the kernel to the appropriate RAM location and then executes it. When the flash is being updated the kernel running in RAM copies the kernel in flash in between sectors so that all of the sectors can be erased. This allows you to use the rest of the space in the sector where the bootloader normally resides for your application code.
Hope that helps,
Trey