Hi Maulik,
Thanks for taking the time to investigate my issue.
Here are more details about the setup and how to reproduce the error.
**Configuration:** - TFM version 1.8.0 on commit *35ac80c85 (HEAD, tag: TF-Mv1.8.0, origin/release/1.8.x). - We use a custom integration of TFM for target AN552 on a virtual platform.
**Build options:** - FWU is enabled, and the MOVE_USING_SWAP option is used. - TEST_NS_FWU is enabled.
**Procedure to reproduce the error:** 1. Start the execution of test case `tfm_fwu_test_common_001` in the file `fwu_tests_common.c`. 2. Run until the secondary slot is successfully put into the STAGED state (line 442). - At this step, the MAGIC value in the image trailer should have been successfully set by the call to `psa_fwu_install()`. 3. Call `psa_fwu_reject(PSA_ERROR_GENERIC_ERROR)` to reject the STAGED image. 4. The function `psa_fwu_reject()` generates the following call sequence: - `tfm_fwu_reject()` -> `fwu_bootloader_reject_staged_image()` (call at line 372 in `tfm_fwu_req_mng.c`). 5. The function `fwu_bootloader_reject_staged_image()` in fin `tfm_mcu_boot_fwu.c` generates the following call sequence: - `erase_boot_magic()` -> `flash_area_write(fap, pad_off, &magic[0], BOOT_MAGIC_ALIGN_SIZE)`. 6. The error occurs in the function `flash_area_write()` in the file `flash_map.c`. - My analysis is that the BOOT_MAGIC was not erased in flash prior to this attempt to write. As a result, the flash driver returns a Storage Failure.
Best regards, Cedric