We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9bed429 commit dacf04eCopy full SHA for dacf04e
targets/TARGET_STM/TARGET_STM32F4/flash_api.c
@@ -160,11 +160,19 @@ static uint32_t GetSector(uint32_t address)
160
#endif
161
if (address < ADDR_FLASH_SECTOR_4) { // 16k sectorsize
162
sector += tmp >>14;
163
- } else if (address < ADDR_FLASH_SECTOR_5) { //64k sector size
+ }
164
+#if defined(ADDR_FLASH_SECTOR_5)
165
+ else if (address < ADDR_FLASH_SECTOR_5) { //64k sector size
166
sector += FLASH_SECTOR_4;
167
} else {
168
sector += 4 + (tmp >>17);
169
}
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
176
return sector;
177
178
0 commit comments