S32K144 PIL application build error with s-function builder

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

S32K144 PIL application build error with s-function builder

Jump to solution
5,601 Views
ericrost
Contributor II

I have custom code integrated into an s-function builder block that builds and links correctly for both normal simulation and for a S32K144 target application with the MBD Toolset. However, when building the block using a model reference for PIL simulation I encounter a makefile rule error in the build process.

I can successfully build and link an application for PIL simulation that does not contain any s-function blocks, and I can successfully build and link (as the attached model c_function_example_sfun_build.slx demonstrates) an application directly targeted to the S32K144 that contains the same s-function builder block.

I've recreated the error with one of Mathworks' example c code s-function builder blocks (attached below), and I've worked with Mathworks' technical support. Their conclusion is that it seems to be a bug in the MBD Toolbox and not in the underlying Mathworks tools.

c_function_example_sfun_build.slx is directly targeted at the S32K144 and builds and links properly, c_function_example_sfun_build_PIL.slx will reproduce the error, in this example:

"gmake: *** No rule to make target `euler2dc_wrapper.o', needed by `c_function_example_PIL_rtwlib.lib'. Stop."

Using the PIL simulation capability would be incredibly valuable to develop and debug the s-function wrapped custom code I am trying to integrate into my project and this is a blocker.

Prompt support is both needed and appreciated.

Thanks,
Eric Rost

 

0 Kudos
Reply
1 Solution
5,371 Views
paulvlase
NXP Employee
NXP Employee

Hi @ericrost ,

You should receive an e-mail with a link from where to download a cumulative patch NXP_MBDToolbox_S32K1xx_4.2.1_patch_20220725.zip that includes the fix for your issue and many more.

 

To apply the patch follow these steps:

  1. Restart Matlab.
  2. Install the NXP Model-Based Design Toolbox for S32K version 4.2.0 toolbox if it is not already installed.
  3. Unzip the attached NXP_MBDToolbox_S32K1xx_4.2.1_patch_20220725.zip file.
  4. Run NXP_MBDToolbox_S32K1xx_patch.m file in Matlab

View solution in original post

0 Kudos
Reply
18 Replies
5,483 Views
paulvlase
NXP Employee
NXP Employee

Hi @ericrost ,

 

I removed the files/paths from Model Settings -> Code Generation -> Custom code as I don't have the libECAS_IO_LIBRARY.a library and couldn't build your model. After that I could build c_function_example_sfun_build.slx.

But I am a bit confused on how you run the PIL simulation for c_function_example_sfun_build_PIL.slx model. Can you tell us how you run the PIL simulation?

 

Regards,

Paul

0 Kudos
Reply
5,473 Views
ericrost
Contributor II

Here is the cleaned up model with PIL selected in c_function_example_PIL.slx that still exhibits the same behavior. Please build the sfunction builder block in c_function_example_sfun_build.slx, then you can see that the application builds and attempts to download. Then attempt to build c_function_example_PIL.slx, and you'll see exactly the same build failure, which needs to be resolved.

0 Kudos
Reply
5,457 Views
paulvlase
NXP Employee
NXP Employee

Hi @ericrost ,

I ran the PIL simulation in c_function_example_sfun_build_PIL.slx and even though it found the euler2dc_wrapper.o file I still got an error:

paulvlase_0-1658400974475.png

It looks like on your side it fails when it tries to build c_function_example_PIL_rtwlib.lib and can't find euler2dc_wrapper.c to build euler2dc_wrapper.o.

Can you send a zip archive with the generated folder slprj to take a look over it?

I tried with a clean install of the S32K toolbox version 4.2.0. Which patches did you apply?

 

Regards,

Paul

0 Kudos
Reply
5,450 Views
paulvlase
NXP Employee
NXP Employee

Ignore my last message. It could build euler2dc_wrapper.o on my side because there was a file with the same name in my Matlab installation folder. After I renamed that file I got the same error as you.

0 Kudos
Reply
5,400 Views
ericrost
Contributor II

@paulvlase, are you all set to diagnose the regression and deliver a solution?

0 Kudos
Reply
5,372 Views
paulvlase
NXP Employee
NXP Employee

Hi @ericrost ,

You should receive an e-mail with a link from where to download a cumulative patch NXP_MBDToolbox_S32K1xx_4.2.1_patch_20220725.zip that includes the fix for your issue and many more.

 

To apply the patch follow these steps:

  1. Restart Matlab.
  2. Install the NXP Model-Based Design Toolbox for S32K version 4.2.0 toolbox if it is not already installed.
  3. Unzip the attached NXP_MBDToolbox_S32K1xx_4.2.1_patch_20220725.zip file.
  4. Run NXP_MBDToolbox_S32K1xx_patch.m file in Matlab
0 Kudos
Reply
5,362 Views
ericrost
Contributor II

