Skip to content

Commit

Permalink
Use extended serial flash size in address check used before erasing O…
Browse files Browse the repository at this point in the history
…TA region
  • Loading branch information
monkbroc authored and avtolstoy committed May 21, 2020
1 parent 45c22f9 commit 90a715e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion platform/MCU/nRF52840/src/flash_mal.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@

bool FLASH_CheckValidAddressRange(flash_device_t flashDeviceID, uint32_t startAddress, uint32_t length)
{
// FIXME: remove magic numbers
uint32_t endAddress = startAddress + length - 1;

if (flashDeviceID == FLASH_INTERNAL)
Expand All @@ -54,7 +55,7 @@ bool FLASH_CheckValidAddressRange(flash_device_t flashDeviceID, uint32_t startAd
else if (flashDeviceID == FLASH_SERIAL)
{
#ifdef USE_SERIAL_FLASH
return startAddress >= 0x00000000 && endAddress <= 0x400000;
return startAddress >= 0x00000000 && endAddress <= EXTERNAL_FLASH_SIZE;
#else
return false;
#endif
Expand Down

0 comments on commit 90a715e

Please sign in to comment.