AnsweredAssumed Answered

HC12: How do I compile relocatable functions?

Question asked by Dan White on Nov 6, 2006
Latest reply on Nov 7, 2006 by CompilerGuru
I am writing in Codewarrior v4.5 C for HCS12X cpu.
 
I am trying to make a few relocatable functions that I can copy to RAM and execute there. I have no problem with the copy and execute. The problem is that the compiler has used some JMP and JSR opcodes that make it non-relocatable. These are short jumps to the end of the function and for optimization of repetitive code but they are jumping to flash and not the RAM copy. How can I disable this and force the compiler to use relative branches (long or short as needed) instead of absolute jumps when I compile these functions?
 
...oh and NO I can NOT build the code to reside in RAM because the RAM location of the buffer may change in future versions so it MUST use relative branches.
 
I really don't want to have to re-write all of this in asm just to get it to run.

Message Edited by CrasyCat on 2007-04-13 01:21 PM

Message Edited by CrasyCat on 2007-04-13 01:21 PM

Outcomes