avr-gcc-list
[Top][All Lists]
Advanced

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

Re: [avr-gcc-list] Bootloader Wierdness


From: Reza Naima
Subject: Re: [avr-gcc-list] Bootloader Wierdness
Date: Tue, 3 Aug 2004 22:03:59 -0700
User-agent: Mutt/1.5.5.1i

Can I just say I love Open Source :)

Thanks! And would you want me to incorporate any of your updates for the
pc-side program and/or bootloader to the code on my site?

-reza

On Wed, Aug 04, 2004 at 01:10:52AM +0200, PETRIK Gergely sent me this...
> Hello!
> 
> 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 :) ).
> 
> --
> G
> 
> 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()) {
> >     boot_rww_enable();
> >}
> >
> >// 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 */
> >             break;
> >     }
> >}
> 
> --
> G




reply via email to

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