We have some dev code where the workflow is as follows:
1. an engineering version of firmware is loadded to target. The target is erased then programmed in the normal way.
2. various config operations are carried out, and config data is written to FLASH on the target (in an area between the application and the bootloader/dfu config at top of FLASH).
3. the final application is built. Several .hex files are merged at this step : softdevice, application, and also bootloader settings (which live at the top of FLASH).
4. the final application is programmed to target. The device is NOT erased : we call nrfjprog with the "--sectorerase" flag.
We find that when the final app does not boot : the bootloader detects a CRC error. On examining the contents of FLASH, we see that the bootloader settings at top of FLASH do not match the .hex file they were built from - even though step 4 completed without error (log file shows no indication anything did not work).
When we erase the target before step 4, all is well. Bootloader settings are correct and the device boots fine.
Can someone please clarify what "sectorerase" does? Particularly when using a .hex file which has "gaps" between softdevice/app and the settings at top of FLASH? Did we find a bug or do we misunderstand the use of this flag?