Yahoo Groups archive

Lpc2000

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

Message

Re: [lpc2000] Flash variables

2005-04-22 by Anton Erasmus

On 22 Apr 2005 at 8:52, Richard Duits wrote:

> 
> Anything you define as const is allocated in the flash (at least gcc
> does this, have no experience with other compilers yet). Because the
> arm has only one address space, all memory (flash and ram) is the
> same, except you cannot write to the flash directly. The only reason
> you may want to copy to ram is because ram is faster than flash is
> some cases.

In which version of arm-gcc does const put the variable in the text section. I have
checked with arm-elf-gcc v3.4.3, and the variable is not put into the .test section
when const is used. One must explicitly use a __attribute__((section (".text"))).

const int gConstVar=5;   /* Put in .rodata section */
const int gConstVar1 __attribute__((section (".text")))=6; /* Put in .text section */

The .rodata section is in flash, and then copied to RAM in the startup code. So if
the intention of using varaibles in flash is to save memory ( Which is usually the case), 
then just declaring the variables const does not suffice.

Regards
  Anton Erasmus





> Richard.
> 
> 
> Jaromir wrote:
> 
> > Hello,
> >
> > how can i keep long strings(or fonts,bitmaps) only in flash memory,
> > and later read. I use gcc - is something like read_flash_byte()
> > function? or can i use memcpy ?
> >
> > Jaromir
> > _________________________________________________________________
> > List sprawdzony skanerem poczty mks_vir ( http://www.mks.com.pl )
> >
> >
> > [Non-text portions of this message have been removed]
> >
> >
> > --------------------------------------------------------------------
> > ---- *Yahoo! Groups Links*
> >
> >     * To visit your group on the web, go to:
> >       http://groups.yahoo.com/group/lpc2000/
> >        
> >     * To unsubscribe from this group, send an email to:
> >       lpc2000-unsubscribe@yahoogroups.com
> >       <mailto:lpc2000-unsubscribe@yahoogroups.com?subject=Unsubscrib
> >       e>
> >        
> >     * Your use of Yahoo! Groups is subject to the Yahoo! Terms of
> >       Service <http://docs.yahoo.com/info/terms/>.
> >
> >
> 
> 
> 
> 
> Yahoo! Groups Links
> 
> 
> 
> 
> 
> 
> 

-- 
A J Erasmus

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.