SDAA211 January   2026 MSPM0G1518 , MSPM0G1519 , MSPM0G3518 , MSPM0G3519

 

  1.   1
  2.   Abstract
  3.   Trademarks
  4. 1Introduction
  5. 2Detailed Description
    1. 2.1 Overview
      1. 2.1.1 Live Firmware Update Flow
      2. 2.1.2 Memory Organization
    2. 2.2 Block Diagram
    3. 2.3 Code
      1. 2.3.1 CSC (Customer Secure Code, Bankswap_CSC_G3519_v2)
        1. 2.3.1.1 CSC - Main Function (Bankswap_CSC_G3519_v2.c)
        2. 2.3.1.2 CSC - Linker File (Bootloader.cmd)
      2. 2.3.2 App (Bankswap_G3519_gpio_output_toggle_v2_SW_Version55_CRC32)
        1. 2.3.2.1 App - Main Function (Bankswap_G3519_gpio_output_toggle_v2_SW_Version55_CRC32.c)
        2. 2.3.2.2 App – UART ISR (Bankswap_G3519_gpio_output_toggle_v2_SW_Version55_CRC32.c)
        3. 2.3.2.3 App - Linker File (device_linker.cmd)
    4. 2.4 Implementation
      1. 2.4.1 Implementation Overview
      2. 2.4.2 Implementation Process
        1. 2.4.2.1 Import CCS Project Files (TI CCS IDE)
        2. 2.4.2.2 Conduct MCU Factory Reset (TI CCS IDE)
        3. 2.4.2.3 Build CSC, App in CCS (TI CCS IDE)
        4. 2.4.2.4 Start Debug and Download Image into MCU in CCS (TI CCS IDE)
        5. 2.4.2.5 Generate Data Frame to Send (uart_frame_gui.exe)
        6. 2.4.2.6 Send New FW via UART in PC (Tera Term)
        7. 2.4.2.7 Check the Updated FW (TI CCS IDE)
  6. 3Summary
  7. 4References

CSC - Main Function (Bankswap_CSC_G3519_v2.c)

#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.