I am trying to map certain functions to a defined area of memory using GCC attritubes and linker options. For example, I define a function like:
void foo() __attribute__ ((section ".mysection")));
And add the following to [Linker Options] in AVR Studio's custom compilation options:
I was recently adding some new features and took the opportunity to reorganize my code into a few separate source files for clarity's sake but when I go to build the project the linker apparently creates several ".mysections" such as ".mysection.1" and ".mysection.2" in addition to the original ".mysection." These new .1 and .2 sections seem to completely ignore my option to place them at a defined address and so they end up overlapping with other program sections and causing errors.
I can get away without using sections for the time being, but I'm curious as to what is going on here and what I am missing. I searched the forums and GCC sites for some info but I must be using the wrong keywords because I haven't seen anything related to this issue. I'd like to avoid defining a new section for each new source file, but if that's the only way to do it then I can deal with it.
Thanks to anyone who can offer some insight!