Re: Getting the code size of a function in C
- From: Tauno Voipio <tauno.voipio@xxxxxxxxxxxxx>
- Date: Tue, 01 Nov 2005 20:42:31 GMT
Grant Edwards wrote:
On 2005-11-01, Tauno Voipio <tauno.voipio@xxxxxxxxxxxxx> wrote:
I need to determine the size of a function or module since I need to temporary relocate the function or module from flash into sram for firmware updates.
If you're using GCC, probably you do not need to copy anything, just locate your function to the initialized data section:
That works, but it can be a bit of a waste since the function is sitting in both flash and RAM 100% of the time. If there are multiple routines that need to be run from RAM at different points in time, you can save a bit of RAM by overlaying them.
The amount of code needed in RAM for Flash writing is pretty small: about 250 bytes on an ARM for garden-variety AMD Flashes.
But where is the "flash writing" code getting the data?
In cases I've dealt with the "flash writing" code has to impliment some sort of communications protocol in order to receive the data to be programmed into flash. In the product I'm working with right now, it takes 3KB of code to do a flash update. That's a pretty significant chunk out of my 32KB of RAM.
You do not need to keep the whole chunk in RAM at the same time. Also, only the inner loop of a Flash writer is necessary to be kept in RAM, the rest can reside in the Flash. The code responsible for the handling from the unlock sequence till the chip responds ready to poll has to be in RAM, but this is for erasing a segment or writing a single byte. The rest of code can be safely in the Flash without any problems.
The incoming data is usually transferred in some kind of chunks (e.g. 128 bytes with Xmodem). It's no too difficult to keep one chunk in the RAM and read more when that's written.
--
Tauno Voipio tauno voipio (at) iki fi .
- Follow-Ups:
- Re: Getting the code size of a function in C
- From: Grant Edwards
- Re: Getting the code size of a function in C
- References:
- Getting the code size of a function in C
- From: Tosca Berisha
- Re: Getting the code size of a function in C
- From: Tauno Voipio
- Re: Getting the code size of a function in C
- From: Grant Edwards
- Re: Getting the code size of a function in C
- From: Tauno Voipio
- Re: Getting the code size of a function in C
- From: Grant Edwards
- Getting the code size of a function in C
- Prev by Date: Re: serial protocol analyzer for 921Kbps?
- Next by Date: Re: Getting the code size of a function in C
- Previous by thread: Re: Getting the code size of a function in C
- Next by thread: Re: Getting the code size of a function in C
- Index(es):
Relevant Pages
|