Can I compile an assembly file(.s file) with .c files in codewarrior10.6?

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

Can I compile an assembly file(.s file) with .c files in codewarrior10.6?

跳至解决方案
4,383 次查看
weiranhe
Contributor II

Hi! I'm using CW10.6 for MPC5646B, now I need to add an assembly file(.s file) to my project, can I compile it with other .c files? I try it, but it makes a lot of errors.

Can anybody help me? There is an function in the assembly file, I need to call it in another .c file.

标签 (1)
标记 (1)
0 项奖励
回复
1 解答
2,617 次查看
TICS_Fiona
NXP Employee
NXP Employee

Sorry for the waiting.

The reported errors are due to project is created for VLE instructions and assembly file (.s) added has a BOOKE instructions.

By adding the option -ppc_asm_to_vle in (Project Properties->C/C++ Build->Settings->Tools Seetings -> PowerPC Assembler -> General -> Other Flags), the below reported error should be resolved. (convert UISA/BOOKE  instructions to VLE)


Best Regards

Fiona

-----------------------------------------------------------------------------------------------------------------------

Note: If this post answers your question, please click the Correct Answer button. Thank you!

-----------------------------------------------------------------------------------------------------------------------

在原帖中查看解决方案

4 回复数
2,618 次查看
TICS_Fiona
NXP Employee
NXP Employee

Sorry for the waiting.

The reported errors are due to project is created for VLE instructions and assembly file (.s) added has a BOOKE instructions.

By adding the option -ppc_asm_to_vle in (Project Properties->C/C++ Build->Settings->Tools Seetings -> PowerPC Assembler -> General -> Other Flags), the below reported error should be resolved. (convert UISA/BOOKE  instructions to VLE)


Best Regards

Fiona

-----------------------------------------------------------------------------------------------------------------------

Note: If this post answers your question, please click the Correct Answer button. Thank you!

-----------------------------------------------------------------------------------------------------------------------

2,617 次查看
weiranhe
Contributor II

I have tried the advice you have given, and the errors disappeared.Thank you!

By the way, I have payed attention to your personal home page.


0 项奖励
回复
2,617 次查看
TICS_Fiona
NXP Employee
NXP Employee

I tried with CodeWarrior v10.6, and also have problem with the assembly file compiling. I have contacted compiler team for the solution.

Now, you can use embedded assembly code in C file to work it around, just like below:

__declspec(section ".init") __asm void cfg_WATCHDOG(void);

__asm void cfg_WATCHDOG(void)

{

               nofralloc

               /* Clear the soft lock bit SWT_CR.SLKSWT_CR: */

               /* SR --> 0x0000c520 */

lis r4, 0

ori r4, r4, SR_WSC_1@l

lis r3, SWT_SR@ha

stw r4, SWT_SR@l(r3)

/* SR --> 0x0000d928 */

lis r4, 0

ori r4, r4, SR_WSC_2@l

stw r4, SWT_SR@l(r3)

/* Disable watchdog, SWT.CR.WEN = 0*/

lis r4, CR_VALUE@h

ori r4, r4, CR_VALUE@l

lis r3, SWT_CR@ha

stw r4, SWT_CR@l(r3)

       blr

}

I will get back to this issue as soon as I have the solution for assembly files compiling in CW10.6.

2,617 次查看
bibinputhiyath
Contributor II

In KDS2.0 how can i compile .S file with .c file. I couldn't find 'PowerPC Assembler' in Project Properties->C/C++ Build->Settings->Tools Seetings -> PowerPC Assembler

Thanks!

0 项奖励
回复