[Top][All Lists]

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

Re: [avr-gcc-list] Help on Large Structures

From: Jesper Hansen
Subject: Re: [avr-gcc-list] Help on Large Structures
Date: Wed, 18 Jul 2001 11:59:58 +0200

Hi Pieter,

You don't need to allocate memory statically. 
If you need a pointer, just make a pointer : 

// first make a typedef

typedef struct {
   BYTE firmware[0x8000];
} DataFlash_Type;

// then create as many pointers as you like 

DataFlash_Type *pDataFlash;

----- Original Message ----- 
From: "Pieter Potgieter" <address@hidden>
To: "AvrChat" <address@hidden>; "AvrGcc" <address@hidden>
Sent: Wednesday, July 18, 2001 5:48 PM
Subject: [avr-gcc-list] Help on Large Structures

> Hi folks
> I want to declare a structure which looks like this
> struct DataFlash
> {
>   BYTE firmware[0x8000];
> };
> When the size of the array is bigger than 32k the compiler give me the
> following 
> message:
> 'inc/ExtMemAlloc.h:138: size of array `firmware' is too large'
> The reason I want to have a structure this big ( its actually 256k ) is
> to be able 
> to declare a pointer of this type, and then use this pointer to do the
> resolving of the addresses of the members when I want to write to the
> DataFlash.
> Any suggestions on how to get past this, maybe a compiler setting? Or is
> it a new undocumented feature?  
> Another question is whether the sizeof operator will return the correct
> value?
> My Compiler flags is set to the following:
> CPFLAGS = -Os -mcall-prologues -Wall -Wstrict-prototypes
> -Wa,-ahlms=$(<:.c=.lst)
> and I am using a Mega103
> Thanx
> Pieter Potgieter
> _______________________________________________
> avr-gcc-list mailing list
> address@hidden
> http://avr.jpk.co.nz/mailman/listinfo/avr-gcc-list

reply via email to

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