Compiling Position Independent Code - what have I missed out?

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Compiling Position Independent Code - what have I missed out?

跳至解决方案
1,418 次查看
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 解答
845 次查看
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 回复
846 次查看
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 项奖励
回复