S32 compile problem with DIAB for MPC5746B

cancel
Showing results for 
Search instead for 
Did you mean: 

S32 compile problem with DIAB for MPC5746B

164 Views
Ehsaaan
Contributor III

Hello
Dear Sir/Madam

I imported MPC574xB-C-G sample application already downloaded from "NXP.com/Autosar",  into S32 design studio for PowerPC. I did set the TOOLCHAIN parameter equal to "diab" in the makefile, and launch.bat in build command. Then I clean and build the project. It did generate the elf file successfully without errors. But then I did an integer to float array casting like this:
usnigned short array_i[2] = {0};
float array_f[2] = {0};

.........      array_f[0] = (float) array_i[2];

Seems its okay in C language syntax and rules, but it generates warning and errors here. for more information I attached some files from errors. 
By the way i did this in online C compilers and it didn't produce any errors. I guess the problem goes back to diab compiler. And its good to know that I use Diab Compiler Version 5.9.6.2 Evaluation. 

Regards,
Ehsan

0 Kudos
3 Replies

98 Views
jiri_kral
NXP Employee
NXP Employee

Hi Ehsan,

 

Beside the linker issue -  your array of unsigned short can hold two short values (array is size of two). With index 2 ( array_i[2]; ) you are outside of allocated memory. 

 

Jiri

 

 

 

 

 

0 Kudos

144 Views
stanish
NXP Employee
NXP Employee

Hi Ehsan,

This error is rather related to the linker not the compiler. I suspect there is a standard C library missing to be linker with your project. The standard C fucntion such as casting uint to float ("utof") cannot be found.

I'd check if a standard library is available in diab toolchain and try to include it into the project.

Hope it helps.

Stan

0 Kudos

140 Views
Ehsaaan
Contributor III

@stanish 
Hello
Thanks for your reply.
It's Very strange to me. I am waiting for your response.

Regards,
Ehsan

0 Kudos