Fix flash_protect for GD32F103.

This commit is contained in:
NIIBE Yutaka
2018-05-08 17:35:13 +09:00
parent f500ac03da
commit 2764fc4ea2
3 changed files with 12 additions and 5 deletions

View File

@@ -1,7 +1,7 @@
/*
* sys-stm32f103.c - system routines for the initial page for STM32F103.
*
* Copyright (C) 2013, 2014, 2015, 2016, 2017
* Copyright (C) 2013, 2014, 2015, 2016, 2017, 2018
* Flying Stone Technology
* Author: NIIBE Yutaka <gniibe@fsij.org>
*
@@ -256,6 +256,9 @@ flash_protect (void)
FLASH->OPTKEYR = FLASH_KEY1;
FLASH->OPTKEYR = FLASH_KEY2;
while (!(FLASH->CR & FLASH_CR_OPTWRE))
;
FLASH->CR |= FLASH_CR_OPTER;
FLASH->CR |= FLASH_CR_STRT;