How to export Generated Code to S32 Design Studio IDE (applicable for MBDT for MPC5744P v2.0)

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

How to export Generated Code to S32 Design Studio IDE (applicable for MBDT for MPC5744P v2.0)

26,204 Views
Daniel_Popa
NXP Employee
NXP Employee

In case you need to export the generated code to S32 Design Studio for PA IDE, now there is an easy way. No more painful job of reconstruction the project manually and setting all sort of compiler flags. Here is what you need to do in just a few steps.

Prerequisite:

Toolbox for MPC5744P rev2.0: Model Based Design Toolbox For Panther (MPC574xP) Family of Processors 2.0 IS NOW AVAILABLE! 

HotFix_4 for MPC5744P rev2.0: https://community.nxp.com/thread/451804#comment-925214 

S32DS IDE v1.2 or newer:  S32 Design Studio for Power v1.2.

How to:

#1: make sure the HotFix_4 is installed successfully and the "Generated S32 Design Studio ProjectInfo.xml file" option is visible and selected

pastedImage_5.png

#2: build the Simulink model as normal (e.g. Motor Control System example from Motor Control Class: Lecture 12 - Motor Control System since it is the most complex application we built so far on this community) and wait until is completed successfully.

pastedImage_123.png

 

#3: Open S32DS for PA and select Import/S32 Design Studio/ProjectInfo.xml Importer

pastedImage_124.png

#4: Press Next and select the ProjectInfo.xml from the location used to generated the C-code for the Simulink model. Also, select the E200 Executable option

pastedImage_166.png

#5: Click on Finish button to have the project imported into the S32 Design Studio workspace.

pastedImage_168.png

#6: Applicable for S32DS v1.2 (due to a bug in IDE): Open the Project Properties and go to Settings/Target Processor and select "generate code for E200Z4" as Target Processor and re=select the option shown near the Libraries Support. These will force the IDE to update the toolchain properties correctly. These limitations will be addressed in the newer versions of S32DS for PA.  

pastedImage_169.png

#7: Build the project

pastedImage_175.png

Expected result: The executable file should be produced without any errors. In case of errors - please recheck #6.

pastedImage_178.png

52 Replies

15,054 Views
haoxue1027
Contributor V

Hello.

I try to rename all .S to .s

it already works like following:

pastedImage_1.png

thank you very much.

best regards

hao

0 Kudos
Reply

8,975 Views
constantinrazva
NXP Employee
NXP Employee

Hello haoxue1027@qq.com,

Glad to hear that! So just to confirm, after renaming the all .S files to *.s, the importer works in S32 Design Studio 2.1?

Kind regards,

Razvan.

0 Kudos
Reply

7,737 Views
haoxue1027
Contributor V

Hello,

sorry to replying lately

My S32 Design Studio version is 2.1.

best regards

hao

0 Kudos
Reply

7,706 Views
daovietanh
Contributor II

Hi Daniel,

I want to export generated code from matlab with S32K14x to S32 Desig Studio IDE or other like IAR...,

How can I do that?

Thanks you!

0 Kudos
Reply

7,700 Views
Daniel_Popa
NXP Employee
NXP Employee

Hi daovietanh‌,

For the S32K14x - we have the same procedure for exporting the project to S32 Design Studion as the one described in the beginning of this article.

  1. you select the "generate S32 Design Project ...
  2. you import the project in S32 DS using "Project XML" option

Hope this helps!

Daniel

0 Kudos
Reply

7,697 Views
daovietanh
Contributor II

Hi Daniel,

In the Configuration parameter of S32K, there is no option to choice "generate S32 Design Project" as you decribe. But in the 'Block Parameters : MDB_S32K14x_Config_Infomation' / 'Buid Toolchain' allows users to create file.xml but only with GCC Compiler.

I did this, but when i import project XML from S32DS, it buid errors. May be I configured it incorrectly. Can you describe more detail with S32K14x?

Thanks you,1.PNG2.PNG3.PNGerror.jpeg

0 Kudos
Reply

7,588 Views
constantinrazva
NXP Employee
NXP Employee

Hello daovietanh‌,

