We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
I am building a USB bootloader that needs to be able to reprogram both an application and itself in flash. As a result I have looked into an approach like in the RAM_Function example where the code I need to execute the flash write and USB communication is located in RAM.
I am assuming if the linker locates code in RAM that upon powerup will re-init this code from a flash location automaticly. Otherwise it is gone after a power cycle. Is this correct?
In this scenario is it possile for the RAM code to re-write the entire bootloader, including the code that is located in RAM? I would assume not, that I would need to create a system where all the code was defined in flash and I manually copy the functions I need into RAM and then run them from there.
On the other hand, if the linker is actualy placing the code in flash and it is initializing the RAM section on startup then I should be able to overwrite the flash and reset to find the bootloader RAM functions also updated.
The final question I have is since the USB drivers we have are interrupt based if the ISR functions are running from RAM what do I need to do to make sure the interrupts trigger correctly? I assume I would need to relocate the Vector Table when I jump to my RAM code so the old table can be overwritten but do I need to do anything else? Shouldn't the interrupt vectors point to RAM since that is where the functions are located in the linker?
Thanks in advance for any guidance!
Hello,
Where I can find this RAM_Function example code? I'm triyng to do something similar and this code could be very usefull to me.
Thanks a lot.