This page goes over how to use software instrument smart placement.
Software instrumentation implementation make use of ti-arm-clang compiler's instrumentation feature.
It needs to made sure that all the source code are built using -fprofile-instr-generate -fcoverage-mapping
flags. Therefore, it is required to recompile entire SDK with these flags. To do this, please execute the following command on SDK top level.
gmake -j libs-scrub DEVICE=am263px
This will remove all compiled libraries. This will make sure to have a clean start. Then,
gmake -j libs DEVICE=am263px INSTRUMENTATION_MODE=yes
The above command will compile all the SDK libraries in instrumentation mode
and in release
profile. If it required to build libraries in debug
mode then PROFILE=debug
can be added at the end of the command.
Also, in Linux, gmake
is to be replaced by make
. The above commands assumes that current working directory is defined in MCU_PLUS_SDK_PATH
environment variable.
Application is also required to be compiled with those flags.
For the changes that are required to be done for in memory configurator/linker script for instrumentation, please go through the following steps documented at How to add compiler generated sections for instrumentation binaries?.
Once those changes are done, execute following commands:
The above two commands assume that current working directory is defined in MCU_PLUS_SDK_PATH
environment variable. Again, profile flag can be added as well to above commands.
The instrumented binary needs to be run on the target. Make sure to run the application under correct scenario that would lead to good and complete profiling data generation. This is a very important step and quality and accuracy of the generated profiling data will determine quality of rest of the process.
This can be done connecting via CCS and can be read at CCS Launch, Load and Run
CCS Tool Bar > View > Scripting Console
and do below, js:> loadJSFile "C:/ti/mcu_plus_sdk/tools/smart_placement/coverage_dump.js"
C:/ti/mcu_plus_sdk
with the absolute path to where the SDK is installed.What this will do is, make a new .cnt
file in same place as that of location of application’s .out
file.
All the profiling data that is extracted, is stored in .cnt
file. This .cnt
file has to be processed and needs to be converted into a format that compiler will understand. To do this, type the following command:
Again, if application is being built in debug mode, then make sure to provide PROFILE
flag to the above command.
The output of this step would an ASM file with .S
extension.
Update linker as described at Changes in linker/Memory Configurator for Smart Placement.
Recompile the application with new generated ASM file. To do this, add the file in makefile's ASMFILES_common
variable. Note that, now INSTRUMENTATION_MODE flag is not required. So rebuild libs and application without these flags.
This demo provides a means of measuring the performance of a realistic application where the text of the application is sitting in various memory locations and the data is sitting in On-Chip-Memory RAM (referred to as OCM, OCMC or OCMRAM).
annotations.S
.In case if above steps are required to run, then all linker related changes can be skipped as those are already taken into account.