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

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

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

Jump to solution
3,727 Views
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.

Labels (1)
Tags (1)
0 Kudos
1 Solution
1,961 Views
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!

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

View solution in original post

4 Replies
1,962 Views
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!

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

1,961 Views
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 Kudos
1,961 Views
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.

1,961 Views
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 Kudos