21ic问答首页 - 极海32F030芯片读写保护时,没找到xx32F0xx Flash_OPT.FLM文件
极海32F030芯片读写保护时,没找到xx32F0xx Flash_OPT.FLM文件
ababABCD2025-01-24
#define OB_BASE ((uint32_t)0x1FFFF800) /*!< FLASH Option Bytes base address */#define OB ((OB_TypeDef *) OB_BASE)
FLASH_Status FLASH_OB_Erase(void)
{
uint16_t rdptmp = OB_RDP_Level_0;
FLASH_Status status = FLASH_COMPLETE;
/* Get the actual read protection Option Byte value */
if(FLASH_OB_GetRDP() != RESET)
{
rdptmp = 0x00;
}
/* Wait for last operation to be completed */
status = FLASH_WaitForLastOperation(FLASH_ER_PRG_TIMEOUT);
if(status == FLASH_COMPLETE)
{
/* If the previous operation is completed, proceed to erase the option bytes */
FLASH->CR |= FLASH_CR_OPTER;
FLASH->CR |= FLASH_CR_STRT;
/* Wait for last operation to be completed */
status = FLASH_WaitForLastOperation(FLASH_ER_PRG_TIMEOUT);
if(status == FLASH_COMPLETE)
{
/* If the erase operation is completed, disable the OPTER Bit */
FLASH->CR &= ~FLASH_CR_OPTER;
/* Enable the Option Bytes Programming operation */
FLASH->CR |= FLASH_CR_OPTPG;
/* Restore the last read protection Option Byte value */
OB->RDP = (uint16_t)rdptmp;
/* Wait for last operation to be completed */
status = FLASH_WaitForLastOperation(FLASH_ER_PRG_TIMEOUT);
if(status != FLASH_TIMEOUT)
{
/* if the program operation is completed, disable the OPTPG Bit */
FLASH->CR &= ~FLASH_CR_OPTPG;
}
}
else
{
if (status != FLASH_TIMEOUT)
{
/* Disable the OPTPG Bit */
FLASH->CR &= ~FLASH_CR_OPTPG;
}
}
}
/* Return the erase status */
return status;
}
请问有用过极海的读保护的吗,这个OPT.FLM文件去哪找
FLASH_Status FLASH_OB_Erase(void)
{
uint16_t rdptmp = OB_RDP_Level_0;
FLASH_Status status = FLASH_COMPLETE;
/* Get the actual read protection Option Byte value */
if(FLASH_OB_GetRDP() != RESET)
{
rdptmp = 0x00;
}
/* Wait for last operation to be completed */
status = FLASH_WaitForLastOperation(FLASH_ER_PRG_TIMEOUT);
if(status == FLASH_COMPLETE)
{
/* If the previous operation is completed, proceed to erase the option bytes */
FLASH->CR |= FLASH_CR_OPTER;
FLASH->CR |= FLASH_CR_STRT;
/* Wait for last operation to be completed */
status = FLASH_WaitForLastOperation(FLASH_ER_PRG_TIMEOUT);
if(status == FLASH_COMPLETE)
{
/* If the erase operation is completed, disable the OPTER Bit */
FLASH->CR &= ~FLASH_CR_OPTER;
/* Enable the Option Bytes Programming operation */
FLASH->CR |= FLASH_CR_OPTPG;
/* Restore the last read protection Option Byte value */
OB->RDP = (uint16_t)rdptmp;
/* Wait for last operation to be completed */
status = FLASH_WaitForLastOperation(FLASH_ER_PRG_TIMEOUT);
if(status != FLASH_TIMEOUT)
{
/* if the program operation is completed, disable the OPTPG Bit */
FLASH->CR &= ~FLASH_CR_OPTPG;
}
}
else
{
if (status != FLASH_TIMEOUT)
{
/* Disable the OPTPG Bit */
FLASH->CR &= ~FLASH_CR_OPTPG;
}
}
}
/* Return the erase status */
return status;
}
请问有用过极海的读保护的吗,这个OPT.FLM文件去哪找
您需要登录后才可以回复 登录 | 注册