Sorry for the delayed answer - your problem is due to the fact that you have used other version of gcc between MATLAB and S32Design Studio (when you imported the project). When you select to import using ProjectInfo.xml, you have a selection to make:

pastedImage_2.png

Depending on what version of gcc you have used (4.9.x vs 6.3.x), you have to select the first one, or the 3rd one (both ARM32 Executable, the difference being the toolchain - ARM bare-metal vs standard S32DS). So please try to import it again, selecting the other one of the 2 shown in the picture above.

Please let us know if you're still having issues with this problem.

Kind regards,

Razvan.

7,543 Views
daovietanh
Contributor II

Hi Daniel,Razvan,

That great, I 've builded sucessful. It is due to different version of gcc between MATLAB and S32Design Studio and I chose the 3rd type (Standard S32DS toolchain for ARM). That is OK

Thanks you so much!

6,483 Views
Daniel_Popa
NXP Employee
NXP Employee

constantinrazvan.chivu,

can you have a look 

6,482 Views
c9356j
Contributor II

Hi Daniel,

Could you help me?

error

C:/NXP/S32DS_Power_v2017.R1/Cross_Tools/powerpc-eabivle-4_9/include/stdio.h unknown type name '__gnuc_va_list'

2019-05-09_111444.png2019-05-09_113034.png2019-05-09_113049.png2019-05-09_113106.png2019-05-09_112333.png

0 Kudos
Reply

6,065 Views
Daniel_Popa
NXP Employee
NXP Employee

Hi Jason Liu, 

I see you are using the latest MBDT for MPC57xx 3.0 which is good. The toolbox can export the generated C code so that it can be later on imported into S32 Design Studio.

Can you please try to import & build the project attached here? I would like to exclude a S32DS configuration issue.

Thank you!

Daniel

0 Kudos
Reply

5,263 Views
c9356j
Contributor II

Hi Daniel,

Thanks for your support.

"adc_mpc574xP_mbd_rtw  20190515 am1008" -- > This file is ok .

"ClosedLoop_Control " (Lecture12_MPC5744P_v3.0.0) --- > Fail

0 Kudos
Reply

4,650 Views
Daniel_Popa
NXP Employee
NXP Employee

Hi c9356j@gmail.com‌,

Seems to be and issue with compatibility between the S32Design Studio and the built tools provided with MBDT.

To fix it, just remove the include path highlighted below. This path is not absolutely necessary since the S32DS has it's own compiler, hence it will avoid any compatibility issues.

pastedImage_1.png

Once you remove and rebuild the project it should work fine

pastedImage_2.png

Hope this helps!

Daniel

0 Kudos
Reply

4,650 Views
c9356j
Contributor II

Hi Daniel,

Thanks for your support.

But ..

(1).S32DS Build --> RAppID  Fail

"ClosedLoop_Control_mbd_rtw.srec "--- > is not working properly

2019-05-15_162748.png

2019-05-15_172606.png

2019-05-15_171433.png

2019-05-15_171532.png

(2).Matlab --> S32DS --> RAppID   Pass

" ClosedLoop_Control.mot" -- > This file is ok .

2019-05-15_172355.png

2019-05-15_171043.png

2019-05-15_171026.png

0 Kudos
Reply

4,650 Views
Daniel_Popa
NXP Employee
NXP Employee

Hi c9356j@gmail.com‌,

I do not know exactly how the S32DS works (not under my expertise). I think when you build with S32DS you should download the image via the JTAG with the built in debugger rather than using the RAppID bootloader. Is it working if you try that way ?

If so, then there might be an inference between the compiler shipped with the S32DS and the one from MBDT.

mikedoidge

Have you seen that kind of behavior ?

Thank you!
Daniel

0 Kudos
Reply

4,650 Views
mikedoidge
NXP Employee
NXP Employee

Hello c9356j@gmail.com‌, dumitru-daniel.popa‌,

To be sure I understand correctly, the comparison is of the two scenarios:

1) Generate code and build model from MATLAB, then use RAppID Bootloader to flash over JTAG is WORKING.

