mirror of https://github.com/ARMmbed/mbed-os.git
Merge pull request #5455 from LMESTM/flash_2MB_GetSector_fix
STM32 Flash 2MB GetSector fixpull/5160/merge
commit
66054f4b62
|
|
@ -145,7 +145,6 @@ int32_t flash_program_page(flash_t *obj, uint32_t address, const uint8_t *data,
|
||||||
|
|
||||||
uint32_t flash_get_sector_size(const flash_t *obj, uint32_t address)
|
uint32_t flash_get_sector_size(const flash_t *obj, uint32_t address)
|
||||||
{
|
{
|
||||||
|
|
||||||
if ((address >= (FLASH_BASE + FLASH_SIZE)) || (address < FLASH_BASE)) {
|
if ((address >= (FLASH_BASE + FLASH_SIZE)) || (address < FLASH_BASE)) {
|
||||||
return MBED_FLASH_INVALID_SIZE;
|
return MBED_FLASH_INVALID_SIZE;
|
||||||
}
|
}
|
||||||
|
|
@ -180,8 +179,10 @@ static uint32_t GetSector(uint32_t address)
|
||||||
/* This function supports 1Mb and 2Mb flash sizes */
|
/* This function supports 1Mb and 2Mb flash sizes */
|
||||||
#if defined(ADDR_FLASH_SECTOR_16)
|
#if defined(ADDR_FLASH_SECTOR_16)
|
||||||
if (address & 0x100000) { // handle 2nd bank
|
if (address & 0x100000) { // handle 2nd bank
|
||||||
|
/* Sector will be at least 12 */
|
||||||
sector = FLASH_SECTOR_12;
|
sector = FLASH_SECTOR_12;
|
||||||
tmp = address - ADDR_FLASH_SECTOR_12;
|
tmp -= 0x100000;
|
||||||
|
address -= 0x100000;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (address < ADDR_FLASH_SECTOR_4) { // 16k sectorsize
|
if (address < ADDR_FLASH_SECTOR_4) { // 16k sectorsize
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue