Skip to content

Commit

Permalink
[nrf52840] platform: we only need to erase user application when buil…
Browse files Browse the repository at this point in the history
…ding in modular
  • Loading branch information
avtolstoy committed Jun 25, 2021
1 parent 43484d5 commit 983ebbb
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions platform/MCU/nRF52840/src/flash_mal.c
Original file line number Diff line number Diff line change
Expand Up @@ -385,13 +385,15 @@ int FLASH_CopyMemory(flash_device_t sourceDeviceID, uint32_t sourceAddress,
}
#endif // SOFTDEVICE_MBR_UPDATES

#ifdef MODULAR_FIRMWARE
// Make sure to invalidate the compat application, otherwise we'll keep booting into the compat application
// as it takes precedence
if (module_function == MODULE_FUNCTION_USER_PART && destinationAddress == USER_FIRMWARE_IMAGE_LOCATION) {
if (!FLASH_EraseMemory(destinationDeviceID, USER_FIRMWARE_IMAGE_LOCATION_COMPAT, INTERNAL_FLASH_PAGE_SIZE)) {
return FLASH_ACCESS_RESULT_ERROR;
}
}
#endif // MODULAR_FIRMWARE

if (!FLASH_EraseMemory(destinationDeviceID, destinationAddress, dest_size)) {
return FLASH_ACCESS_RESULT_ERROR;
Expand Down

0 comments on commit 983ebbb

Please sign in to comment.