Why does code generated from my .SLXP model with setting "Obfuscated source code" contain non-obfuscated source code?

I'd like to generate code from an .SLXP model with setting "Obfuscated source code", but the generated code contains non-obfuscated source code. Why is this happening?
Here's an example. Open the following example:
openExample('simulink/ComponentInterfaceSpecificationUsingBusesExample')
I generated a protected .SLXP model of "CounterAlgorithm" with "Content type" set to "Obfuscated source code".  
After generating the "CounterAlgorithm.slxp" file, I delete the original "CounterAlgorithm.slx" file.
Next, I build code for the parent "CounterSystem.slx" model using the following command:
slbuild('CounterSystem')
However, after building code, I notice that some of my generated code is not obfuscated. For example, "CounterAlgorithm_types.h" reveals the Bus structure of "LimitsBus" and "DataBus".
Why are these components not obfuscated in the generated code?

 채택된 답변

Certain components are not obfuscated because they were defined in the top model "CounterSystem.slx", but still need to be referenced in the generated code for "CounterAlgorithm". 
For example, the Bus structures mentioned, even though defined in "CounterAlgorithm_types.h", were originally defined in "CounterSystem.slx".
Even the source code "CounterAlgorithm.c" contains a non-obfuscated variable "LowerSaturationLimit", because that variable was defined in "CounterSystem.slx".
If you want these components to also be obfuscated, please also protect the top model "CounterSystem.slx" with "Content type" set to "Obfuscated source code".  

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Simulink Coder에 대해 자세히 알아보기

제품

릴리스

R2025b

Community Treasure Hunt

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

Start Hunting!

Translated by