F746 flexibility
This commit is contained in:
parent
c094176eaf
commit
f615e9361c
|
@ -97,7 +97,11 @@ int flashSectorErase(flashsector_t sector) {
|
||||||
* ...
|
* ...
|
||||||
* 10111 sector 23 (the end of 2nd bank, 2Mb border)
|
* 10111 sector 23 (the end of 2nd bank, 2Mb border)
|
||||||
* others not allowed */
|
* others not allowed */
|
||||||
|
#ifndef FLASH_CR_SNB_4
|
||||||
|
FLASH->CR &= ~(FLASH_CR_SNB_0 | FLASH_CR_SNB_1 | FLASH_CR_SNB_2 | FLASH_CR_SNB_3);
|
||||||
|
#else
|
||||||
FLASH->CR &= ~(FLASH_CR_SNB_0 | FLASH_CR_SNB_1 | FLASH_CR_SNB_2 | FLASH_CR_SNB_3 | FLASH_CR_SNB_4);
|
FLASH->CR &= ~(FLASH_CR_SNB_0 | FLASH_CR_SNB_1 | FLASH_CR_SNB_2 | FLASH_CR_SNB_3 | FLASH_CR_SNB_4);
|
||||||
|
#endif
|
||||||
if (sector & 0x1)
|
if (sector & 0x1)
|
||||||
FLASH->CR |= FLASH_CR_SNB_0;
|
FLASH->CR |= FLASH_CR_SNB_0;
|
||||||
if (sector & 0x2)
|
if (sector & 0x2)
|
||||||
|
@ -106,8 +110,10 @@ int flashSectorErase(flashsector_t sector) {
|
||||||
FLASH->CR |= FLASH_CR_SNB_2;
|
FLASH->CR |= FLASH_CR_SNB_2;
|
||||||
if (sector & 0x8)
|
if (sector & 0x8)
|
||||||
FLASH->CR |= FLASH_CR_SNB_3;
|
FLASH->CR |= FLASH_CR_SNB_3;
|
||||||
|
#ifdef FLASH_CR_SNB_4
|
||||||
if (sector & 0x10)
|
if (sector & 0x10)
|
||||||
FLASH->CR |= FLASH_CR_SNB_4;
|
FLASH->CR |= FLASH_CR_SNB_4;
|
||||||
|
#endif
|
||||||
FLASH->CR |= FLASH_CR_SER;
|
FLASH->CR |= FLASH_CR_SER;
|
||||||
FLASH->CR |= FLASH_CR_STRT;
|
FLASH->CR |= FLASH_CR_STRT;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue