2.4.2 Execution Flow

Secure Firmware Execution Flow

The following figure illustrates the system-level execution flow of Secure firmware in the Software Attack Protection application.

Figure 2-3. Secure Application Execution Flow

The Secure application executes in the following sequence:

  1. After a system reset, the application initiates the Non-Secure firmware hashing process to generate a firmware digest.
  2. The calculated digest is stored in the data Flash memory within the Secure region.
  3. The firmware digest of the Non-Secure application is verified against the genuine copy in the Secure Flash memory.
  4. Upon successful verification, the execution is jumped to the Non-Secure application.
  5. If verification fails, the Non-Secure application is erased, and the genuine copy is loaded into the Non-Secure Flash region.
  6. Every 30 seconds, the firmware digest is regenerated and cross-verified with the genuine copy to ensure authenticity.

Non-Secure Firmware Execution Flow

The following figure illustrates the system-level execution flow of Non-Secure firmware in the Software Attack Protection application.

Figure 2-4. Non-Secure Application Execution Flow

The Non-Secure application executes in the following sequence:

  1. After a firmware jump from the Secure application, the Non-Secure firmware initializes the Non-Secure peripherals.
  2. Toggles the LED1 for every 500 millisecond on the PIC32CM LS00 Curiosity Nano+ Touch Evaluation Kit.

Software Attack Simulation Execution Flow

The simulation of a software attack is conducted in the following sequence:

  1. Pressing the SW1 button on the PIC32CM LS00 Curiosity Nano+ Touch Evaluation Kit simulates a software attack by triggering a tamper event.
  2. Following the tamper event, the RTC initiates the data Flash content erasure process.
  3. Within the RTC tamper handler, a message indicating the initiation of the software attack is sent to the serial console.
Note: This execution happens inside the RTC interrupt handler of the Secure firmware.

The following figure illustrates the system-level execution flow of Software Attack in the Secure firmware.

Figure 2-5. Software Attack Execution Flow