Integrating ERIKA RTOS on SPC563 (e200Z3)- Compilation Error While When Converting Assembly (.S) to

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

Integrating ERIKA RTOS on SPC563 (e200Z3)- Compilation Error While When Converting Assembly (.S) to

371 Views
NagendraPothula
Contributor II

Hello All,,


I am currently using CodeWarrior 2.9 for the SPC563XX(Power Architecture e200Z3), which is equivalent to the MCP563xx microcontroller.

While attempting to integrate the ERIKA RTOS for the MCP56xx family, I am encountering the following Compilation  errors:

mwldeppc: undefined: 'EE_hal_terminate_savestk' 

mwldeppc: Referenced from 'EE_oo_thread_stub' in ee_tstub.o

Upon investigation, I found that the function EE_hal_terminate_savestk() is defined in an assembly (.S) file, which does not seem to be included in the compilation process.

My toolchain is able to compile .c files, so I attempted to work around the issue by renaming the .S file to a .c file and wrapping the assembly code inside a C-style function (e.g., asm void Fun(){}).

My original intention was to reuse the same assembly implementation, only adapting the function definition to match C syntax, so that I could avoid modifying the makefile. However, this approach is resulting in multiple compilation errors, which I find unexpected.

Below are some of the errors I am encountering:

illegal function definition 

undefined identifier 'rlwinm' 

undefined identifier 'addis' 

undefined identifier 'stw' 

undefined identifier 'stmw' 

undefined identifier 'mtlr' 

undefined identifier 'bl' 

undefined identifier 'lwz' 

undefined identifier 'addi' 

declaration syntax error 

';' expected

It appears that the CodeWarrior compiler is not recognizing several PowerPC assembly instructions within the C file.

Could you please help me understand:

  • Why these assembly instructions are not being recognized by the compiler?
  • Whether this approach (embedding assembly in a .c file) is valid for this toolchain?
  • How I can properly resolve these compilation errors?

Thank you for your support.

Best regards,
Nagendra Pothula

SW Architect

AVL ITC India

0 Kudos
Reply
3 Replies

220 Views
NagendraPothula
Contributor II

Hello team,
You are right. After posting my question, I realized that I had made a mistake by simply changing the file from *.s to *.c.

I then implemented the same functionality using inline assembly as shown below, and this resolved all compiler and linker errors:

void Func(void)
{
    asm
    {
       /* Assembly code here */
    }
}
 

0 Kudos
Reply

296 Views
NagendraPothula
Contributor II

Thanks for reply,
Could you please let me know where can i find the Start-Up code for NXP MPC5634M ???

0 Kudos
Reply

343 Views
davidtosenovjan
NXP TechSupport
NXP TechSupport

The compilation errors you are seeing are caused by the fact that PowerPC assembly code is being compiled as C code. By renaming the original .S file to .c and embedding the assembly inside a C function, the compiler attempts to interpret assembly instructions such as rlwinm, addis, stw, etc. as C syntax, which results in errors like “undefined identifier” and “illegal function definition.” This approach is not valid for CodeWarrior, as these instructions are only recognized when processed by the assembler.

The correct solution is to keep the original .S file and ensure it is properly included in the build system so that it is compiled by the assembler and linked with the rest of the project. Inline assembly in this form cannot replace a full assembly module used by the RTOS.

Please note that ERIKA Enterprise is a third-party open-source RTOS (OSEK/AUTOSAR-like) and is not an NXP product, so its integration and build configuration are outside of NXP’s scope and need to be handled on your side.

For reference, you may find the following documentation helpful:
Freescale PPC e200 (MPC56xx) support page: https://erika.tuxfamily.org/wiki/index.php?title=Freescale_PPC_e200_%28MPC_56xx%29

Thank you for your understanding.

0 Kudos
Reply