NVS thready safety, multiple NVS objects to same flash partition


Wayne Uroda <wayne.uroda@...>
 

I am using nrf9160, and as part of compliance with some carriers, I must use the lwm2m_carrier library supplied by Nordic.
This library works with the NVS partition using the NVS APIs.
I also want to use NVS inside my own app.

The API documentation is too short and doesn't say if NVS is thread safe or not (I assume not) and doesn't say if it supports multiple nvs objects pointing at the same partition (again, I assume it does not, for the same reason that I assume it is not thread safe).

Would you recommend that I make separate NVS partitions for the library and my own app to use? It will be non-trivial to get the same NVS object pointer shared between the library and my app, without some ugly hacks.

In general, is this the best place to get support?


Jeremy Herbert
 

Hi Wayne,

I do not work for Nordic, I just use their devices with Zephyr. I cannot answer your question on the API thread safety I am afraid as I do not have any experience with it, but if you are asking about the details of a nordic-specific implementation of something, I suggest you ask on the nordic devzone as they are remarkably responsive and helpful there.

Thanks,
Jeremy

On Mon, 25 Jul 2022 at 11:16, Wayne Uroda <wayne.uroda@...> wrote:
I am using nrf9160, and as part of compliance with some carriers, I must use the lwm2m_carrier library supplied by Nordic.
This library works with the NVS partition using the NVS APIs.
I also want to use NVS inside my own app.

The API documentation is too short and doesn't say if NVS is thread safe or not (I assume not) and doesn't say if it supports multiple nvs objects pointing at the same partition (again, I assume it does not, for the same reason that I assume it is not thread safe).

Would you recommend that I make separate NVS partitions for the library and my own app to use? It will be non-trivial to get the same NVS object pointer shared between the library and my app, without some ugly hacks.

In general, is this the best place to get support?


Wayne Uroda <wayne.uroda@...>
 

Thanks, I do use the devzone yes.

I don't consider this to be anything Nordic specific, as the other library is just using the plain NVS API as provided by Zephyr - I merely wanted to give background to the situation, as to why I don't particularly want to modify the library.


On Mon, Jul 25, 2022 at 12:46 PM Jeremy Herbert <jeremy.006@...> wrote:
Hi Wayne,

I do not work for Nordic, I just use their devices with Zephyr. I cannot answer your question on the API thread safety I am afraid as I do not have any experience with it, but if you are asking about the details of a nordic-specific implementation of something, I suggest you ask on the nordic devzone as they are remarkably responsive and helpful there.

Thanks,
Jeremy

On Mon, 25 Jul 2022 at 11:16, Wayne Uroda <wayne.uroda@...> wrote:
I am using nrf9160, and as part of compliance with some carriers, I must use the lwm2m_carrier library supplied by Nordic.
This library works with the NVS partition using the NVS APIs.
I also want to use NVS inside my own app.

The API documentation is too short and doesn't say if NVS is thread safe or not (I assume not) and doesn't say if it supports multiple nvs objects pointing at the same partition (again, I assume it does not, for the same reason that I assume it is not thread safe).

Would you recommend that I make separate NVS partitions for the library and my own app to use? It will be non-trivial to get the same NVS object pointer shared between the library and my app, without some ugly hacks.

In general, is this the best place to get support?