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

cancel
Showing results for 
Search instead for 
Did you mean: 

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

4,616 Views
dumitru-daniel_
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

41 Replies

228 Views
vietmai
Contributor I

Hi @dumitru-daniel_ @constantinrazva 

My S32 is not able to build after importing xml project file generated by Simulink.

vietmai_0-1613701266071.png 

vietmai_0-1613701412673.png

 

Below are details what i did, 

i checked the installation path of NXP MBD, whether it has "space" in the directory of not : 

C:\Users\vietmq\AppData\Roaming\MathWorks\MATLAB Add-Ons\Toolboxes\NXP_MBDToolbox_S32K1xx         ==> Should be OK, no space.

Open MBD GPIO example for S32K144, and configure for exporting xml project file: 

vietmai_1-1613702006437.png

Generate the code, no error, see log file : gpio_s32k144_build_20210219_103350.txt (attached in the post)

Open S32SD and import xml file : 

vietmai_2-1613702311093.png

i ticked on the first option, can not build, then i tried second option but can not build too. 

Please help !!!

 

thanks.

0 Kudos

937 Views
lijiantaowy
Contributor III

Hello daniel

When I export Generated Code( MBDT for MPC5744P v3.2) to S32 Design Studio for Power Architecture Version 2017.R1, I can't build the project! The details are as follows.

pastedImage_6.png>pastedImage_7.png>pastedImage_9.png>pastedImage_10.png>pastedImage_11.png>build>pastedImage_12.pngpastedImage_13.png>importpastedImage_14.png>pastedImage_15.png>pastedImage_16.pngpastedImage_17.png

pastedImage_19.png

0 Kudos

937 Views
constantinrazva
NXP Employee
NXP Employee

Hello lijiantaowy@163.com,

S32Design Studio has some hick-ups when it comes to paths with spaces -- and when you are trying to import the project generated by our toolbox, you'll be generating ProjectInfo.xml file which is then used as input for S32Design Studio importer. This XML file will contain a path to your toolbox, so it will contain spaces, and S32DS crashes somewhere. 

To fix this, you should install your toolbox in a path with no spaces - this is a general recommendation for everything (I guess).

Please let us know if you have any issues with it after installing it into a new path with no spaces.

Kind regards,

Razvan.

937 Views
lijiantaowy
Contributor III

Hello!

Thank you, reinstall the toolbox in the path without spaces according to your promptthe problem is solved,. It turns out that there is a matlab add-on in the default path with spaces. However, the 3.0 version I installed before, there is no problem to install in that path.

Also I would like to ask, after installing version 3.2, compiling programs in matlab becomes very slow, the same program is significantly faster in version 3.0, can I change the settings to speed up compilation?

pastedImage_5.png

There is another problem. When I use the motor program in the toolbox, I need to add two paths each time I import it into S32. Is there any setting that can permanently solve this problem?

use thispastedImage_11.png> need to add paths>pastedImage_8.pngpastedImage_9.png>build successful

Best regards,

Jiantao

 

0 Kudos

937 Views
constantinrazva
NXP Employee
NXP Employee

Hello lijiantaowy@163.com,

I'm glad everything worked out with the importer -- as for the default toolbox path, it depends on what MATLAB/Simulink version you are running - they will be slightly different (+ some will generate an extra folder named code, others will not).

Now for the compile time -- did you test the 2 versions of the toolbox on the same Simulink version? If you did, could you send us the model that you are running? It goes without saying that the build depends on the complexity of the model itself -- so it would be best if we could run some tests on the model you have here (the one which takes you 3m+ to build).

Kind regards,

Razvan.

0 Kudos

937 Views
lijiantaowy
Contributor III

Hello!

The test file is below

Best regards,

Jiantao

0 Kudos

937 Views
lijiantaowy
Contributor III

Hello!

MBD3.2 pastedImage_2.png

MBD3.0pastedImage_1.png

Detailed test information

NotebookCPU i7-9750H RAM 16G

Best regards

Jiantao

0 Kudos

937 Views
haoxue1027
Contributor IV

Hi 

I try to build the project, but there is three errors like following,

I used the latest version of MBD and S32.

pastedImage_1.pngpastedImage_2.png

I also try to delete the following including paths 

 pastedImage_4.png

but still have errors 

pastedImage_5.png

pastedImage_6.png

the  defualt optio" for E20072"of  target processor   is the same errors.

May I have your help.

best regards

hao

0 Kudos

937 Views
constantinrazva
NXP Employee
NXP Employee

Hello haoxue1027@qq.com,

Unfortunately that is an issue with S32 Design Studio (latest version). It will be fixed in the next update I think.

You can try a workaround for the moment, or with the S32 Design Studio version 2017.R1 (older version).

For the workaround, you should rename all .S files to .s files (so they don't use capital letter S)

e.g.:

core0_intc_sw_handlers.S - to core0_intc_sw_handlers.s
interrupt_vectors.S - to interrupt_vectors.s
startup_MPC5744P.S - to startup_MPC5744P.s

If this alone does not work, you should also rename the files in ProjectInfo.xml (generated by our toolbox).

If you try the workaround please let us know if you are facing issues.

If you just try the older version (2017.R1), it should work without any errors.

Kind regards,

Razvan.

0 Kudos

937 Views
haoxue1027
Contributor IV

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

937 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

937 Views
haoxue1027
Contributor IV

Hello,

sorry to replying lately

My S32 Design Studio version is 2.1.

best regards

hao

0 Kudos

937 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

937 Views
dumitru-daniel_
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

937 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

937 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.

937 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!

937 Views
dumitru-daniel_
NXP Employee
NXP Employee

constantinrazvan.chivu,

can you have a look 

958 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

958 Views
dumitru-daniel_
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