Skip to content

Commit

Permalink
Merge pull request #2330 from particle-iot/fix/gen3-monolithic-flash-…
Browse files Browse the repository at this point in the history
…erase

[nrf52840] platform: we only need to erase user application when building in modular
  • Loading branch information
avtolstoy authored Jun 25, 2021
2 parents 43484d5 + 983ebbb commit 06fe643
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 06fe643

Please sign in to comment.