Linker memory mappint

Go To Last Post
2 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

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:

-Wl,--section-start=.mysection=0x5000

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!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It's a bug that was introduced about a year ago. The temporary solution is to put all the components for a particular named section into a single compilation unit.