Andrei Birjukov schrieb:
I'm having trouble with entering the bootloader mode from main program.
There's bootloader code somewhere at known offset in flash.
your own code and not the BSL in the ROM.
The main program upon request does overwrites own interrupt vectors with
bootloader ones:
[... cut flash write that that looks ok ...]
This works fine, MCU resets and runs the bootloader. But then weird
stuff starts happening, like TimerB0 interrupt out of nowhere, and
eventually everything goes bananas.
- does your bootloader initialize the hardware?
- is your bootloader stand alone? you must not link it with the normal
application as it might call support functions, C-library functions
etc that are places somewhere else in the flash, in the area you're
trying to update.
a good solution is to make custom linker scripts for the application and
for the bootloader with non overlaping .text memory. compile and link
them separately. then either flash one file after the other (without
erase in between) or merge the ihex files.
chris