2) Generate code and S32DS Project file from MATLAB, then use S32DS to builld and then use RAppID Bootloader to flash over JTAG is NOT WORKING.

Daniel, I echo your comments on using the flash tool within S32DS to program the code via either OpenSDA or JTAG. OpenSDA would be preferred since it is difficult to have the JTAG connected with the motor shield attached as well. However, I doubt this will produce the issue, the RAppID Boot Loader works well and is just an unnecessary extra tool for these scenarios.

I have not seen issues with this comparison since we worked out the bugs at the time this feature was added, however, we are introducing some opportunities for inconsistencies by generating the S32DS project file and then building from S32DS. It could be some of the settings produced when the S32DS project file is generated that cause the output to be different when the build is conducted within S32DS. It is possible these difference could be the result of updates to the S32DS for Power. Perhaps the compiler versions no longer match, introducing some difference. In general, I expect the resulting executable to work in either scenario.

If we can reproduce this issue locally, then it is something which should be resolved.

Best Regards,

Mike

0 Kudos
Reply

4,633 Views
c9356j
Contributor II

Hi Mike, dumitru-daniel.popa‌ 

Thanks for your support.

Yes, that's right.

1) Generate code and build model from MATLAB, then use RAppID Bootloader to flash over JTAG is WORKING.

-- >  (a).rar

         ClosedLoop_Control.mot" -- > This file is ok .

  

2) Generate code and S32DS Project file from MATLAB, then use S32DS to builld and then use RAppID Bootloader to flash over JTAG is NOT WORKING.

-- >  (b).rar

       "ClosedLoop_Control_mbd_rtw.srec "--- > is not working 

0 Kudos
Reply

4,620 Views
c9356j
Contributor II

Hi mikedoidge‌ and dumitru-daniel.popa

Can there be a solution?
We are in need of this way to build a motor control solution。

0 Kudos
Reply

4,620 Views
mikedoidge
NXP Employee
NXP Employee

Hello c9356j@gmail.com‌,

Perhaps I missed it somewhere in the thread history here. Could you please identify again where exactly the issue occurs? Is it failing to run the code on the hardware after RAppID Boot Loader completes? OR Is it running the code but the code isn't operating correctly? It is important to know this difference as it points to two separate causes.

Looking at the images you provided, it appears that RAppID Boot Loader is correctly loading the SREC file. It also appears that the application is executing because FreeMASTER is able to connect but fails to exchange any data with the application. Is my understanding correct?

Best Regards,

Mike

0 Kudos
Reply

4,620 Views
c9356j
Contributor II

Hi mikedoidge

1) Generate code and build model from MATLAB, then use RAppID Bootloader to flash over JTAG is WORKING.

-- >  (a).rar

         ClosedLoop_Control.mot" -- > This file is ok .

Step1. Matlab - - > Simulink , Generate code and build “Lecture12_MPC5744P_v3.0.0

Step2. RAppID BL Tools , Download Firmware “ClosedLoop_Control.mot

Step3. DEVKIT – MPC5744P “LED Red ON” Motor Power OFF

2019-05-27_180027.png

Step4. DEVKIT – MPC5744P “LED Green ON” Motor Power ON

2019-05-27_180335.png

2) Generate code and S32DS Project file from MATLAB, then use S32DS to builld and then use RAppID Bootloader to flash over JTAG is NOT WORKING.

-- >  (b).rar

       "ClosedLoop_Control_mbd_rtw.srec "--- > is not working 

Step1. Matlab - - > S32DS Open *.xml File, Generate code and build

Step2. RAppID BL Tools , Download Firmware “ClosedLoop_Control_mbd_rtw.srec

Step3. DEVKIT – MPC5744P “LED Red OFF” Motor Power OFF

2019-05-27_181824.png

Step4. DEVKIT – MPC5744P “LED Green OFF” Motor Power ON

2019-05-27_181838.png

0 Kudos
Reply

4,650 Views
1506840872
Contributor II

Hi Constantin.

A question: Can I use the S32ds 2017R1 to replace the S32ds V1.2?

Or, any differences between the two kind of the S32ds? Which one is better?

0 Kudos
Reply