Skip to content

nrf: writes via machine.Flash cause assertion violations with SoftDevice enabled #4170

@bgould

Description

@bgould
Member

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.html

It 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

Activity

aykevl

aykevl commented on Mar 3, 2024

@aykevl
Member

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

deadprogram

deadprogram commented on Jan 12, 2025

@deadprogram
Member

@bgould @aykevl if #4692 is good, I can work on fix for this one as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingnRFNordic Semi

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @deadprogram@aykevl@bgould

        Issue actions

          nrf: writes via `machine.Flash` cause assertion violations with SoftDevice enabled · Issue #4170 · tinygo-org/tinygo