EmbDev.net

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


von Joe D. (jdupre)


Rate this post
useful
not useful
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?

von Marcus H. (mharnisch)


Rate this post
useful
not useful
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/

Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
No account? Register here.