I am working on an embedded project and have to put a complete section of our code in a specific memory region. We are using avr-gcc. The normal way to go is to tell GCC to put the function in a section with:
__attribute__((__section__(".text_sdram"))) void foo(void);
However, this would cost us a lot of effort plus the chance to "forget" one function. We are using C++ and all the function that have to be in .text_sdram is put in a specific namespace. Is it possible to put a complete namespace in a specific section?
Thanks in advance for your answers.
Pieter
According to function attributes the visibility attribute can be attached to a namespace, but it doesn't look like anything else can. You could try attaching the section attribute to your namespace using the same syntax as described for visibility. I don't expect it to work, and if it doesn't I'm fairly sure there's not a good answer. If your namespace is all defined in a single module, or can be rearranged that way, you can probably solve this with a linker script.