AnsweredAssumed Answered

Compiling Position Independent Code - what have I missed out?

Question asked by Steve Lewis on Feb 3, 2010
Latest reply on Feb 3, 2010 by CompilerGuru

Hi

I am working with Code Warrior for HCS12 version 5 Build 9061 

 

I am working on a project for the MC9S12DG128, but have transferred a lot of code form a project on the MC9S12A256.

 

This includes a couple of routines that are compiled as Position Independent Code (so they can be copied into RAM and run from there)

 

The function starts with the pragma declaration

#pragma CODE_SEG __PIC_SEG BOOT_CODE

 

This works fine in the first project. When I disassemble the code, the assembler uses position independent calls e.g. JSR   BT_FlashFunc,PCR

 

But in the new project, despite having the same routines with the same pragma, when I check the disassembled code it is not using position independent calls. e.g.  JSR   BT_FlashFunc

 

Is there some option I should set in the compiler settings which ensures that it will respect the pragma?

 

Many thanks

Steve 

Outcomes