Running the secure DFU example in SDK 17.1.0 results in hardfault in IAR EWARM 9.10.2. The board used is PCA10040.
Using EWARM 8.50.4 seems to work without problems.
Steps to reproduce:
- Use nRF Connect Programmer to erase the chip and flash the SoftDevice: components\softdevice\s132\hex\s132_nrf52_7.2.0_softdevice.hex
- Using EWARM 9.10.2, open examples\dfu\secure_bootloader\secure_bootloader.eww and select the secure_bootloader_ble_s132_pca10040_debug project.
- Implement workaround for Go029 error (see [1]) (Insert "#pragma diag_suppress=Go029" on line 929 in components/libraries/bootloader/ble_dfu/nrf_dfu_ble.c)
- Implement the __ALIGN() error workaround (see [2])
- Use "Download and debug". This produces the following error messages:
"Blocked misaligned 1-byte SFR write access at 0x1000'101b, 0 byte(s) into 4-byte SFR at 0x1000'101b
...
There was 1 warning during the initialization of the debugging session.
T-bit of XPSR is 0 but should be 1. Changed to 1.
...
HardFault exception.
The processor has escalated a configurable-priority exception to HardFault.
A precise data access error has occurred (CFSR.PRECISERR, BFAR) at data address 0xff07e004.
An instruction executed with an invalid EPSR.T or EPSR.IT field (CFSR.INVSTATE).
Exception occurred at PC = 0x43e, LR = 0xffffffff"
References
[1]: EWARM Go029 workaround devzone.nordicsemi.com/.../320432
[2]: See developer.nordicsemi.com/.../release_notes.txt
"When using IAR 8, you must apply the following workaround in the MDK:
- Apply a patch to modules/nrfx/mdk/compiler_abstraction.h at line 140
(fix the '__ALIGN()' macro definition): use the argument 'n' in the macro expansion instead of 'x'."
