How to link non-contiguous memory?

OP #1279185
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?
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

A question of your own? This thread is over 17 years old. Ask it in a thread of its own – more people read along there, and it gets answered more often and sooner.

Start a new thread

A fix, an addition or feedback on this thread? Then reply here.

Formatting
  • [c]C-Code[/c]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]
  • [[Title]] – link to an article
  • Link to another post: right-click its post ID (#8078628), copy the address, paste it into the text

More about formatting

Post long source code as an attachment, not in the text.

Already registered? Log in

Not shown to anyone. We send you a link; your post appears once you confirm it there.

By submitting you create a free account and accept the terms of use.