How can I build simulink generated code?

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I build simulink generated code?

817 Views
Contributor III

I'm using simulink for model based design, downloaded and licensed NXP MBDT. After generated code, I import file from Open Project from File System and select generated file from Matlab simulink. After I see that file on project explorer, I can not build, even can not click on hammer. How can I build it ? By the way I used gpio example model design. 

24 Replies

209 Views
Contributor I

Hello Constantin Razvan Chivu,

I've also met a problem as I want to build my generated code in S32DS.

I'm using 

S32DS_PA_2.1

Matlab R2020a ver9.8

Model-Based Design Toolbox for MPC57xx Series ver3.2.0

 

I can build my Simulink model and generate code successfully, also I can generate the .elf file and flash it to my MPC5744P. It works well. But today I want to modify the generated code and found that I just cannot build the generated code by importing projectinfo.xml, the build hammer is gray.

And I have checked the properties of the project and found that the builders are missed. Could you please offer any suggestions? Thank you very much!

Best Regards,

Xiao ZHOU

 
0 Kudos

239 Views
NXP Employee
NXP Employee

Hello utkuckmgl@gmail.com ,

Do you have any spaces in the path towards your toolbox or the generated folder? That might cause an issue with S32 Design Studio ProjectInfo.xml importer.

Kind regards,

Razvan.

0 Kudos

226 Views
Contributor II

Hello constantinrazvan.chivu‌,

I met the similar problem when I build the project for MPC5744P.

I'm using:

S32DS_PA_2.1

Matlab R2020a ver9.8

Model-Based Design Toolbox for MPC57xx Series ver3.2.0

Here are the output of Console:

pastedImage_2.png

10:25:45 **** Build of configuration build for project uart_hello_world_mpc574xP_mbd_rtw ****
make -j4 all
Building file: ../core0_intc_sw_handlers.S
Building file: ../edma_driver.c
Building file: ../edma_hw_access.c
Building file: ../clock_MPC57xx.c
Invoking: Standard S32DS Assembler
Invoking: Standard S32DS C Compiler
powerpc-eabivle-gcc "@core0_intc_sw_handlers.args" -o "core0_intc_sw_handlers.o" "../core0_intc_sw_handlers.S" "../core0_intc_sw_handlers.S" "../interrupt_vectors.S" "../startup_MPC5744P.S"
Invoking: Standard S32DS C Compiler
powerpc-eabivle-gcc "@clock_MPC57xx.args" -MMD -MP -MF"edma_hw_access.d" -MT"edma_hw_access.o" -o "edma_hw_access.o" "../edma_hw_access.c"
powerpc-eabivle-gcc "@clock_MPC57xx.args" -MMD -MP -MF"clock_MPC57xx.d" -MT"clock_MPC57xx.o" -o "clock_MPC57xx.o" "../clock_MPC57xx.c"
Invoking: Standard S32DS C Compiler
powerpc-eabivle-gcc "@clock_MPC57xx.args" -MMD -MP -MF"edma_driver.d" -MT"edma_driver.o" -o "edma_driver.o" "../edma_driver.c"
powerpc-eabivle-gcc.exe: fatal error: cannot specify -o with -c, -S or -E with multiple files
compilation terminated.
make: *** [subdir.mk:104: core0_intc_sw_handlers.o] Error 1
make: *** Waiting for unfinished jobs....
Finished building: ../edma_hw_access.c
Finished building: ../edma_driver.c


Finished building: ../clock_MPC57xx.c

And my configuration fo properties:
pastedImage_1.png

Could you give me some help please

225 Views
NXP Employee
NXP Employee

Hello 641679783@qq.com,

This is a known issue from the S32DS. In order to successfully build the generated code from the S32DS, you have to rename the extensions for all the .S files in the generated folder to .s. Please do so and then import the project again in the S32DS using the .XML.

Hope this helps,

Marius

0 Kudos

225 Views
Contributor II

mariuslucianandrei

Thanks 

I find my problem in configuration. I can build and debug the project now.

225 Views
NXP Employee
NXP Employee

Hello 641679783@qq.com‌,

I am glad that you've solved your issue!

Marius

0 Kudos

239 Views
Contributor III

Hello Constantin Razvan Chivu,

Thank you for your interest, I don't have any problem with importing but checked about any spaces after your opinion, no problem with that. Actually I'm not sure if I generated code correctly but I didnt have any error when I generated

0 Kudos

239 Views
NXP Employee
NXP Employee

Hello utkuckmgl@gmail.com,

Can you give me the following details:

