Model Reference without adding "Target Configuration Block"

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

Model Reference without adding "Target Configuration Block"

Jump to solution
1,273 Views
cpatel
Contributor I

Hello NXP MBDT Team, 

I am using "NXP's Model-Based Design Toolbox for S32K1xx Toolbox" version 4.1.0 with MATLAB R2019a. 

In my project, I am using model references (model within a model) to manage complexity. While generating code, using one of the example file (flexcan_s32k11x) without any modification, code generation works fine. When I add model reference (Convert flexcan_s32k11x/Rx_Complete/Switch Case Action Subsystem ID 0x3FE/Chart in Model Reference), code generation gives following error:

Error: Index exceeds the number of array elements (0).

After adding "MBD_S32K11x_Config_Information" block to model reference, error goes away. That makes me believe that it is much to add "MBD_S32K11x_Config_Information" block to each model reference at top level. However, in documentation, it suggests otherwise (it seems that adding this block to model is optional) 

If set System Target File Manually, above error comes back. 

In documentation: 

Block Miscellaneous Details:

  • Required System Target File is set automatically by adding Target Configuration Block into the model. If no Target Configuration Block in the model then System Target File should be set manually.

Any suggestion or workaround on how to avoid adding "Target Configuration Block" to each model reference? Is it possible? 

-Chirag

Labels (1)
0 Kudos
Reply
1 Solution
1,128 Views
mariuslucianand
NXP Employee
NXP Employee

Hello cpatel@mathworks.com‌,

Thank you for reporting this behaviour. This might be caused by one of our callbacks. I have attached a file that must be replaced under {src\mbdtbx_s32k\mscripts\model}.

Please replace it and test the "Propagate Configuration" button.

Hope this helps,

Marius

View solution in original post

0 Kudos
Reply
3 Replies
1,128 Views
mariuslucianand
NXP Employee
NXP Employee

Hello cpatel@mathworks.com‌,

The Config block must be added in all the referenced models. Besides the .tlc file, there are other changes that the Config block performs on the model.

If you need to change something in the Config Block, just change in the main model and just press the "Propagate configuration" button. It will automatically apply the changes to all Config Blocks from the referenced models. 

pastedImage_1.png

Hope this helps,

Marius

0 Kudos
Reply
1,128 Views
cpatel
Contributor I

Hi mariuslucianandrei

Thank you for your reply. 

When I double click on "Propagate Configuration" as you mentioned above, it also changes some of the model configuration parameters. For example, it changes support for non-finite numbers and complex numbers, among other things. This is reproducible everytime. 

Is there a way to avoid this? 

Also, with Model References, it is recommended to use Configuration References. "Propagate Configuration" doesn't work in that case.  

pastedImage_1.png

0 Kudos
Reply
1,129 Views
mariuslucianand
NXP Employee
NXP Employee

Hello cpatel@mathworks.com‌,

Thank you for reporting this behaviour. This might be caused by one of our callbacks. I have attached a file that must be replaced under {src\mbdtbx_s32k\mscripts\model}.

Please replace it and test the "Propagate Configuration" button.

Hope this helps,

Marius

0 Kudos
Reply