I'm modifying an existing .ld
and I have two flash sections for the code. These two flash sections are not contiguous so I cannot merely extend the definition of one of the sections to include the other.
Currently all of the code can fit in sec1
but if I turn off space optimizations, it doesn't fit.
QUESTION
How do I write the .ld
to say place as much of the code as will fit in sec1
and then as much as will fit in sec2
and then ... sec3
... etc?
I know how to place specific .obj
in specific section but that's not what I want because I'll need to constantly modify the .ld
as my code changes.
sec1
, you might be able to put the.text
insec1
and things like.rodata
,.init_array
, etc. insec2
. That way you won't need to keep changing the script as your code changes. Just an idea. – Philipld
. These can generate synthetic files to be included from the main linker script. So, an external script looking at the '.o' with objdump/readelf can construct 'sec1.ld', 'sed2.ld', to be included in the main link file. I doubt there is a canonical answer given all the choices. – Twotimec
files intoo
files and then determining which object file goes where by calculating an "optiomal" placement. Do you think that would be feasible? Are there any tools that provide such computation? – Rothmuller#define FEAT_XX __attribute__((section(".ConfigDancingPixie")))
. You can useNOCROSSREFS_TO()
to enforce calls between features. I did this to map out initialization code from memory space after boot. If you have a lot of 'extra' room in the combined section, I think this method can work well. If you are trying to be 100% generic, then the 'make' and scripting will work. – Twotime