This tool can be used to instrument ARMv8-m33 C code for CFA.
-
Write the application source code to
application.candapplication.h. -
Modify
PROJinpre-process.shto point to your STM32Cube project directory -
In
application.c, ensure any function with no internal function call has a call toSECURE_new_log_entry. This will ensure any added calls due to instrumentation save/return from the link register properly. -
Run
pre-proces.shas a bash script with two input parameters. First: the C file name without the .c extension (e.g., forapplication.c, the first input should beapplication). Second: the desired name of assembly output (e.g., forinstrumented.sthe second input should beinstrumented) -
This should result in two files. First,
application.scontaining unmodified assembly ofapplication.c. Second,instrumented.s(or whatever you set as output file name), containing an instrumented version ofapplication.s. This script modifies each indirect call/jump to pass throughSECURE_log_indr_fwd, each return to pass throughSECURE_log_ret, and ensures the first instruction at the destination of conditional branches is a call toSECURE_log_cond_br_takenorSECURE_log_cond_br_not_taken. These trampolines are implemented insecure_nsc.c. This implementation ensures each control flow destination that occurred is logged. -
Add
instrumented.sandapplication.hto the{PROJ}/NonSecure/Core/Srcdirectory of your STM32Cube project -
Add
secure_nsc.cto{PROJ}/Secure/Core/Srcandsecure_nsc.hto{PROJ}/Secure_nsclib