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.

Yes, my own bootloader

- does your bootloader initialize the hardware?

Yes it does proper initialization. But I have just discovered that WDT violation used for reset (WDCTL=666) is triggering the PUC, which is not nearly equal to POR. PUC, for example, does not clear TimerA/B IE and IFG flags, ADC12, comparator and something else. So I will have to look more if I have overlooked anything.

It is not possible to trigger POR from software AFAIK, is it?

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.

I have indeed made custom linker scripts for both bootloader and main program. They are using separate flash areas and do not overlap. I also merge HEX files with SRecord utility (http://srecord.sf.net) to a single file so it can be distributed conveniently. If there is anything wrong there, bootloader would never work at all, but it works only after POR, not PUC :-/

/Andrei

Reply via email to