ZHCUAN6E October 2022 – May 2025 MSPM0L1105 , MSPM0L1106 , MSPM0L1116 , MSPM0L1117 , MSPM0L1227 , MSPM0L1227-Q1 , MSPM0L1228 , MSPM0L1228-Q1 , MSPM0L1303 , MSPM0L1304 , MSPM0L1304-Q1 , MSPM0L1305 , MSPM0L1305-Q1 , MSPM0L1306 , MSPM0L1306-Q1 , MSPM0L1343 , MSPM0L1344 , MSPM0L1345 , MSPM0L1346 , MSPM0L2227 , MSPM0L2227-Q1 , MSPM0L2228 , MSPM0L2228-Q1
CSC 应该是独立于主应用程序的映像。这样可以将 CSC 从应用程序完全隔离,而不是将 CSC 功能作为单个映像嵌入到应用程序中。
在 BOOTDONE 之后的第一次 SYSRST 时,通过复位处理程序在 0x0 处调用 CSC。下面的伪代码提供了 CSC 编程模型的概况。
void resetHandler(void)
{
_asm(“b __c_init00”); // this is the call to secure startup, which would issue INITDONE
}CSC 将检查是否已发出 INITDONE,并据此决定在启动经过身份验证的映像之前执行应用程序映像身份验证和安全配置。
bool init_done = (*(volatile long *)(SYSCTL_SECCFG_SECTSTAT)) & 0x1;
If (! Init_done)
{
setupKeystorage(); // AES symmetric keys
entry_point = findImageEntryPoint ();
stack_ptr = findImageStackPtr();
setBankSwap(0 or 1); // depending on which bank the image is in
// setup SRAM boundary
copyFromFlashToSRAM();
setupSRAMBoundary();
lockSRAMBoundary();
setupFlashFirewalls();
INITDONE = 1; // *(volatile long *) (SYSCTL_SECCFG_INITDONE) = 1 | (0x9D << 24);
// This triggers a HW-initiated SYSRST
}
// we will come here if INITDONE = 1 after a SYSRST
launchApp(); // using entry_point and stack pointer base from image metadata如下所述,CSC 将执行一系列安全配置操作,其中包括:
请注意,SRAM 边界设置是可选的,仅当应用程序打算在 SRAM 之外运行任何代码(尤其是中断处理程序)时才需要。这是为了满足在主闪存可能忙于完整性检查时保持通信 ISR 运行的要求。
最后一步将触发第二次 SYSRST,并再次调用复位处理程序。由于现在发现需要设置 init_done,CSC 此时只需使用从应用程序映像获取的 entry_point 调用主应用程序。