SLAAEQ5 March 2025 MSPM0C1103 , MSPM0C1104 , MSPM0C1104-Q1 , MSPM0C1105 , MSPM0C1106 , MSPM0G1105 , MSPM0G1106 , MSPM0G1107 , MSPM0G1505 , MSPM0G1506 , MSPM0G1507 , MSPM0G1518 , MSPM0G1519 , MSPM0G3105 , MSPM0G3105-Q1 , MSPM0G3106 , MSPM0G3106-Q1 , MSPM0G3107 , MSPM0G3107-Q1 , MSPM0G3505 , MSPM0G3505-Q1 , MSPM0G3506 , MSPM0G3506-Q1 , MSPM0G3507 , MSPM0G3507-Q1 , MSPM0G3518 , MSPM0G3518-Q1 , MSPM0G3519 , MSPM0G3519-Q1 , MSPM0H3216 , MSPM0L1105 , MSPM0L1106 , MSPM0L1228 , MSPM0L1228-Q1 , MSPM0L1303 , MSPM0L1304 , MSPM0L1304-Q1 , MSPM0L1305 , MSPM0L1305-Q1 , MSPM0L1306 , MSPM0L1306-Q1 , MSPM0L1343 , MSPM0L1344 , MSPM0L1345 , MSPM0L1346 , MSPM0L2228 , MSPM0L2228-Q1
#define PASSWORD_WORD_LEN (4U)
#define DebugAccess_Password0 (0x00000001)
#define DebugAccess_Password1 (0x00000002)
#define DebugAccess_Password2 (0x00000003)
#define DebugAccess_Password3 (0x00000004)/* 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;
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,
};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;
}#define PASSWORD_LENGTH (4U)