avr-libc-dev
[Top][All Lists]
Advanced

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

RE: [avr-libc-dev] Problem writing to flash - atmega644


From: Patrick Mahoney
Subject: RE: [avr-libc-dev] Problem writing to flash - atmega644
Date: Tue, 21 Aug 2007 09:50:38 -0400

Eric,

Thanks for getting back to me...

I am aware that calling application space routines during a
application-flash erase operation isn't the best idea. I obviously tried
several other combinations including ones without any app-space calls
(libc or other). Nothing seems to work. Even a plain
boot_page_erase(i<<8) within a loop.

Has anyone succesfully used flash programming routines on a atmega644?

Thanks.


Pat


-----Original Message-----
From: address@hidden
[mailto:address@hidden On
Behalf Of Eric Weddington
Sent: August 20, 2007 10:09 PM
To: Patrick Mahoney; address@hidden
Subject: RE: [avr-libc-dev] Problem writing to flash - atmega644



> -----Original Message-----
> From:
> address@hidden
> [mailto:address@hidden
> org] On Behalf Of Patrick Mahoney
> Sent: Monday, August 20, 2007 4:01 PM
> To: address@hidden
> Subject: [avr-libc-dev] Problem writing to flash - atmega644
>
> Greetings,
>
> My setup is the following:
>       - Atmega644 uC.
>       - avr-libc 1.6
>       - gcc 4.2.0
>
> I am having an issue trying to have a bootloader write to flash.
>
> I am using the boot_program_page routine taken 'verbatim' from the
> avrlibc docs:
> http://www.nongnu.org/avr-libc/user-manual/group__avr__boot.ht
> ml#g7249d1
> 2e06789cd306583abf7def8176
>
> I would expect the following code to blank all of flash. Yet
> it doesn't
> happen, since the routine completes and returns as if nothing had
> happened. The application runs perfectly after reset/reboot.
>
> --------------------
>
> void  __attribute__((section (".bootloader"))) CopyMemory(void){
>
>     int i;
>     char buffer[ 256 ];
>
>     memset( buffer , '\0' , 256 );
>     for( i=0 ; i<256 ; i++ ){
>         boot_program_page( i , buffer );
>     }
>
>     printf("GET_LOW_FUSE_BITS = %x \r\n " ,boot_lock_fuse_bits_get(
> GET_LOW_FUSE_BITS ) );
>     printf("GET_LOCK_BITS = %x \r\n ", boot_lock_fuse_bits_get(
> GET_LOCK_BITS ) );
>     printf("GET_EXTENDED_FUSE_BITS = %x \r\n ",
> boot_lock_fuse_bits_get(
> GET_EXTENDED_FUSE_BITS ) );
>     printf("GET_HIGH_FUSE_BITS = %x \r\n ", boot_lock_fuse_bits_get(
> GET_HIGH_FUSE_BITS ) );
>

I believe this is in the docs (I don't have access to them at the
moment)
but you should NEVER call library routines from your bootloader. This
means
memset, and printf. Those library routines will be in your application
space
that you are probably trying to overwrite...

Eric Weddington




_______________________________________________
AVR-libc-dev mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/avr-libc-dev




reply via email to

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