MCAL Sample Application Compile Error - Where is S32K144 defined?

cancel
Showing results for 
Search instead for 
Did you mean: 

MCAL Sample Application Compile Error - Where is S32K144 defined?

Jump to solution
264 Views
talha_uyar
Contributor III

I am working on the MCAL sample application on EB tresos and S32 Design Studio. I am using GCC compiler and changed the launch.bat file accordingly. I am calling launch.bat with TOOLCHAIN=gcc DERIV=118 PLATFORM=S32K1X parameters. 

Ok, consider the following code provided in sys_init.c under src/startup except for the first line "#define  S32K144". This block is clearly selecting for the correct configuration depending on your part S32K114, S32K118 etc.

#define  S32K144
#ifdef S32K118
    #include "s32k118.h"
#endif
#ifdef S32K142
 #include "s32k142.h"
#endif
#ifdef S32K144
 #include "s32k144.h"
#endif
#ifdef S32K146
 #include "s32k146.h"
#endif
#ifdef S32K148
 #include "s32k148.h"
#endif

My issue is that there is something weird going on during compilation. If I do not write the first line, #define S32K144 I get many errors stating that a lot of stuff could not be resolved. After a bit of investigating I realize these are defined under these header files ("s32k144.h" etc.) Hence, I thought that I should define a Macro for the part I am using so that the compiler includes one of the header files in this block and added "#define S32K144" line. However, this time it gives a warning saying that this is a re-definition of the Macro, which I haven't defined anywhere else. 

Getting curious I changed the line from "#define S32K144" to "#define S32K118" and this time I got a lot of errors stating that there are conflicting types for many Macros.

I think this is happening because the S32K144 Macro is defined somewhere else, and I cannot find where. Where is S32K144 Macro defined? And more importantly, how can I change the part used by the sample application from S32K144 to S32K118?

All answers are appreciated.

M. Talha Uyar

0 Kudos
1 Solution
155 Views
namnguyenviet
NXP Employee
NXP Employee

Hi talha.uyar@karel.com.tr‌,

You don't need to add a #define in the sample application. Your command is correct if you want to switch to S32K118. However, please be noted that sometimes the Windows cmd might have troubles while catching the input parameters (You can see in the first line of console log to check your current setup derivative, it looks like: Running for S32K144 derivative, on S32K1x platform). In that case, you can workaround by manually set in launch.bat. For example: SET DERIV=118

Best Regards,

Nam

View solution in original post

0 Kudos
3 Replies
156 Views
namnguyenviet
NXP Employee
NXP Employee

Hi talha.uyar@karel.com.tr‌,

You don't need to add a #define in the sample application. Your command is correct if you want to switch to S32K118. However, please be noted that sometimes the Windows cmd might have troubles while catching the input parameters (You can see in the first line of console log to check your current setup derivative, it looks like: Running for S32K144 derivative, on S32K1x platform). In that case, you can workaround by manually set in launch.bat. For example: SET DERIV=118

Best Regards,

Nam

View solution in original post

0 Kudos
155 Views
talha_uyar
Contributor III

Ok, I checked the console output and in fact it was building for S32K144 even though I called the launch.bat with DERIV=118. So I modified launch.bat and added the command SET DERIV=118. Now I get an error saying:

"make: *** No rule to make target '118'." Am I doing something wrong?

Edit: After reading the console I realized it says "C:/NXP/S32DS_ARM_v2.2/S32DS/build_tools/msys32/usr/bin/make.exe -f makefile TOOLCHAIN=gcc  118" which I believe is incorrect. So I changed the line in launch.bat from  "SET DERIV=118 to SET DERIV=DERIV=118" This is obviously not perfect but it did the trick. Now i can see the console says "C:/NXP/S32DS_ARM_v2.2/S32DS/build_tools/msys32/usr/bin/make.exe -f makefile TOOLCHAIN=gcc  DERIV=118"

After fixing another error saying that "s32k118.h" cannot be found by moving s32k118.h from /include/startup/S32K118 to /include/startup so that the compiler can find it, I have successfully built for s32k118.

Thanks for your help,

M. Talha Uyar

0 Kudos
155 Views
namnguyenviet
NXP Employee
NXP Employee

You're welcome. As I have checked, seems like it's an issue when the application try to re-branch to another TOOLCHAIN. Glad to here that you can build the application :smileyhappy:

Best Regards,

Nam

0 Kudos