I have been working on my first K70 bootloader.
I based my work on the AN4370.
The part where code is written to flash seems to be working perfectly. I can see my ram programmed with the correct data.
My struggle of all time is when it comes to jump from bootloader to user application.
No matter what i do, i always end up into weird flash locations and eventually into default ISR.
I don't know from where to start to debug this, because i've already tracked the code down to the part where the SP and PC are written, and everything should be just fine. but it's not.
Here is a concrete example. My user application is located at 0xA0000. To get it down to the simplest level possible, i force the SP and PC at startup; i stop the debugger before it writer the SCB_VTOR, and i manually force the values of SP and PC, which can be copied from 0xA0000 and 0xA0004. In my case, those values are: 1FFF8148 and 000A11BD.
So, when i load those values, the program does go to 0xA11BD as expected, but when i execute the very next instruction, it sends the pc to some weird place (something like 0X3FFFFFFAB....). Then, natualy, the next instruction though an exception. (that is cateched by "unhandled_isr").
Any hint? i am out of ideas of things to try to get a clue of what may be going wrong....
Thanks a lot,