ZHCAF28 March   2025 MSPM0C1103 , MSPM0C1104 , MSPM0C1104-Q1 , MSPM0G1105 , MSPM0G1106 , MSPM0G1107 , MSPM0G1505 , MSPM0G1506 , MSPM0G1507 , MSPM0G3105 , MSPM0G3105-Q1 , MSPM0G3106 , MSPM0G3106-Q1 , MSPM0G3107 , MSPM0G3107-Q1 , MSPM0G3505 , MSPM0G3505-Q1 , MSPM0G3506 , MSPM0G3506-Q1 , MSPM0G3507 , MSPM0G3507-Q1 , MSPM0L1105 , MSPM0L1106 , MSPM0L1228 , MSPM0L1228-Q1 , MSPM0L1303 , MSPM0L1304 , MSPM0L1304-Q1 , MSPM0L1305 , MSPM0L1305-Q1 , MSPM0L1306 , MSPM0L1306-Q1 , MSPM0L1343 , MSPM0L1344 , MSPM0L1345 , MSPM0L1346 , MSPM0L2228 , MSPM0L2228-Q1

 

  1.   1
  2.   摘要
  3.   商标
  4. 1网络安全要求简介
    1. 1.1 MSPM0 的网络安全要求
  5. 2MSPM0 调试寄存器简介
  6. 3实施
    1. 3.1 使用邮箱的调试器
    2. 3.2 MCU
      1. 3.2.1 使用和配置 Nonmain
      2. 3.2.2 MSPM0 软件实现
  7. 4执行
    1. 4.1 首次刷写
    2. 4.2 访问锁定的 MCU
  8. 5如何自定义密码
    1. 5.1 密码
    2. 5.2 密码长度
  9. 6总结
  10. 7参考资料

密码长度

  1. 演示代码 – boot_configwithPassword.h;密码
    #define PASSWORD_WORD_LEN                                                  (4U)
    #define DebugAccess_Password0                                      (0x00000001)
    #define DebugAccess_Password1                                      (0x00000002)
    #define DebugAccess_Password2                                      (0x00000003)
    #define DebugAccess_Password3                                      (0x00000004)
  2. 演示代码 – boot_configwithPassword.h:BCR_Config 结构中的密码
    /* Bootcode user configuration structure */
    typedef struct
    {
        /*! Configuration signature */
        uint32_t bcrConfigID;
        /*! Enable/disable AHB-AP, ET-AP, PWR-AP.
         * One of @ref BCR_CFG_DEBUG_ACCESS */
        BCR_CFG_DEBUG_ACCESS debugAccess;
        /*! Enable/disable SWD port access. One of @ref BCR_CFG_SWDP_MODE */
        BCR_CFG_SWDP_MODE swdpMode;
        /*! The factory reset mode. One of @ref BCR_CFG_FACTORY_RESET */
        BCR_CFG_FACTORY_RESET factoryResetMode;
        /*! Non Main Flash Static Write Protection.
        * One of @ref BCR_CFG_NON_MAIN_STATIC_PROT */
        BCR_CFG_NON_MAIN_STATIC_PROT staticWriteProtectionNonMain;
        /*! Programs static write protection of first 32K bytes.
         * One bit corresponds to one sector, LSB is Sector 0. Setting a bit
         * to 0 disables write, setting a bit to 1 enables write Possible values:
         *    - 0x0 to 0xFFFFFFFF */
        uint32_t staticWriteProtectionMainLow;
        /*! Programs static write protection of first 32K bytes.
         * One bit corresponds to eight sectors. Setting a bit
         * to 0 disables write, setting a bit to 1 enables write Possible values:
         *    - 0x0 to 0xFFFFFFF0 */
        uint32_t staticWriteProtectionMainHigh;
        /*! Reserved */
        uint32_t reserved;
        uint32_t password0;
        uint32_t password1;
        uint32_t password2;
        uint32_t password3;
        //Can add password length if needed
    } BCR_Config;
    
  3. 演示代码 – boot_configwithPassword.c:将 BCRConfig_origi 变量更改为配置 Nonmain
    PLACE_IN_MEMORY(".BCRConfig")
    const BCR_Config BCRConfig_origin =
    {
        .bcrConfigID          = 0x3,
        .debugAccess          = BCR_CFG_DEBUG_ACCESS_DIS,
        .swdpMode             = BCR_CFG_SWDP_EN,
        .factoryResetMode     = BCR_CFG_FACTORY_RESET_DIS,
        .staticWriteProtectionNonMain  = BCR_CFG_NON_MAIN_STATIC_PROT_DIS,
        .staticWriteProtectionMainLow  = CFG_DEFAULT_VALUE,
        .staticWriteProtectionMainHigh = CFG_DEFAULT_VALUE,
        .reserved = 0xFFFFFFFFU,
        .password0 = DebugAccess_Password0,
        .password1 = DebugAccess_Password1,
        .password2 = DebugAccess_Password2,
        .password3 = DebugAccess_Password3,
    };
  4. 演示代码 – check_password.c:Para_init 函数
    void Para_init(void)
    {
        AHPAccess = false;
        BCRConfig_update.bcrConfigID          = 0x3;
        BCRConfig_update.debugAccess          = BCR_CFG_DEBUG_ACCESS_DIS;
        BCRConfig_update.swdpMode             = BCR_CFG_SWDP_EN;
        BCRConfig_update.factoryResetMode     = BCR_CFG_FACTORY_RESET_DIS;
        BCRConfig_update.staticWriteProtectionNonMain  = BCR_CFG_NON_MAIN_STATIC_PROT_DIS;
        BCRConfig_update.staticWriteProtectionMainLow  = CFG_DEFAULT_VALUE;
        BCRConfig_update.staticWriteProtectionMainHigh = CFG_DEFAULT_VALUE;
        BCRConfig_update.reserved = 0xFFFFFFFFU;
        BCRConfig_update.password0 = DebugAccess_Password0;
        BCRConfig_update.password1 = DebugAccess_Password1;
        BCRConfig_update.password2 = DebugAccess_Password2;
        BCRConfig_update.password3 = DebugAccess_Password3;
    }
  5. 演示代码 –check_password.c:Nonmain_check 函数
  6. mspm0_cs_dap_init_V2: Password_LENGTH
    #define PASSWORD_LENGTH                                                  (4U)
  7. mspm0_cs_dap_init_V2:GEL_MSPM0_C_PasswordAuth(autoReset) 函数。密码长度已更改,无法将 CCS GUI 用作人机界面,因此用户需要在 CCS 脚本中添加实际密码,并发送调试器进行传输。