SDAA211 January 2026 MSPM0G1518 , MSPM0G1519 , MSPM0G3518 , MSPM0G3519
#define BANK0_APP_START 0x00002000
#define BANK1_APP_START 0x00042000
uint32_t gVer_info_LB0, gVer_info_LB1;
bool gBankswap_conduct;
int main(void)
{
SYSCFG_DL_init();
/* Get version information */
gVer_info_LB0 = *((uint32_t*)BANK0_APP_START);
gVer_info_LB1 = *((uint32_t*)BANK1_APP_START);
/* Decide bank swap */
if (gVer_info_LB0 < gVer_info_LB1) {
uint32_t* ptr_version_info = (uint32_t*)BANK1_APP_START + 1; // 0x00042004
uint32_t* ptr_SP = (uint32_t*)BANK1_APP_START + 64; // 0x00042256
gBankswap_conduct = true;
/* Check App data format */
for(int i=0; i<63; i++) {
if(ptr_version_info[i] != 0xFFFFFFFF) {
gBankswap_conduct = false;
}
}
/* Check stack pointer, it depends on device */
/* MSPM0G3519 RAM 64kB - 0x20210000 */
if(*ptr_SP != 0x20210000) {
gBankswap_conduct = false;
}
}
if (DL_SYSCTL_isINITDONEIssued())
{
start_app((uint32_t *)VECTOR_ADDRESS_BANK0);
}
else //Init and SWAP
{
if (gBankswap_conduct){
DL_SYSCTL_executeFromUpperFlashBank(); // set flash bank swap bit
delay_cycles(160);
DL_SYSCTL_issueINITDONE(); // Issue INITDOEN to trigger System Reset -> swap to bank1
}else{
DL_SYSCTL_executeFromLowerFlashBank(); // still execute program from bank0
delay_cycles(160);
DL_SYSCTL_issueINITDONE(); // Issue INITDOEN to trigger System Reset -> jump to bank0 app program
}
}
}
The CSC (Customer Secure Code) checks the firmware versions in Bank 0 and Bank 1 to determine whether a bank swap is required. Version information is stored at the beginning of each Bank's Application region. Specifically, the Bank 0 Application version is located at address 0x00002000, while the Bank 1 Application version is located at address 0x00042000.
After checking the version information, if the firmware in Bank 1 is the latest version, the CSC verifies the firmware header before deciding to perform a bank swap. If the firmware has an incorrect header, or if Bank 0 already contains the latest version, the bank swap is not executed.