- what toolbox are you using (e.g. MBDT for S32K1xx version 4.1.0)

- what MATLAB version are you using (e.g. R2020a)

- the output of the following command (ran in MATLAB terminal):

ver

[note: do not post the header in which you'll find infromation like MATLAB license number; just what is below, probably starting with MATLAB version x].

Kind regards,

Razvan.

0 Kudos

239 Views
Contributor III

Hello Constantin Razvan Chivu,

I am using,

MBDT for S32K1xx version 4.1.0 toolbox,

MATLAB 2019a version 9.6

I can not post all version informations, have an error like it was banned content.

If you infrom me versions of which tools I can write directly

0 Kudos

239 Views
NXP Employee
NXP Employee

Hello utkuckmgl@gmail.com ,

I'm interested in all other toolboxes from NXP you have installed (e.g. MBDT for MPC57xx toolbox or other versions of MBDT for S32K1xx).

Kind regards,

Razvan.

0 Kudos

239 Views
Contributor III

Hello Constantin Razvan Chivu,

I installed only Model-Based Design Toolbox for S32K1xx Series Version 4.1.0 (R2017b-R2019a). I didn't install any other toolbox from NXP.

0 Kudos

239 Views
NXP Employee
NXP Employee

Hello utkuckmgl@gmail.com ,

Ok, thank you for the information. Now regarding the building / importing -- can you go through the steps you took? For the building process, you just have to hit the build button (or CTRL + B). I have to mention the fact that if you want to take the code generated and import it into S32 Design Studio, you have to have an option set in the main configuration block (where you select the MCU for which the application is built, among other things). Here, in the Build toolchain tab you'll find 'Generate S32 Design Studio ProjectInfo.xml file' -- make sure this is enabled (checked).

After the build is done, a file with the name ProjectInfo.xml should be generated. You can go into S32Design Studio -> Import -> S32Design Studio -> ProjectInfo.xml Importer

pastedImage_2.png

From there you just browse and select your ProjectInfo.xml file. Let me know if it works after you do all these steps I described.

Kind regards,

Razvan.

P.S.: you can find an introductory video about MBDT here Get to Know the User-Friendly NXP MBDT for Application Development in MATLAB/Simulink | NXP . I thought this might be helpful. It is part of a 4-video mini-series. You can find the other 3 linked on the same page. The other topics are SPI communication, CAN communication and PWM.

0 Kudos

239 Views
Contributor III

Hello Constantin Razvan Chivu,

I'm very grateful, it worked fine. Now I can build project, but still have some errors when I builded it. I directly generate and build as you said, didn't do anything with code but I have errors as;
make: *** [subdir.mk:64: clock_S32K1xx.o] Error 1 gpio_s32k148_mbd_rtw C/C++ Problem
make: *** [subdir.mk:64: gpio_s32k148.o] Error 1 gpio_s32k148_mbd_rtw C/C++ Problem
make: *** [subdir.mk:64: lpit_driver.o] Error 1 gpio_s32k148_mbd_rtw C/C++ Problem
make: *** [subdir.mk:65: gpio_irq.o] Error 1 gpio_s32k148_mbd_rtw C/C++ Problem
make: *** [subdir.mk:65: interrupt_manager.o] Error 1 gpio_s32k148_mbd_rtw C/C++ Problem
make: *** [subdir.mk:66: mbd_main.o] Error 1 gpio_s32k148_mbd_rtw C/C++ Problem
make: *** [subdir.mk:66: pins_driver.o] Error 1 gpio_s32k148_mbd_rtw C/C++ Problem
make: *** Waiting for unfinished jobs.... gpio_s32k148_mbd_rtw C/C++ Problem

Can you help me for this too? Thank you

 

0 Kudos

239 Views
NXP Employee
NXP Employee

Hello utkuckmgl@gmail.com ,

Can you give me the output from the Console? This looks to me like the output from the Problems tab. You can find them at the bottom of S32 Design Studio : 

pastedImage_2.png

Kind regards,

Razvan.

0 Kudos

239 Views
Contributor III

Hello Constantin Razvan Chivu,

Console.PNG

This is how console tab looks, if it is not clear;

10:55:58 **** Build of configuration build for project gpio_0 ****
make -j8 all
Building file: ../clock_S32K1xx.c
Building file: ../gpio_irq.c
Building file: ../gpio_s32k148.c
Building file: ../interrupt_manager.c
Invoking: Standard S32DS C Compiler
Invoking: Standard S32DS C Compiler
Invoking: Standard S32DS C Compiler
Building file: ../lpit_driver.c
arm-none-eabi-gcc "@clock_S32K1xx.args" -MMD -MP -MF"clock_S32K1xx.d" -MT"clock_S32K1xx.o" -o "clock_S32K1xx.o" "../clock_S32K1xx.c"
arm-none-eabi-gcc "@clock_S32K1xx.args" -MMD -MP -MF"gpio_irq.d" -MT"gpio_irq.o" -o "gpio_irq.o" "../gpio_irq.c"
Invoking: Standard S32DS C Compiler
arm-none-eabi-gcc "@clock_S32K1xx.args" -MMD -MP -MF"gpio_s32k148.d" -MT"gpio_s32k148.o" -o "gpio_s32k148.o" "../gpio_s32k148.c"
arm-none-eabi-gcc "@clock_S32K1xx.args" -MMD -MP -MF"interrupt_manager.d" -MT"interrupt_manager.o" -o "interrupt_manager.o" "../interrupt_manager.c"
arm-none-eabi-gcc.exe: error: nosys.specs: No such file or directory
Invoking: Standard S32DS C Compiler
arm-none-eabi-gcc.exe: error: nosys.specs: No such file or directory
arm-none-eabi-gcc "@clock_S32K1xx.args" -MMD -MP -MF"lpit_driver.d" -MT"lpit_driver.o" -o "lpit_driver.o" "../lpit_driver.c"
make: *** [subdir.mk:64: clock_S32K1xx.o] Error 1
Building file: ../mbd_main.c
make: *** Waiting for unfinished jobs....
Building file: ../pins_driver.c
arm-none-eabi-gcc.exe: error: nosys.specs: No such file or directory
make: *** [subdir.mk:64: gpio_irq.o] Error 1
make: *** [subdir.mk:64: gpio_s32k148.o] Error 1
arm-none-eabi-gcc.exe: error: nosys.specs: No such file or directory
Invoking: Standard S32DS C Compiler
arm-none-eabi-gcc.exe: error: nosys.specs: No such file or directory
make: *** [subdir.mk:65: interrupt_manager.o] Error 1
arm-none-eabi-gcc "@clock_S32K1xx.args" -MMD -MP -MF"mbd_main.d" -MT"mbd_main.o" -o "mbd_main.o" "../mbd_main.c"
make: *** [subdir.mk:66: lpit_driver.o] Error 1
Invoking: Standard S32DS C Compiler
arm-none-eabi-gcc "@clock_S32K1xx.args" -MMD -MP -MF"pins_driver.d" -MT"pins_driver.o" -o "pins_driver.o" "../pins_driver.c"
arm-none-eabi-gcc.exe: error: nosys.specs: No such file or directory
arm-none-eabi-gcc.exe: error: nosys.specs: No such file or directory
make: *** [subdir.mk:66: mbd_main.o] Error 1
make: *** [subdir.mk:66: pins_driver.o] Error 1

10:55:58 Build Finished (took 327ms)

0 Kudos

239 Views
NXP Employee
NXP Employee

Hello utkuckmgl@gmail.com ,

This is a bit strange - could you right click on the project -> Properties then go to C/C++ Build -> Settings -> Target Processor -- from there can you make sure that Libraries support is set to newlib no I/O (-specs=nosys.specs) like in the image below?

pastedImage_1.png

Kind regards,

Razvan.

0 Kudos

239 Views
Contributor III

Hello Constantin Razvan Chivu,

Yes it is set. But sysroot is different, I'm not sure if it changes anything to cause errors.

LibrarySupport.PNG

0 Kudos

239 Views
NXP Employee
NXP Employee

Hello utkuckmgl@gmail.com ,

Can you change the sysroot to

"[your_toolbox_root_directory]\tools\gcc-6.3-arm32-eabi/arm-none-eabi/newlib"

and try again?

Kind regards,

Razvan.

0 Kudos

239 Views
Contributor III

Hello Constantin Razvan Chivu,

I changed it like this;Changed1.PNG

And now errors has gone but I have just 2 more left :smileysad: 

Changed2.PNGChanged3.PNG

0 Kudos

239 Views
NXP Employee
NXP Employee

Hello utkuckmgl@gmail.com ,

Can you check to see if you have a correct path in Settings -> Standard S32DS C Linker -> Libraries, under library search path? You should see {TOOLBOX_ROOT}/mbdtbx_s32k14x/AMMCLIB_s32k14x/lib/gcc, like in the image below:

pastedImage_3.png

Kind regards,

Razvan.

0 Kudos