Open bgould opened 8 months ago
I was afraid we'd run into this.
Perhaps the least complicated way to solve this is by doing it in the same way I've solved wfi
before:
https://github.com/tinygo-org/tinygo/blob/release/src/runtime/runtime_nrf_softdevice.go
When performing writes via the NVMC registers, the SoftDevice generates an assertion violation if enabled.
In the nRF SDK, there are 2 "backends" for flash storage, one via the NVMC controller (as in
machine.Flash
) and another that designed for compatibility with SoftDevice enabled: https://infocenter.nordicsemi.com/index.jsp?topic=%2Fstruct_sdk%2Fstruct%2Fsdk_nrf5_latest.htmlIt would be nice to be able to support both backends; It could be the case that the implementation of the SoftDevice backend belongs in tinygo.org/x/bluetooth (or a subpackage). In that case, it might be beneficial to refactor
machine.Flash
to allow for specifying a "backend" other than the NVMC implementation.relevant "SD" fstorage backend implementation: https://github.com/cmdwtf/nRF5_SDK/blob/master/components/libraries/fstorage/nrf_fstorage_sd.c