anyThing Connected Team / mbed-dev

Dependents:   BREAK_SENSOR_LED

Fork of mbed-dev by mbed official

Revision:
179:b0033dcd6934
Parent:
167:e84263d55307
diff -r 79309dc6340a -r b0033dcd6934 targets/TARGET_Silicon_Labs/TARGET_EFM32/flash_api.c
--- a/targets/TARGET_Silicon_Labs/TARGET_EFM32/flash_api.c	Thu Nov 23 11:57:25 2017 +0000
+++ b/targets/TARGET_Silicon_Labs/TARGET_EFM32/flash_api.c	Thu Dec 07 14:01:42 2017 +0000
@@ -93,10 +93,17 @@
     (void)obj;
     (void)address;
 
+#if FLASH_BASE > 0
     if (address < FLASH_BASE || address >= FLASH_BASE + FLASH_SIZE) {
         // Address outside of flash -- invalid sector
         return MBED_FLASH_INVALID_SIZE;
     }
+#else
+    if (address >= FLASH_BASE + FLASH_SIZE) {
+        // Address outside of flash -- invalid sector
+        return MBED_FLASH_INVALID_SIZE;
+    }
+#endif
 
     return FLASH_PAGE_SIZE;
 }