This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Memory Management when Porting code from Host to Target


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]