When compiling code in Simplicity Studio, it turns out that some optimizations for size have been turned off in favor of speed during the compilation process.  The result is code binaries being larger than desired in many cases.


While you can compile your code directly in IAR to remedy this problem, it can be cumbersome as your have to use a different compiler and IDE.



A permanent fix to Studio which allows you to compile your code the same as IAR would be to make changes the base.slspro file within your stack and correct these optimization flags.  Within the stacks do a search for this file, some stacks may have multiple files:




To be certain your changes happen, change both files.


In each file you need to find these lines:


<toolOption toolId="iar.arm.toolchain.compiler.v5.4.1" optionId="iar.arm.toolchain.compiler.option.optCSE.v5.4.0" value="true"/>
<toolOption toolId="iar.arm.toolchain.compiler.v5.4.1" optionId="iar.arm.toolchain.compiler.option.optUnroll.v5.4.0" value="true"/>
<toolOption toolId="iar.arm.toolchain.compiler.v5.4.1" optionId="iar.arm.toolchain.compiler.option.optInline.v5.4.0" value="true"/>
<toolOption toolId="iar.arm.toolchain.compiler.v5.4.1" optionId="iar.arm.toolchain.compiler.option.optCodeMotion.v5.4.0" value="true"/>
<toolOption toolId="iar.arm.toolchain.compiler.v5.4.1" optionId="iar.arm.toolchain.compiler.option.optAliasAnalysis.v5.4.0" value="true"/>
<toolOption toolId="iar.arm.toolchain.compiler.v5.4.1" optionId="iar.arm.toolchain.compiler.option.optStaticClustering.v5.4.0" value="true"/>


And change them all from true to false.  We list them here together, but they don't appear this close together in file.


Once you save your file and recompile your code, you will see your binary output size decrease.


  • ZigBee and Thread
  • Knowledge Base Articles