[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avr-gcc-list] Bootloader Wierdness

From: Reza Naima
Subject: [avr-gcc-list] Bootloader Wierdness
Date: Tue, 3 Aug 2004 15:29:52 -0700
User-agent: Mutt/

So I wrote a bootloader, tested it on an atmega128, and it worked great.
Now, I'm trying to use it on an atmega16, and i'm having a problem.  The
code is supposed to check itself after programming to verify that the
programmed memory matches what it was supposed to program.  It's failing
though (on the verify).  Am I doing something dumb here..

Address = destination address
PageBuffer = contents to be programmed

// Write data to temporary page
for (page_index = 0; page_index < PageSize; page_index += 2) {
        temp_address = Address + (unsigned long) page_index;
        temp_data    = (uint16_t)(PageBuffer[page_index]) +
                        ((uint16_t)(PageBuffer[page_index+1]) << 8);
        boot_page_fill( temp_address, temp_data);
// Write page.
boot_page_write((unsigned long)Address);
while(boot_rww_busy()) {
// Check that the page was written correctly
for (page_index=0; page_index<PageSize; page_index++) {
        if (PageBuffer[page_index] != pgm_read_byte(Address + page_index)) {
                TxChar('$'); /* VERIFY ERROR, RETRY */

reply via email to

[Prev in Thread] Current Thread [Next in Thread]