Re: bt settings - how is it done ?

Johan Hedberg

Hi Jehudi,

On Wed, Jun 13, 2018, laczenJMS wrote:
In the settings part of bt there seems to be a cool way to generate a
list of settings with their set, commit and export handlers. Items are
added to this list by a macro BT_SETTINGS_DEFINE() and all items seem
to be processed based upon linker defined _bt_stettings_start[] and

This is a very nice expandable way to generate bt_settings. I am
however not sure if I completely understand how it works, is there a
place where I can get some more info on how this works ?
The linker section is defined in include/linker/common-rom.ld, and
variables are placed there using the __in_section() specifier (see

I am puzzled by the fact that mesh items are stored under
"/bt/mesh/...", this seems to mean that BT_SETTINGS_DEFINE() inserts
the handlers "under" "/bt".
subsys/bluetooth/host/settings.c registers a settings_handler with the
name "bt", and that's used as the central point to process all
bt_settings handlers, so yes everything is under the "bt/..." path. The
name that's given to BT_SETTINGS_DEFINE() is the first path component
that follows "bt/".


Join to automatically receive all group messages.