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

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

Re: [avr-gcc-list] Struct problem


From: Richard Urwin
Subject: Re: [avr-gcc-list] Struct problem
Date: Mon, 2 Feb 2004 00:31:00 +0000
User-agent: KMail/1.5.3

On Saturday 31 Jan 2004 5:43 am, Eric Fu wrote:
> It works. That's great.
> But it added an unbelievable 500Bytes! It seems the code size under
> AVR GCC varies a lot for different implementations of the same task.
> In my case, what I changed was to access  UART buffer from arrays to
> pointers with malloc.
> I redefined:
>     ...
>   byte *pTxBuf,*pRxBuf;
>      ...
> Allocated memory as:
> uart0.pRxBuf = malloc(RX_BUFFER_SIZE0);
>  uart0.pTxBuf = malloc(TX_BUFFER_SIZE0);

Try allocating the buffers in global memory, and then putting pointers 
to them into the structure:

char rx0[RX_BUFFER_SIZE0]
...
UART0.PrXbUFF = &rx0[0];

-- 
Richard Urwin


reply via email to

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