[Top][All Lists]

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

Re: [avr-gcc-list] Bootloader Wierdness

From: PETRIK Gergely
Subject: Re: [avr-gcc-list] Bootloader Wierdness
Date: Wed, 4 Aug 2004 01:10:52 +0200 (CEST)


i "ported" your original atmega128 bootloader to mega16 a couple of months ago. i hope the source helps, 'cause yours helped me a lot... :)

i also had verify errors for a couple of days before i found out that the relocation address must be multiplied by 2 (in the datasheet there are word addresses). while the bootloader wasn't in the bootloader section when i used the word address as a relocation, it couldn't program itself. if it's not the solution for your problem, you can still compare the sources.

(i've also rewritten the pc-side program, but left the "protocol" unchanged, so my bootloader should work with your
original programmer (at least i hope so :) ).


On Tue, 3 Aug 2004, Reza Naima wrote:

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]