ADC_read model error with S32DS 1.2

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

ADC_read model error with S32DS 1.2

2,323 Views
ernestoinoa
Contributor II

201756_201756.pngpastedImage_1.png

 

I am going over the excellent videos about Motor Control MBD with the MPC5744. Nevertheless, when I try to build the example shown in the screenshot above I get the following error:

 

            adc_pnt_library.c:293:5: error: expected expression before '/' token 
            // while(ADC[adc_num]->MSR.B.NSTART == 0){} 
            ^

            gmake: *** [adc_pnt_library.obj] Error 1

 

Although in the Target Compiler Opts of the Configuration block (please refer to screenshot) the system is calling out the C99 ISO standard, the gcc compiler is complaining about the double forward slash being used for comments.  

I am using S32DS 1.2 instead of S32DS 1.1. 


I am attaching the full log of the Code Generation from the Diagnostic Viewer of the model I am trying to build.

 

 Any ideas will be highly appreciated.

 

Regards,

 

Ernesto.

Original Attachment has been moved to: ADC_read_20171018_005115.txt.zip

Labels (2)
0 Kudos
6 Replies

1,637 Views
mariuslucianand
NXP Employee
NXP Employee

Hello ernestoinoa‌,

The reason for your gmake error is that you are using the -ansi flag instead of -std=c99.

However from your log we observed that you have a lot of warnings and you are using a toolchain different that we do. In order to help you solving this, please send us an archive containing the model and the ADC_read_mbd_rtw generated folder.

Best Regards,

Marius

1,637 Views
ernestoinoa
Contributor II

Marius, 
Thanks a lot for your reply. 
In order to get C99 generated code I have to select this option for the standard math library, as shown below:

pastedImage_1.png

Nevertheless, when I do this the number of errors increases quite a bit. I am attaching the full log of the Code Generation from the Diagnostic Viewer of the model I am trying to build when C99 is selected for the standard math library, the model, and the mbd_rtw generated folder.

Your help will be highly appreciated.

 

Regards,

 

Ernesto.

0 Kudos

1,637 Views
mariuslucianand
NXP Employee
NXP Employee

Hello ernestoinoa,

We have successfully compiled your model using our setup. The generated makefile
from your archive looks completely different than ours(I have attatched our output folder), so I believe there is something broken trough your settings.
What I suggest is to set to default your Matlab path from "HOME -> Set Path -> Default" and then reinstall the toolbox as in this video  but download the toolbox from here.

Please be sure that you have the correct path as in video.

Regards,

Marius

0 Kudos

1,636 Views
ernestoinoa
Contributor II

Marius,

Thanks a lot for your helpful comments. It turns out that I had the MinGW GCC compiler that comes with Matlab. So, during code generation the Simulink Model was somehow using this compiler instead of the S32DS compiler. After uninstalling the MinGW GCC compiler I was able to build the model and download it to the target (MPC5744P DevKit)

Now I am facing another problem, though. 

When I try to read the potentiometer from the MPC5744P DevKit I get the following error:
pastedImage_1.png

To troubleshoot this issue I loaded the generated elf file with S32DS in Debug Mode, and looks like the program running in the target goes wrong after the System Timer Module gets enabled (instruction STM_0.CR.B.TEN = 1; in the generated C code). I am attaching a Microsoft Word file with screenshots of S32DS at every debugging step. I am also attaching my compilation result, in case it might help.

I would really appreciate your help debugging this issue.

Regards,

Ernesto.

1,636 Views
dumitru-daniel_
NXP Employee
NXP Employee

Hi ernestoinoa‌,

S32 Design Studio 1.2 was released after we have release the toolbox 2.0.0 for MPC5744P. In the V1.2 of S32 DS the linker files were changed. Please apply this patch to make it work: https://community.nxp.com/thread/451804#comment-916493 

Hope it helps!

Daniel

1,636 Views
ernestoinoa
Contributor II

Hello Dumitru,

Thanks a lot for your suggestion... it worked like a charm!

Regards,

Ernesto.

0 Kudos