[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[avr-gcc-list] AT90CAN128 Bootloader
From: |
Jonathan Goldberg |
Subject: |
[avr-gcc-list] AT90CAN128 Bootloader |
Date: |
Wed, 21 Jun 2006 19:54:12 -0600 |
User-agent: |
Thunderbird 1.5.0.4 (Windows/20060516) |
Hello,
I am having some issues with the avr-libc bootloader for the
AT90CAN128. I am following the bootloader example in the avr-libc
documentation pretty much verbatim. When I try to write the flash
memory, it seems the addressing is offset by 0x10000. In other words,
if I write to starting address 0x0000, the data actually gets programmed
to starting address 0x10000.
avr-libc version is 1.4.3.
Here is a code snippet:
uint32_t mem_ptr;
uint16_t word;
uint16_t len; /* this will be 256 */
uint16_t i;
...
/* make sure mem_ptr is okay */
mem_ptr &= 0xFFFFUL;
/* ensure the page is erased */
eeprom_busy_wait ();
boot_page_erase (mem_ptr);
boot_spm_busy_wait ();
/* determine the length */
if (pmsg->dlc > 8) {
len = pmsg->dlc;
} else {
len = pmsg->data[0];
}
/* fill the flash data page */
for (i=0; i<len; i+=2) {
word = pmsg->data_ptr[i];
word |= (uint16_t)pmsg->data_ptr[i+1] << 8;
boot_page_fill (mem_ptr+i, word);
}
/* program the page */
boot_page_write (mem_ptr);
boot_spm_busy_wait ();
boot_rww_enable ();
Thanks for the help,
Jonathan
jonathan.vcf
Description: Vcard
- [avr-gcc-list] AT90CAN128 Bootloader,
Jonathan Goldberg <=