Include of stdlib.h causes fatal errors for CW10.2 MQX 3.8

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

Include of stdlib.h causes fatal errors for CW10.2 MQX 3.8

697 Views
Cdn_aye
Senior Contributor I

Hi

 

It was suggested under the CW10.2 forum that this might be an MQX error so I am reposting here.

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

 

I needed to use atoi in the code so added the usual #include <stdlib.h> in the code. Now I get these bizarre errors

 

Description Resource Path Location Type  identifier 'exit(int)' was originally declared as '__regabi int (int)' rap11_cw10.2_mqx3.7_51jm128  line 89, external location: C:\Freescale\Freescale MQX 3.8\lib\m51jmevb.cw10\usb\host\mqx_host.h C/C++ Problem identifier 'exit(int)' redeclared as '__regabi void (int)' rap11_cw10.2_mqx3.7_51jm128  line 157, external location: C:\Freescale\CW MCU v10.2\MCU\ColdFire_Support\ewl\EWL_C\include\cstdl​ib C/C++ Problem mingw32-make: *** [Sources/Tasks_c.obj] Error 1 rap11_cw10.2_mqx3.7_51jm128    C/C++ Problem

 

After searching through the net and everywhere Icould think, I noted that someone found that there is some pragma statement somewhere that changes the register used for return values in a function call. I have no idea where that is or how to change it.

 

Does anyone have a fix for this? This seems pretty basic functionality and we shouldn't have to go through this to compile normal code. This is an existing project that has been used for sometime but without the include.

Thanks in advance.

0 Kudos
2 Replies

301 Views
c0170
Senior Contributor III

Hello cdn_aye,

 

there are few problems with the C libraries which come with the IDE/compiler. You can find some threads here on the forum regarding this topic.

 

Can you include some more details about your application. I have tested some examples with including stdlib.h and none errors were popped up.

 

Regards,

MartinK

0 Kudos

301 Views
Cdn_aye
Senior Contributor I

Hi Kojto

 

The app uses mqx 3.8.0 on a mcf51jm128 with a USB flash drive. All I did was include the #include <stdlib.h> to access the atoi function and we got the errors I listed. I traced this through the assembler and it appears to me that the register that is returning the value from the function call is incorrect as far as the compiler is concerned. I saw the posts regarding an incorrect #pragma statement that affected the register assignment. But I did not see which #pragma was incorrect and also did not see how to change the pragma. These are generated by the IDE and I have no real control over them.

 

I can send you the code base if you want by a private email. We are one of FSL's alliance partners. I can't really post all the code here but I can include the code that is a problem. Here is the commented out code.

 

//rwl   #include <stdlib.h>     // july 04/2012, produces errors in register returns if enabled, hence the alternate                                 // string functions used for itoa, atoi; some pragma is wrong somewhere

 

//rwl           memset( ca_strng, ge_NULL, sizeof(ca_strng) );        // clear buffer, null terminate

//rwl           memcpy( ca_strng, (char *)&(gu_FileName.s_file_name.ca_file_number), sizeof(gu_FileName.s_file_name.ca_file_number) );

 //rwl           i_file_num = atoi_tl(ca_strng);

//rwl           i_file_num++;

//rwl           itoa(i_file_num, ca_strng, 10);

 

 

Thanks for looking into this for us.

0 Kudos