Skip to content

Commit dacf04e

Browse files
committed
STM32: Flash: cover TARGET_F410RB case
There was a comilation error for NUCLeO_F410RB as it does not have a ADDR_FLASH_SECTOR_5.
1 parent 9bed429 commit dacf04e

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

targets/TARGET_STM/TARGET_STM32F4/flash_api.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,11 +160,19 @@ static uint32_t GetSector(uint32_t address)
160160
#endif
161161
if (address < ADDR_FLASH_SECTOR_4) { // 16k sectorsize
162162
sector += tmp >>14;
163-
} else if (address < ADDR_FLASH_SECTOR_5) { //64k sector size
163+
}
164+
#if defined(ADDR_FLASH_SECTOR_5)
165+
else if (address < ADDR_FLASH_SECTOR_5) { //64k sector size
164166
sector += FLASH_SECTOR_4;
165167
} else {
166168
sector += 4 + (tmp >>17);
167169
}
170+
#else
171+
// In case ADDR_FLASH_SECTOR_5 is not defined, sector 4 is the last one.
172+
else { //64k sector size
173+
sector += FLASH_SECTOR_4;
174+
}
175+
#endif
168176
return sector;
169177
}
170178

0 commit comments

Comments
 (0)