Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Message

Re: Flash Versus RAM

2005-11-14 by Karl Olsen

--- In lpc2000@yahoogroups.com, "mhaines4102" <mhaines4102@y...> 
wrote:
>
> On the 2138, there is 512K of flash and 32K of RAM. Can anyone tell 
> me what goes in flash vs. RAM (i.e. globals, stacks, heap, executing
> code.) I have lots of assumptions, but would like a clear answer.

When using gcc, you can define this in the linker script and startup 
files.  The normal setup is:

Const variables (global and static) go into flash.

Uninitialized global and static variables go into RAM (zeroed by the 
startup code).

Initialized global and static variables go into RAM, but their 
initialization values are in flash, so they take up space both places.

Heap goes into RAM.

Stack goes into RAM.

Code goes into flash.

Sometimes you want some functions in RAM.  Those functions count as 
initialized global/static variables.

You can always look at the linker map file if in doubt.  (Actually, 
you should look at it even if you aren't in doubt.)

Karl Olsen

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.