This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

pstorage_register() called twice in bootloader

The bootloader in SDK 8.1.0 (at /nRF51_SDK_8.1.0 examples/dfu/bootloader) calls pstorate_register() twice. The first time as part of bootloader_init(), then on bootloader_dfu_start().

The first call works for me and the second call asserts. I thought this shouldn't be called twice?

  • @Eliot Stock: I don't see any issue when calling pstorage_register twice. One is used for storing bootloader setting, and one is used for storing DFU image(s). Which issue do you have on the second call ? Have you made sure you set PSTORAGE_MAX_APPLICATIONS = 2 ?

  • That was it, thank you! PSTORAGE_MAX_APPLICATIONS was 1 in SDK 8.0.0 and I had ported my bootloader over from 8.0.0 without updating it to 2. The second call was going into the APP_ERROR_HANDLER().

  • @Eliot: There is also another change from SDK 8.0 to SDK v8.1 is that in the DFU bootloader in SDK v8.1 we use pstorage_raw.c, when in SDK v8.0 it's pstorage.c. You may need to update this also.