Invalid Simulink object name: rtwshared

I'm trying to build a model for deployment to an Android device using the Simulink Support Package for Android Devices. I built and deployed one of the referenced models successfully as a test, however when trying to build the top model I get the following error:
Invalid Simulink object name: rtwshared
Caused by:
No block diagram 'rtwshared' is loaded.
My understanding is that rtwshared is generated as part of the build process and is stored in the _sharedutils folder. However, checking that folder shows that it does not exist, and I am unsure why it has not been created and what I can do to resolve this issue.
Many thanks for any help and further troubleshooting steps!

3 Comments

I am also getting the same error while building the model using MPLAB suuport package for simulink.
=== Build (Elapsed: 30 sec) ===
Microchip Model Check before compilation
No compiler found in C:\PROGRA~1\MICROC~1\xc16\v1.50\bin
Compiler found in: C:/PROGRA~2/MICROC~1/xc16/v1.35/bin
Warning:Parameter precision loss occurred for 'Gain' of 'test_2/Subsystem/Gain'. The parameter's value cannot be represented exactly using the run-time data type. A small quantization error has occurred. To disable this warning or error, in the Configuration Parameters > Diagnostics > Data Validity pane, set the 'Detect precision loss' option in the Parameters group to 'none'.
Warning:Parameter precision loss occurred for 'Gain' of 'test_2/Subsystem/Gain1'. The parameter's value cannot be represented exactly using the run-time data type. A small quantization error has occurred. To disable this warning or error, in the Configuration Parameters > Diagnostics > Data Validity pane, set the 'Detect precision loss' option in the Parameters group to 'none'.
### Generating code and artifacts to 'Model specific' folder structure
### Generating code into build folder: G:\SBT\SOC\LCO\test_2.X
Warning:Parameter precision loss occurred for 'Gain' of 'test_2/Subsystem/Gain'. The parameter's value cannot be represented exactly using the run-time data type. A small quantization error has occurred. To disable this warning or error, in the Configuration Parameters > Diagnostics > Data Validity pane, set the 'Detect precision loss' option in the Parameters group to 'none'.
Warning:Parameter precision loss occurred for 'Gain' of 'test_2/Subsystem/Gain1'. The parameter's value cannot be represented exactly using the run-time data type. A small quantization error has occurred. To disable this warning or error, in the Configuration Parameters > Diagnostics > Data Validity pane, set the 'Detect precision loss' option in the Parameters group to 'none'.
### Invoking Target Language Compiler on test_2.rtw
### Using System Target File: C:\Users\LIPO\AppData\Roaming\MathWorks\MATLAB Add-Ons\Toolboxes\MPLAB Device Blocks for Simulink\blocks\MCHP_dsPIC_stf.tlc
### Loading TLC function libraries
### Generating TLC interface API for custom data
### Initial pass through model to cache user defined code
### Caching model source code
### Writing main
### Writing MCHP_modelInclude.h
--- Multi Tasking implementation (Treat each discrete rate as separate task)---
.
### Writing header file test_2_types.h
.
### Writing source file test_2.c
### Writing header file test_2_private.h
### Writing header file test_2.h
### Writing source file G:\SBT\SOC\LCO\slprj\MCHP_dsPIC_stf\_sharedutils\look1_binlg.c
### Writing header file G:\SBT\SOC\LCO\slprj\MCHP_dsPIC_stf\_sharedutils\look1_binlg.h
.
### Writing header file rtwtypes.h
### Writing header file rt_nonfinite.h
### Writing source file rt_nonfinite.c
### Writing header file rtGetInf.h
### Writing source file rtGetInf.c
.
### Writing header file rtGetNaN.h
### Writing source file rtGetNaN.c
### Writing header file rtmodel.h
### Writing source file test_2_main.c
### TLC code generation complete.
### Generating TLC interface API.
.....### Creating HTML report file test_2_codegen_rpt.html
Problem while Creating MPLAB project. MPLAB Project skipped.
.
### Processing Template Makefile: C:\Users\LIPO\AppData\Roaming\MathWorks\MATLAB Add-Ons\Toolboxes\MPLAB Device Blocks for Simulink\mchp\MCHP_dsPIC.tmf
Warning:Found legacy make variables |>START_MDLREFINC_EXPAND_INCLUDES<|, |>END_MDLREFINC_EXPAND_INCLUDES<|, |>MODELREF_INC_PATH<| in the template makefile C:\Users\LIPO\AppData\Roaming\MathWorks\MATLAB Add-Ons\Toolboxes\MPLAB Device Blocks for Simulink\mchp\MCHP_dsPIC.tmf. The variables are no longer required. You can remove the variables.
Warning:Found legacy make variables |>S_FUNCTIONS<|, |>S_FUNCTIONS_OBJ<| in the template makefile C:\Users\LIPO\AppData\Roaming\MathWorks\MATLAB Add-Ons\Toolboxes\MPLAB Device Blocks for Simulink\mchp\MCHP_dsPIC.tmf. The variables are no longer required. You can remove the variables.
### Build procedure for model: 'test_2' aborted due to an error.
Cannot propose to program chip from Matlab: Either file test_2.hex does not exist or MPLAB X API is not available on this system.
* Visit the Microchip Blockset Forum for any questions, issues, share tricks.
* Visit the Microchip Wiki for further informations and examples.
-----------------------------------------------------------------------------------------
* MPLAB X project: test_2.X then select the project folder
-----------------------------------------------------------------------------------------
***** Error detected. Links above are provided for debug purpose only (.elf file might not be current).
Error:Invalid Simulink object name: rtwshared
Caused by:
No block diagram 'rtwshared' is loaded.
please help us out.
Hello Edward, Have you got the answer?
Hello,
Sorry for the delay - I contacted MATLAB Support, and they said it is due to a current bug when building a top model containing model reference blocks. My issue was resolved by copying the referenced models into sub-system blocks.
Hopefully this resolves your problem also. I realise that this is only a workaround, apparently MathWorks are working on releasing a fix in a future update.

Sign in to comment.

Answers (0)

Products

Release

R2019b

Asked:

on 6 Feb 2020

Commented:

on 24 Feb 2020

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!