Skip to content

nRF51822 pstorage APIs are broken since mbed OS 5.2 #4181

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
janjongboom opened this issue Apr 12, 2017 · 4 comments
Closed

nRF51822 pstorage APIs are broken since mbed OS 5.2 #4181

janjongboom opened this issue Apr 12, 2017 · 4 comments

Comments

@janjongboom
Copy link
Contributor

janjongboom commented Apr 12, 2017

Description

  • Type: Bug
  • Priority: Blocker

Bug

Target
nRF51-DK, also seen on Minewtech nRF51 and Minewtech nRF52

Toolchain:
GCC_ARM and ARMCC

Toolchain version:
4.9.3 and online compiler

meed-os sha:
The problem is present in mbed OS 5.2.3 and 5.4.2, but not in mbed OS 5.1.5.

Expected behavior
Take https://github.com/roywant/EddystoneBeacon. Change the adv interval (3rd characteristic, has value 0x2bc), and persist. On mbed OS 5.1.5 this is persisted in persistent storage. mbed OS 5.2.3 does not persist.

The first call to pstorage_store goes fine, but then a call to pstorage_update will wipe out the flash... Just restart the board and inspect the persistence signature (not even required to power cut). I see that we used to get 2x pstorageNotificationCallback after updating, but now only one... Maybe that's a hint?

I bisected the problem:

e67117b8eafb6dada5f0cc4c09e140c95a001cb3 is the first bad commit
commit e67117b8eafb6dada5f0cc4c09e140c95a001cb3
Author: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
Date:   Tue Aug 23 08:52:32 2016 +0200

    introduce the SDK nRF5 Peer manager into BLE security features

    PM will be used for SoftDevices s13x, otherwise DM will be used.

    Fix - security key distribution settings - Signing is not supported.

    declare usage of encryption LTK and IRK if boonding enabled

    deleted unused local reference to nRF5xGap class in bleGattcEventHandler.
    fix PM internal bug (For gcc with -0s optimization an application fail to save a boonding data)
    fuse redeclaration of PACKED macro in nRF5 SDK sources

Seems legit.

@nvlsianpu

@pan-
Copy link
Member

pan- commented Apr 13, 2017

@nvlsianpu Do you know if fstorage and pstorage can be used concurrently ?
@janjongboom It might be interesting to try with IS_LEGACY_DEVICE_MANAGER_ENABLED set to 1 (here).

@nvlsianpu
Copy link
Contributor

Thanks for the bug report.

pstorage and fstorage can't being used concurrently. pstorage is deprecated module, replaced by fstorage. Mentioned commit switched security manger to use fstorage by deafult.

janjongboom added a commit to janjongboom/mbed-os-example-ble that referenced this issue May 18, 2017
pstorage is deprecated and no longer works in mbed OS 5.4 projects due to ARMmbed/mbed-os#4181. This updates the driver to use fstorage, and also makes the driver work on nRF52.
janjongboom added a commit to janjongboom/mbed-os-example-ble that referenced this issue May 18, 2017
pstorage is deprecated and no longer works in mbed OS 5.4 projects due to ARMmbed/mbed-os#4181. This updates the driver to use fstorage, and also makes the driver work on nRF52.
@ciarmcom
Copy link
Member

ciarmcom commented Jun 1, 2018

ARM Internal Ref: MBOTRIAGE-353

@0xc0170
Copy link
Contributor

0xc0170 commented Jun 19, 2018

I believe this one can be closed. Resolved via referenced PR above to the ble example.

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

No branches or pull requests

7 participants