error: expected '(' before 'void'   __asm void Cpu_SetBASEPRI(uint32_t Level) {

cancel
Showing results for 
Search instead for 
Did you mean: 

error: expected '(' before 'void'   __asm void Cpu_SetBASEPRI(uint32_t Level) {

2,264 Views
Contributor I

Dear All,

 

I was trying to migrate a project a from Code warrior to Kinetis Design Studio Version: 3.0.0.

 

I followed the steps in CW MCU 10.6 Processor Expert projects migration into KDS 3.0.0  -(followed  Steps of the conversion by manual configuration of the toolchain).

 

But after all the steps when i tried to build i am getting following error in

 

../Generated_Code/Cpu.c: At top level:

../Generated_Code/Cpu.c:2053:7: error: expected '(' before 'void'

__asm void Cpu_SetBASEPRI(uint32_t Level) {

       ^

make: *** [Generated_Code/Cpu.o] Error 1

 

Can some one help me to find why this error is happening ?

 

Thanks

Abhilash V R

Labels (1)
8 Replies

47 Views
Contributor IV

Hi,

similar issue here with Migration #CCW->S32 project for #MPC5643L. I read AN5282 too (#Migration guide), but no luck so far.

 davidchung‌ maybe any ideas?

Kind regards

pastedImage_1.jpg

0 Kudos

47 Views
NXP Employee
NXP Employee

Hi Ludwig,

I have two suggestions regarding your screenshot:

1) S32DS recognizes "__asm__", not "__asm"

2) You can't use "__asm__" on an entire function.  In my experience you have to use "void INIT_Derivative(void){" and then encapsulate each assembly instruction with "__asm__", such as "__asm__(xor r0, r0, r0);"  Also, make sure that you are using VLE syntax instead of another assembly language like BookE.  The assembly in your screenshot looks more like BookE; VLE looks something like "e_ori 0,0,0".  Another suggestion is to move the assembly function to an assembly (.S) file then, in the C file, do a function call to that assembly function.

I hope this helps.

-David

47 Views
Contributor IV

Hi !!

Thanks for your fast reply David, totally agree with 1) and 2)

I set S32DS for VLE.

Have you seen this error before, any ideas what could be done?

I noticed code actually compiles fine without MPC5643L_HWInit.c/.h and debug...how?

Regards

pastedImage_1.jpg

0 Kudos

47 Views
NXP Employee
NXP Employee

Hi Ludwig,

Sorry for the late reply.  I didn't receive a notification so I was not aware you replied to my reply.  Anyway, I'm not too familiar with VLE, so I can't say much on __declspec, but otherwise there doesn't seem to be an error in the error lines themselves.  The "Problems" window does not always point to the root actual error.  Sometimes the compiler detects an error at another line of code that somehow references lines 41, 44, 47.  You can check this in the Console window.  Scan the log for any lines highlighted red.  Those are where the errors pop up and the text around the error can give you a clue as to what line is actually causing the error.  As for it compiling without MPC5643L_HWInit.c, that's because the file is specific to CodeWarrior.  S32DS does not use that file.  All those initializations are now handled in Project_Settings>Startup_Code>startup.S.  Hope that helps.

-David

47 Views
NXP Employee
NXP Employee

Hi Abhilash,

I think you need to check/adopt the compiler settings so it recognizes __asm. Have you set the compiler options to use C99?

pastedImage_1.png

Search for "__asm" in this document:

KDS Frequently Asked Questions (FAQ)

I hope this helps,

Erich

0 Kudos

47 Views
Contributor I

Erich, I tried this but didnt work :smileysad:

0 Kudos

47 Views
NXP Employee
NXP Employee

Hi,

I've performed some tests on my side with an older version of KDS.

Don't know if this can help but you can have a look to the following doc:

    Importing MCU V10.6 projects (sample, using PE and MQX) under KDS

Regards

Have a great day,
Pascal
NXP Technical Support

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

0 Kudos

47 Views
Senior Contributor I

I don't think that syntax is correct, I think what you want is:

void Cpu_SetBASEPRI(uint32_t Level)

{

      __asm ("<insert asm instructions here>")

}

Have not had trouble using __asm() in KDS 3.0

0 Kudos