[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fwd: RE: [avr-chat] BOOTLOADER on ATMega644]
From: |
Robert von Knobloch |
Subject: |
[Fwd: RE: [avr-chat] BOOTLOADER on ATMega644] |
Date: |
Mon, 22 Dec 2008 15:04:26 +0100 |
User-agent: |
Thunderbird 1.5.0.14 (X11/20060911) |
> -----Original Message-----
> From: address@hidden
> [mailto:address@hidden
> On Behalf Of Robert von Knobloch
> Sent: Monday, December 22, 2008 2:56 AM
> To: address@hidden
> Subject: [avr-chat] BOOTLOADER on ATMega644
>
>
>
> A second issue (to do with compiler features) is the following:
>
> I am aware that the compiler has problems with Harvard
> architecture and
> note that the storage of objects in the flash memory has somewhat
> limited support.
>
> I wish to be able to create an array of un-initialised, but
> dimensioned
> structs in the flash, which I can later fill out by writing
> (page-wise)
> into them.
>
> The values for the objects would be loaded from a host PC by
> means of a
> menu-driven interface in the Mega644, communication over RS232 to a
> terminal program (minicom) on the PC.
>
> The structs would be approximately as follows:
>
> struct Tiny13 {
> char title[] = "Tiny13 project #1";
> uint8_t flash[1024];
> unsigned int flashsize; // actual flash used
> uint8_t eeprom[64];
> uint8_t fuses[2];
> uint8_t signature[3];
> uint8_t pagesize[16];
> uint8_t numpages[32];
> } tiny13projects[4];
>
> and a similar struct array for Tiny24 projects.
>
> Ideally, as shown, a mix of dimensioned and initialised members, but
> just dimensioned would also be ok.
>
> Has anyone any thoughts how I could approach this ?
>
How often do you expext to write this in the flash area? According to the
datasheet, the flash memory has a limited number of writes.
- Find a fixed address in flash where you expect to write this, and the
application know where to read from.
- Your bootloader could would have to accept the data and write the data to
flash
- In your application, you could read this block of data using the memcpy_P()
function found in <avr/pgmspace.h>. See the avr-libc user manual for details.
I will only write here very occasionally (when a new product must be supported,
the new data will be loaded by hand, so lifetime of the flash is not a problem).
OK I can do this by creating 'fake' initialised variables (it's just a bit
tedious to create them), then I can access them symbolically and do not need to
know the address for a specific entry.
I assume you are saying that there is no support for un-initialised variables
in flash ?
Regards,
Bob