@paulvlase, this does resolve my build error, however you should be aware that this patch breaks your consistency checks by hardcoding an incorrect platform, as indicated in this error (which does not stop the build process):

"Failure in mbd_s32k_consistency_checks(line 0) : Undefined function 'mbd_s32k_ssd1306_block_check' for input arguments of type 'char'."

0 Kudos
Reply
5,352 Views
paulvlase
NXP Employee
NXP Employee

Hi @ericrost ,

Can you run mbd_s32k_path() in Matlab command window and try to build your model again?

 

Regards,

Paul

0 Kudos
Reply
5,340 Views
ericrost
Contributor II

@paulvlase 

>> mbd_s32k_path()
Treating 'C:\Users\Eric.Rost\AppData\Roaming\MathWorks\MATLAB Add-Ons\Toolboxes\NXP_MBDToolbox_S32K1xx' as MBD Toolbox installation root.
MBD Toolbox path prepended.
Successful.

Thanks,
Eric

0 Kudos
Reply
5,317 Views
paulvlase
NXP Employee
NXP Employee

Hi @ericrost ,

And does it work after you ran mbd_s32k_path()?

 

Regards,

Paul

0 Kudos
Reply
5,305 Views
ericrost
Contributor II

@paulvlase, the consistency check error is resolved now too. That wasn't preventing the PIL simulation from running, but its good to have the nuisance error gone.

Thanks for the quicker turnaround to deliver this fix. My desired PIL simulation that I can't share on a public forum is also working, I was engaged working on that code.

5,434 Views
ericrost
Contributor II

@paulvlase , I take from this you don't need any info from me to reproduce or identify the regression to deliver a bugfix?

Thanks,
Eric

0 Kudos
Reply
5,407 Views
ericrost
Contributor II

The model is setup exactly as described in this video:

https://community.nxp.com/t5/NXP-Model-Based-Design-Tools/Motor-Control-Class-Processor-in-the-Loop-...

The example I sent does not have PIL selected in the Model Reference block parameters, however this does not resolve the error, the build process for the model reference code generation target [model_reference]_rtwlib.lib is still the blocker.

I'm uploading a cleaned copy of the files that doesn't have references to our custom code still in the models for your reference.

0 Kudos
Reply
5,477 Views
ericrost
Contributor II

@paulvlase, That is the entire problem, I cannot build this for a PIL simulation. 

It is set up with a model reference to c_function_example_PIL.slx running in PIL, so there is a target configuration block to connect to COM7 UART and run that code on the S32K144, using the inputs provided by c_function_example_sfun_build_PIL.slx. However, when attempting to build and deploy for PIL simulation, the build errors occur.

This follows the exact model structure your PIL examples use.

0 Kudos
Reply
5,516 Views
ericrost
Contributor II

@mariuslucianand Can you support this, please?

0 Kudos
Reply
5,600 Views
ericrost
Contributor II

The hotfix for the MBD Toolbox has already been applied.

0 Kudos
Reply
5,600 Views
ericrost
Contributor II

>> ver
-----------------------------------------------------------------------------------------------------
MATLAB Version: 9.8.0.1721703 (R2020a) Update 7
MATLAB License Number: xxxxxx
Operating System: Microsoft Windows 10 Enterprise Version 10.0 (Build 19043)
Java Version: Java 1.8.0_202-b08 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
-----------------------------------------------------------------------------------------------------
MATLAB Version 9.8 (R2020a)
Simulink Version 10.1 (R2020a)
AUTOSAR Blockset Version 2.2 (R2020a)
Embedded Coder Version 7.4 (R2020a)
Fixed-Point Designer Version 7.0 (R2020a)
HDL Coder Version 3.16 (R2020a)
HDL Verifier Version 6.1 (R2020a)
MATLAB Coder Version 5.0 (R2020a)
MATLAB Report Generator Version 5.8 (R2020a)
Model-Based Design Toolbox for S32K1xx Series Version 4.2.0 (R2016a-R2020a)
Simscape Version 4.8 (R2020a)
Simscape Electrical Version 7.3 (R2020a)
Simulink Check Version 4.5 (R2020a)
Simulink Coder Version 9.3 (R2020a)
Simulink Coverage Version 5.0 (R2020a)
Simulink Design Verifier Version 4.3 (R2020a)
Simulink Requirements Version 1.5 (R2020a)
Stateflow Version 10.2 (R2020a)
Vehicle Network Toolbox Version 4.4 (R2020a)

0 Kudos
Reply
5,600 Views
ericrost
Contributor II

Another interesting detail: after the error, euler2dc_wrapper.o is actually present in the [model]_mbd_rtw directory, as expected, even though it indicates it cannot build it for the [model_reference]_rtwlib.lib.

ericrost_0-1657653198658.png

 

0 Kudos
Reply