|
RDP_ENABLE 例子
我这样用, 没有问题。
#define RDP_ENABLE -- to lock //#define RDP_DISABLE -- to unlock
void main(void) { SetSysClockPLL(); NVIC_Configuration();
#ifdef RDP_ENABLE FLASH_Unlock(); FLASH_ClearFlag(FLASH_FLAG_BSY | FLASH_FLAG_EOP | FLASH_FLAG_PGERR | FLASH_FLAG_WRPRTERR); if ( FLASH_GetReadOutProtectionStatus() == RESET ) FLASH_ReadOutProtection(ENABLE); //Run in Flash #endif #ifdef RDP_DISABLE FLASH_Unlock(); FLASH_ClearFlag(FLASH_FLAG_BSY | FLASH_FLAG_EOP | FLASH_FLAG_PGERR | FLASH_FLAG_WRPRTERR); if ( FLASH_GetReadOutProtectionStatus() == SET ) FLASH_ReadOutProtection(DISABLE); //Run in RAM #endif
while (1) { }
}
|
|