This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How does uVision start executing M3 flash OS from RAM?

It seems the flash programming algorithm is a piece of code that is downloaded into the SRAM and executes from there.

But how does it get started if there is nothing yet in the vector table at 0? If the flash is erased then everything in the vector table at zero will be 0xFFFFFFFF, so how does it start executing the algorithm in RAM? (which is at 0x20000000 for example)

I want to know because I want to be able to boot from RAM as well.

Parents
  • Mine doesn't have that BOOT0/1 feature

    But going back to the original question. None of these answers explain how a vanilla M3 microcontroller is first flashed. Initially the flash is all F's. To attach JTAG and fiddle with the PC to make it point to the flash programming algorithm downloaded in SRAM you have to first take it out of reset. But by then it has already started executing the erased flash, so it fetches a stack pointer of FFFFFFFF and a reset vector of FFFFFFFF both of which will probably make it go off in the weeds. Now maybe the debugger can use JTAG to recover from the fault but this seems a very messy way of doing the most fundamental thing to start using a flash-based M3.

Reply
  • Mine doesn't have that BOOT0/1 feature

    But going back to the original question. None of these answers explain how a vanilla M3 microcontroller is first flashed. Initially the flash is all F's. To attach JTAG and fiddle with the PC to make it point to the flash programming algorithm downloaded in SRAM you have to first take it out of reset. But by then it has already started executing the erased flash, so it fetches a stack pointer of FFFFFFFF and a reset vector of FFFFFFFF both of which will probably make it go off in the weeds. Now maybe the debugger can use JTAG to recover from the fault but this seems a very messy way of doing the most fundamental thing to start using a flash-based M3.

Children