| View previous topic :: View next topic |
| Author |
Message |
mpthompson
Joined: 02 Jan 2006 Posts: 650 Location: San Carlos, CA
|
Posted: Thu May 11, 2006 6:32 am Post subject: OpenServo v2.1 Bootloader Problem |
|
|
I needed to update the bootloader on my OpenServo v2.1 PCB and ran smack into a problem. It appears that the ATmega168, unlike the ATtiny45, differentiates what code executing in different parts of the Flash memory can do. It appears the ATmega168 only allows self programming the flash via the SPM instruction when executing from the Boot Loader Section -- currently set by fuse bits to the upper 1024 words in memory. Code executing in the application portion of Flash cannot update the contents of the Flash.
Hmmm. This defeats my current mechanism of updating the bootloader by creating a special version of the bootloader that runs as an application to update the bootloader portion of Flash memory. I really don't want to have to disassemble a servo to update the bootloader.
The solution I'm going to try to attempt is to take advantage of the fact that the MCU thinks the bootloader occupies the upper 2048 bytes (1024 words) of Flash memory, but my bootloader actually only occupies the upper 1024 bytes. I should be able to squeeze in a temporary bootloader into the lower 1024 bytes that can program the actual bootloader Flash memory.
I'll cross my fingers and hope this strategy works.
-Mike |
|
| Back to top |
|
 |
mpthompson
Joined: 02 Jan 2006 Posts: 650 Location: San Carlos, CA
|
Posted: Thu May 11, 2006 7:58 am Post subject: |
|
|
OK, I stayed up late and resolved the bootloader issues along the lines described. The new ATmegaX bootloader code is checked into CVS. I noticed I don't have documentation on how to compile a special version of the bootloader so that it can update itself on the servo.
-Mike |
|
| Back to top |
|
 |
|