You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mynewt.apache.org by Andrzej Kaczmarek <an...@codecoup.pl> on 2020/02/12 21:57:01 UTC

Common API for provisioned data

Hi,

Long story short: I want to have some interface to provision NimBLE with
device address and keys (e.g. IRK) in a way that is consistent on all BSPs.
This means application does not need to care where address or IRK is stored
on any given platform.

Currently NimBLE host provides helper API to figure out identity address,
but it uses either syscfg value or ble_hw controller API which only works
on Nordic chips and returns address burned into FICR. This is less than
ideal. For example, we recently added support for Dialog MCU which does not
have ble_hw nor has address burned into chip anywhere. On the other hand it
has OTP which can be programmed in factory with addresses and keys, but how
this is done is up to vendor and thus can be different for each BSP.

A similar use case I believe is a hardware id which already has its own
API, namely hal_bsp_hw_id(). However, adding separate API for each data
type does not sound like a good idea. It would be better to have a single
API for any kind of provisioned data and also merge hardware id there.

I drafted some code to add new API and also updated some nRF52840 DK code
to implement this new API, please take a look here:
https://github.com/apache/mynewt-core/pull/2192

I think it's all pretty well described in the code, but just to give a
quick overview here as well:
- hal_bsp_prov_data_get() is used to retrieve provisioned data with given
identifier
- identifiers are predefined for known data types, custom types (e.g.
BSP-specific) can also be used
- application can register a callback which allows to override data, i.e.
BSP will query application to get some data instead of providing it; not
sure if this is really useful assuming BSP should be already customized for
each product, but perhaps some data may be further customized per-app

So this is all quite simple and I think will be useful for other packages
as well in future.

As always, comments are welcome!

Best,
Andrzej