Hello. Is there any way to simplify the call tree manipulation in linker..? (Scripting kind of) My code has number of function calls through pointers. The functions are divided in few main groups. I want to achieve overlay among the functions of an individual group.(Intragroup) At the same time I want to avoid overlaying among the functions from different groups.(Intergroup) Adding and removing the references for every function from every other function is big task. I somehow managed it at the moment. However it is not good practice from the long term perspective.
So, can I define a list of functions which can be used at multiple places in linker script. Or can I share a macro from compiler to the linker..?
Best regards, Vivek.
The piece of code which is plug able, has to be linked first. But that is not the real problem. Actually, it is, because it means your entire plan is based on an incorrect assumption: that repeatedly linking the primary code with different "plug-in" functions will leave the rest of the code unmodified. Well, with this linker (or more generally: on this CPU architecture), it won't.
Which brings up the next question: given you're already suffering the pain of code banking, what on earth is keeping you from linking all those plug-ins into a single fat binary, so you can do away with that silly, doomed-to-fail plug-in mechanism? Ah... let me guess: not only has your program outgrown the code address space of an 8051, it's outgrown even the limits of 8051-with-maxed-out-code-banking, has it?
And, just to go back to your earlier protestations: no, you do not need function pointers for that setup.
Exactly Hans, The code has outgrown even the limits of banking. Or I would say the limits of flash to be precise. The hardware here is a single chip with limited xram and xflash. So upgrading it further is not in my control unless there is any such an option from the vendor. Hence single fat binary is not possible.
About the rest of the code being changed. No. Its not happening. I guess until my plugins are at assembly level. So, there are no common code findings for the linker to do any further optimization and reshuffle.
The code banking is not a pain. Why would it be anyway. Without it, probably I wouldn't have reached this far. What do you think..?
Vivek.
Another point. It could be question, why do I need to worry about overlay for an assembly routine. No. I am not. But there are some other ways it is ensured that the core of the binary does not change. Couple of them are to place a function at a fixed location while linking, Or a function too simple but lengthy enough... Meanwhile the script seems to be working for me at the moment.
I will still consider avoiding fp where ever possible. At least it will reduce number of manipulations needed.