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
已解决! 转到解答。
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:
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
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.
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:
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
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.
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:
@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'."
>> 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
@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.
The model is setup exactly as described in this video:
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.
@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.
>> 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)
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.