How can I get the linker to locate a specific function to a specific address?
1. You could write it in assembler using an ABSolute area and a .org address.
2. You could put the function in a separate source file and compile it with a named code segment (--codeseg MYCODE or #pragma codeseg MYCODE) and tell the linker where to put that segment with -Wl,bMYCODE=0xaaaa.
3. You could use a trampoline/jumptable written in assembler and put that at the specific address.
But the real question is: WHY do you want to put a function at a specific address? Do you want to share it between different programs? If so, have you thought about the variables (RAM) it uses?
Log in to post a comment.
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.