|
|
@ -32,9 +32,39 @@ static uint32_t get_sector(uint32_t Address) |
|
|
|
sector = FLASH_Sector_9; |
|
|
|
} else if((Address < ADDR_FLASH_SECTOR_11) && (Address >= ADDR_FLASH_SECTOR_10)) { |
|
|
|
sector = FLASH_Sector_10; |
|
|
|
#if !defined(STM32F429_439xx) |
|
|
|
} else {/*(Address < FLASH_END_ADDR) && (Address >= ADDR_FLASH_SECTOR_11))*/ |
|
|
|
sector = FLASH_Sector_11; |
|
|
|
} |
|
|
|
#else |
|
|
|
} else if((Address < ADDR_FLASH_SECTOR_12) && (Address >= ADDR_FLASH_SECTOR_11)) { |
|
|
|
sector = FLASH_Sector_11; |
|
|
|
} else if((Address < ADDR_FLASH_SECTOR_13) && (Address >= ADDR_FLASH_SECTOR_12)) { |
|
|
|
sector = FLASH_Sector_12; |
|
|
|
} else if((Address < ADDR_FLASH_SECTOR_14) && (Address >= ADDR_FLASH_SECTOR_13)) { |
|
|
|
sector = FLASH_Sector_13; |
|
|
|
} else if((Address < ADDR_FLASH_SECTOR_15) && (Address >= ADDR_FLASH_SECTOR_14)) { |
|
|
|
sector = FLASH_Sector_14; |
|
|
|
} else if((Address < ADDR_FLASH_SECTOR_16) && (Address >= ADDR_FLASH_SECTOR_15)) { |
|
|
|
sector = FLASH_Sector_15; |
|
|
|
} else if((Address < ADDR_FLASH_SECTOR_17) && (Address >= ADDR_FLASH_SECTOR_16)) { |
|
|
|
sector = FLASH_Sector_16; |
|
|
|
} else if((Address < ADDR_FLASH_SECTOR_18) && (Address >= ADDR_FLASH_SECTOR_17)) { |
|
|
|
sector = FLASH_Sector_17; |
|
|
|
} else if((Address < ADDR_FLASH_SECTOR_19) && (Address >= ADDR_FLASH_SECTOR_18)) { |
|
|
|
sector = FLASH_Sector_18; |
|
|
|
} else if((Address < ADDR_FLASH_SECTOR_20) && (Address >= ADDR_FLASH_SECTOR_19)) { |
|
|
|
sector = FLASH_Sector_19; |
|
|
|
} else if((Address < ADDR_FLASH_SECTOR_21) && (Address >= ADDR_FLASH_SECTOR_20)) { |
|
|
|
sector = FLASH_Sector_20; |
|
|
|
} else if((Address < ADDR_FLASH_SECTOR_22) && (Address >= ADDR_FLASH_SECTOR_21)) { |
|
|
|
sector = FLASH_Sector_21; |
|
|
|
} else if((Address < ADDR_FLASH_SECTOR_23) && (Address >= ADDR_FLASH_SECTOR_22)) { |
|
|
|
sector = FLASH_Sector_22; |
|
|
|
} else { |
|
|
|
sector = FLASH_Sector_23; |
|
|
|
} |
|
|
|
#endif |
|
|
|
return sector; |
|
|
|
} |
|
|
|
|
|
|
@ -67,7 +97,11 @@ int flash_if_erase(uint32_t start_address, uint32_t length) |
|
|
|
if (length > 0) { |
|
|
|
end = get_sector(start_address + length); |
|
|
|
} else { |
|
|
|
#if !defined(STM32F429_439xx) |
|
|
|
end = FLASH_Sector_11; |
|
|
|
#else |
|
|
|
end = FLASH_Sector_23; |
|
|
|
#endif |
|
|
|
} |
|
|
|
|
|
|
|
for (i = start; i <= end; i += 8) { |
|
|
|