Memory Management when Porting code from Host to Target
Pieter Arnout
pieter@powerescape.com
Thu Mar 3 20:34:00 GMT 2005
I'm new to embedded programming. I've gone through the archives a bit
to find answers to the questions I have, but either I'm not doing a
good job of reading them or the answers just aren't present. I'm aiming
to port a C algorithm to a target machine, but I'm stuck. Specifically
I'm trying to dynamically allocate data structures and uniquely map
these data structures to different memory regions.
As an example of something I'm trying to accomplish, suppose I have a
target machine with a scratch pad, a DRAM, and a Flash Memory. I would
like to dynamically allocate a memory space for data structure A in the
scratch pad. Similarly then, I wish to allocate memory for data
structure B in the DRAM, and then again dynamically allocate data
structure C to Flash Memory. How do I accomplish this?
Again, my experience with memory management has only ever been for use
on desktop machines. If I understand correctly, the linker script is
where you specify the different available memory regions. This then
makes the program aware of the hardware available, but how then do I
make sure data structures are allocated in specific memories? I imagine
that globals and automatic variables can be assigned in the linker
script, right? Should I also use the linker script to state which
dynamically allocated data structures should belong to which region?
Any help would be greatly appreciated!
Thanks,
Pieter Arnout
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/enriched
Size: 1440 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-help/attachments/20050303/e382f924/attachment.bin>
More information about the Gcc-help
mailing list