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
#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.
#3: Open S32DS for PA and select Import/S32 Design Studio/ProjectInfo.xml Importer
#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
#5: Click on Finish button to have the project imported into the S32 Design Studio workspace.
#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.
#7: Build the project
Expected result: The executable file should be produced without any errors. In case of errors - please recheck #6.
Hello.
I try to rename all .S to .s
it already works like following:
thank you very much.
best regards
hao
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.
Hello,
sorry to replying lately
My S32 Design Studio version is 2.1.
best regards
hao
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!
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.
Hope this helps!
Daniel
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,
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:
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.
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!
can you have a look
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'
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
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.
Once you remove and rebuild the project it should work fine
Hope this helps!
Daniel
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.
Have you seen that kind of behavior ?
Thank you!
Daniel
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
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
Hi mikedoidge and dumitru-daniel.popa
Can there be a solution?
We are in need of this way to build a motor control solution。
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
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
Step4. DEVKIT – MPC5744P “LED Green ON” Motor Power ON
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
Step4. DEVKIT – MPC5744P “LED Green OFF” Motor Power ON
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?