Today, I tried to programm a "Bootloader-Update" Prgoram.
It should be flashed as a regular programm and then copy the new bootloader to the bootloader section.
The AVR in question is the AT90PWM316, configured to 1k bytes bootloader size. Neighter application ROM nor Bootloader Area is protected by lock bits are programmed.
So, the application area is 0x000-0x3bFF and BL area is 0x3C00-0x3FFF.
However, the programm does not work as expected:
It seems, that I cannot SPM from the "application area". The calls are simply ignored.
I made the follwing experiment: I linked the code to 0x3800. The controller is erased. When I set the BL Size to 2k, flash only the BL (chip erased before that) the programm works.
(copying some bytes to 0x3c00).
When I reduce the size of the bootloader to 1k, and redo that on the (erased) controller, it won't copy the bytes.
Has someone also seen this, that you cannot SPM if your code runs outside the configured bootloader section?
I thought, it only needed to be in the RWW section....
(note, the code is *really* executed, even if the reset vector is "0", Verified with a dragon, and also by manually jumping to the right address... Interrupts are never enabled.