CADI interactions with processor behavior
Architecturally, M series processors have different reset behavior to that of A and R series processors.
For both hardware and model processors, a reset consists of asserting, and then deasserting the reset pin. However:
- The architecture documentation specifies that on asserting the reset pin, the processor stops executing instructions. On deasserting the reset pin, the VTOR is given its reset value, SP_main is read from address VTOR+0, and the PC is read from address VTOR+4. See the Reset behavior section and the Vector Table Offset Register, VTOR section in the ARM®v7-M Architecture Reference Manual. Also, the processor begins fetching and executing instructions.
- and R series
- Asserting the reset pin causes the processor to stop executing instructions and the PC
to be given its reset value, which depends on VINITHI, and the SP is
UNKNOWN. See the Reset section in the ARM® Architecture Reference Manual ARMv7-A and ARMv7-R edition. On deasserting the reset pin, the processor begins fetching and executing instructions.
The behavior of reset on M series processors interacts differently with CADI debugging functionality than it does for A and R series processors.
On A and R series processors, after the reset pin of the processor is
asserted, a new application can be loaded using the
CADIExecLoadApplication() call in CADI. This loads an application into memory,
and sets the PC if a start address is specified in the application. When reset is
deasserted, the processor begins fetching and executing from the start address as expected.
Similarly, if a debugger asserts reset on the processor, it can modify memory with a
CADIMemWrite() calls, update the PC with a
CADIRegWrite() call, and when reset is deasserted the
processor begins to fetch and execute from the PC.
On M series processors, these techniques do not work because after reset is deasserted the processor updates SP_main and the PC, overwriting the settings made by the CADI calls.
For these techniques to be possible, the M series processor models differ
slightly from the architectural reset behavior. When reset is asserted, the M series makes
note of whether the PC or SP are modified before reset is next deasserted. If there are any
CADI writes to the PC or SP registers, either directly through
CADIRegWrite or indirectly through
CADIExecLoadApplication(), this is tracked. When reset is deasserted, if the PC
has been modified using CADI, the PC retains the value written to it, otherwise it reads it
from address VTOR+4. Similarly, if the SP has been modified using CADI, SP_main retains the
value written to it, otherwise it reads it from address VTOR+0.