Compiling Position Independent Code - what have I missed out?

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Compiling Position Independent Code - what have I missed out?

ソリューションへジャンプ
1,425件の閲覧回数
Stephen
Contributor III

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 

ラベル(1)
タグ(1)
0 件の賞賛
返信
1 解決策
852件の閲覧回数
CompilerGuru
NXP Employee
NXP Employee

There is no option I'm aware of.

 

Are the two call locations also the same? For PIC, both the function being called and the call location have to be PIC, so check that in the new project the function containing the JSR and BT_FlashFunc are defined & declared in a section with the __PIC_SEG quali. Check the preprocessor listing.

 

Daniel

元の投稿で解決策を見る

0 件の賞賛
返信
1 返信
853件の閲覧回数
CompilerGuru
NXP Employee
NXP Employee

There is no option I'm aware of.

 

Are the two call locations also the same? For PIC, both the function being called and the call location have to be PIC, so check that in the new project the function containing the JSR and BT_FlashFunc are defined & declared in a section with the __PIC_SEG quali. Check the preprocessor listing.

 

Daniel

0 件の賞賛
返信