SCP firmware debug uses the -Og
argument. This optimizes some variables that make debugging difficult. To replace -Og
with -O0
, do the following:
rd-infra/scp/cmake/Toolchain
.<compiler>-Baremetal.cmake
file for your toolchain.For example, change GNU-Baremetal.cmake
:
string(APPEND CMAKE_${language}_FLAGS_DEBUG_INIT "-Og")
to
string(APPEND CMAKE_${language}_FLAGS_DEBUG_INIT "-O0")
After starting the model, click New Debug Connection… from the Debug Control panel.
Create a connection name. This can be whatever you prefer.
Next, click on Add a new model….
Select the appropriate Model Interface, for example CADI.
Click Browse for model running on local host.
Select the correct model, and click Finish.
In the Edit configuration and launch panel, in the Connection tab, select the correct target.
For the SCP
code, select ARM_Cortex-M7_1.
In the Files panel, select Load Symbols from file, File System, and select the SCP RAMFW ELF file, located at:
rd-infra/scp/output/rdn2/0/scp_ramfw/bin/rdn2-bl2.elf
.
Select Apply then Debug. The debugger now connects to the model.
Once connected, you can set breakpoints in the source code. This can be done by searching for the function in the Functions tab, double-clicking next to the line number, or in the Command view.
Set a breakpoint at cmn700_discovery()
. Continue execution and the code stops at the breakpoint you specify.
break cmn700_discovery
continue
Set another breakpoint at a debug print statement.
Observe the output in the SCP UART window.
Disconnect from the FVP.