Re: Getting the code size of a function in C



On 2005-11-01, Tauno Voipio <tauno.voipio@xxxxxxxxxxxxx> wrote:

>>>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.

You're right. I could split up the loader and keep part of it
in flash, but it's extra work and it doesn't buy me anything.
Once the decision is made to update flash, the entire RAM space
becomes available. The data that's there belongs to an
application that's being erased. It's a lot simpler to just
copy the entire loader into RAM and run it from there. Up
until that point, the loader is using 0 bytes of RAM.

> 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.

It could, but there's no advantage to doing so.

> 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.

Right.

--
Grant Edwards grante Yow! The Osmonds! You are
at all Osmonds!! Throwing up
visi.com on a freeway at dawn!!!
.



Relevant Pages

  • Re: Performance and Flash Pipelining on TI 28F12 DSPs
    ... > of "critical code" we could move to RAM. ... > from internal flash? ... Since the external RAM is as big as the internal flash, ... the timers and all other interrupts are shut off, ...
    (comp.dsp)
  • Re: [ANNOUNCE] Ramback: faster than a speeding bullet
    ... The fact is, enterprise scale ramdisks are here now, while ... enterprise scale flash is not. ... does not approach the write performance of RAM, ... My goal is not to replace RAM with flash, but disk with flash. ...
    (Linux-Kernel)
  • Re: Relocate from nor to ddr CE 5.0
    ... programmed into flash. ... but the image info says it belongs to ram. ... Your bootloader needs to have code that recognizes if the image is ... blt CODEINRAM ...
    (microsoft.public.windowsce.platbuilder)
  • XIP vs RAM
    ... Maybe the system can even get away with the next small size RAM ... Does anyone know if/what the premimum of the "K" Strata FLASH is? ... Also what are the steps needed to transition to a XIP OS? ... >>> My bootloader create a BINFS partition and an EXTENDED partition on ...
    (microsoft.public.windowsce.platbuilder)
  • Re: Getting the code size of a function in C
    ... need to temporary relocate the function or module from flash into sram for firmware updates. ... 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. ... You do not need to keep the whole chunk in RAM at the same time. ...
    (comp.arch.embedded)