EmbDev.net

Forum: ARM programming with GCC/GNU tools How to link non-contiguous memory?

Author: Joe Dupre (jdupre)
Posted on: 2009-05-28 19:10

The LPC2xxx chips have multiple areas of non-contiguous RAM defined in
the memory map.  For example, some chips may have 32K of internal RAM at
0x40000000, 8K of USB RAM at 0x7fd00000, 16K of Ethernet RAM at
0x7fe00000, and then possibly external RAM starting at 0xA0000000.

I understand how to define the different memory sections in the linker
script and then use the "__attribute__ ((section ("section_name")))" tag
to assign a variable or functuion to utilize that section of memory.

However, is it possible to "link" the non-contiguous memory areas for
the compiler to utilize at will?  In other words, I'd like the compiler
to just treat the several non-contiguous areas as one big chunk of RAM
and use it as it needs it, without me having to specifically assign code
and variables to different sections.

Is this possible?  How?
Author: Marcus Harnisch (Company: Doulos) (mharnisch)
Posted on: 2009-05-29 10:20

Joe Dupre wrote:
> However, is it possible to "link" the non-contiguous memory areas for
> the compiler to utilize at will?  In other words, I'd like the compiler
> to just treat the several non-contiguous areas as one big chunk of RAM
> and use it as it needs it, without me having to specifically assign code
> and variables to different sections.
>
> Is this possible?  How?

Given a proper linker script, the linker will automatically allocate
code and variables in all specified locations.

However, if by saying "one big chunk of RAM", you mean that e.g. an
array may span two or more physically non-contiguous regions then that
does not work unless you have a MMU (which none of the LCP2xxx do).

Regards
Marcus
http://www.doulos.com/arm/

Reply

Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [avrasm]AVR assembler code[/avrasm]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]





Note: the original post is older than 6 Months.

webmaster@embdev.netContactAdvertising on EmbDev.net