Add support for storing the subscribed group addresses for each model
persistently. The addresses are stored under the settings key
bt/mesh/s/<mod id>/sub for SIG models and bt/mesh/v/<mod id>/sub for
vendor models.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Add support for storing the bound App Keys for each model
persistently. The bindings are stored under the settings key
bt/mesh/s/<mod id>/bind for SIG models and bt/mesh/v/<mod id>/bind for
vendor models.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Keeping the model struct same sized, change the element pointer to two
indexes, and add a flags member that will be used to track pending
storage actions.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
In order not to have a Node Reset consume more stack than other
operations, also perform the related storage writes through the same
delayed work as all other storage updates.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Instead of having an RPL-specific storage timer, introduce a generic
one that'll eventually be used for all persistent storage.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
To reduce stack consumption, and to avoid blocking the CPU during
network activity, prepare for a generic timer that can be used for
most (possibly all) mesh storage values.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
In an effort to reduce the footprint of the LwM2M client, let's
lower the default # of observes handled by the client from 20 to
10.
This saves ~640 bytes of SRAM.
Signed-off-by: Michael Scott <michael@opensourcefoundries.com>
Remove "used" member from observe_node structure and replace by
checking the ctx for non-NULL value.
Signed-off-by: Michael Scott <michael@opensourcefoundries.com>
The slist attr_list doesn't scale well when added to the LwM2M object,
object instance and resource instance structures. The goal of a
robust LwM2M client is to let the user create MANY object instances
and these will have many resource instances each. The amount of SRAM
taken up by the attr_lists will only increase over time, regardless
of the actual # of write attribute structures reserved via the
LWM2M_NUM_ATTR config setting.
Instead, let's remove the slist from these structures and add a
reference pointer to the lwm2m_attr structure. We can use this
reference to create the one to many relationship between the objects,
object instances and resource instances for a much smaller amount of
code and SRAM resources.
The sacrifice for these savings will be a larger # of iterations when
looking up assigned write attributes and matching them to their
references. However, due to the # of write attributes current being
handled, the # of iterations during this process is very manageable.
Example flash and SRAM savings when building for nrf52_blenano2:
Before patch:
Memory region Used Size Region Size %age Used
FLASH: 139532 B 512 KB 26.61%
SRAM: 36576 B 64 KB 55.81%
IDT_LIST: 148 B 2 KB 7.23%
After patch:
Memory region Used Size Region Size %age Used
FLASH: 139284 B 512 KB 26.57%
SRAM: 36000 B 64 KB 54.93%
IDT_LIST: 148 B 2 KB 7.23%
Summary: This patch saves ~248 bytes of flash and ~576 bytes of SRAM
for the typical configuration of LwM2M client in Zephyr.
NOTE: these values will vary by architecture.
Signed-off-by: Michael Scott <michael@opensourcefoundries.com>
When any error is returned from update_attrs() in engine_add_observer()
an EINVAL is returned back to the caller. Let's return whatever error
code was generated in update_attrs() instead.
Also, add handling where previously errors were ignored.
Signed-off-by: Michael Scott <michael@opensourcefoundries.com>
For code clarity, let's move notification_attrs structure to the top
of lwm2m_engine.c. While we're at it, we can re-order it's members
for memory alignment.
NOTE: This patch does not change the current flash or SRAM usage but
further additions to the notification_attrs structure could.
Signed-off-by: Michael Scott <michael@opensourcefoundries.com>
The path member of the object instance and resource instance structures
can easily be removed to save several bytes per instance over the entire
LwM2M subsystem. So let's remove it.
Example savings when building for nrf52_blenano:
SRAM usage before patch: 37952 B
SRAM usage after patch: 36576 B
Signed-off-by: Michael Scott <michael@opensourcefoundries.com>
Let's optimize the order of the following structures to account for
memory alignment:
lwm2m_engine_obj
lwm2m_engine_res_inst
lwm2m_output_context
lwm2m_output_context
Tested building for nrf52_blenano hardware:
SRAM usage before patch: 38240 B
SRAM usage after patch: 37952 B
Signed-off-by: Michael Scott <michael@opensourcefoundries.com>
There are valid use cases where the model layer must know the true
destination address. So far only the fact that it was one of the
addresses that the model subscribes to (its element's unicast
included) has been knowable.
Solve the issue by moving the destination address from the internal
net_rx context to the public bt_mesh_msg_ctx struct.
Fixes#7453
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
New test for check whether deleted item is not copied to the newest
fcb sector during compression procedure.
Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
During the compression an empty settings entry was
copied to the scratch sector form the oldest sector in case
lack of newer entry version in fcb storage.
This doesn't make sense as empty entry and lack of entry has
similar meaning.
Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
Document the gsource (globbing source), rsource (relative source), and
grsource (globbing + relative source) statements.
Also add a separate section that documents Zephyr's non-standard
prefer-later-defaults Kconfig behavior. It was only mentioned in passing
before.
Piggyback: Move the note about .config assignments having no effect on
invisible symbols closer to the beginning of the 'Configuring invisible
Kconfig symbols' section. It makes more sense there.
Signed-off-by: Ulf Magnusson <ulfalizer@gmail.com>
sendto() is one and only caller of send_data(), a function of handful
of lines, and yet send_data() is located a hundred lines away from
it. Such "spaghetti functions" complicate review, debugging, and
refactoring of the IP stack.
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
MPU devices that enforce power-of-two alignment now
specify the size of the buffer used for the newlib heap.
This buffer will be properly aligned and a pointer
exposed in a kernel header, such that it can be added
to a user thread's memory domain configuration if
necessary.
MPU devices that don't have these restrictions allocate
the heap as normal.
In all cases, if an MPU/MMU region needs to be programmed,
the z_newlib_get_heap_bounds() API will return the necessary
information.
Given how precious MPU regions are, no automatic programming
of the MPU is done; applications will need to do this as
needed in their memory domain configurations.
On x86, the x86 MMU-specific code has been moved to arch/x86
using the new z_newlib_get_heap_bounds() API.
Fixes: #6814
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
The horizontal scroll (hscroll) wasn't initialized properly when the
initial (prefilled) contents of an edit box was longer than the edit box
itself (e.g. when saving with a long path in KCONFIG_CONFIG). Things
snapped back into place once a key was pressed.
Properly initialize hscroll to fix the initial rendering.
Signed-off-by: Ulf Magnusson <ulfalizer@gmail.com>
It's highly unlikely that snprintk() will return a negative value, but
that's a possibility that will make the `pos` variable be set to a
value outside the boundaries of the statically allocated `buf` array.
Also clamp writes to ensure that the statically allocated buffer won't
be overwritten with a large token length.
Fixes#7070.
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
This patch restricts the stack sentinel to only be allowed if the
USERSPACE configuration option is not set. The stack sentinel feature
is redundant if used in conjunction with the USERSPACE, due to the
protection mechanisms in place for stacks.
Signed-off-by: Andy Gross <andy.gross@linaro.org>
Adds dts bindings for the mcr20a wireless transceiver. The frdm_k64f
board supports the mcr20a via an Arduino shield, therefore the dts node
is added to the board dts. The kw2xd is a SiP and thus the mcr20a dts
node is added to the soc dts.
The networking samples using prj_frdm_k64f_mcr20a.conf have been broken
since the refactoring of the mcux gpio driver to dts in commit
4e8f29f319. The sample is now fixed.
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
Configures the frdm_kw41z board to mux spi signals on pins PTC16-19.
Updates the board document to reflect that spi is supported on these
pins.
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
The kw40z and kw41z socs have the same dspi peripheral as the k64 and
kw2xd, so we can reuse the existing mcux dspi shim driver.
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
Refactors the mcux dspi shim driver to use the clock control interface
instead of calling CLOCK_GetFreq() directly. With this change, we are
now getting all soc-specific information from device tree and can remove
the direct dependency on soc.h.
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
Adds dts spi bindings for the kinetis dspi controller, and updates the
k64, kw2xd, kw40z, kw41z dts nodes accordingly.
Updates the dts interrupt priorities to match the board defconfigs
(e.g., boards/arm/frdm_k64f/Kconfig.defconfig)
For k64, fixes an error in the spi1 interrupt number and adds a third
instance (spi2).
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
Spi configs like irq priority and device name should not exist if the
spi driver supports device tree. Fixes a few configs that were missing
the necessary "depends on !HAS_DTS_SPI".
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
Some spi instance configs were wrapped with ifdefs, while others used
depends. Make them consistent by wrapping them all with ifdefs.
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
Adds dts bindings for the fxas21002 interrupt pins to all boards that
have this sensor.
The fxas21002 driver is currently only aware of one sensor interrupt
pin, therefore the routing of INT1 or INT2 to the driver is handled in
each board's dts.fixup.
The fxas21002 sample application has been broken since the refactoring
of the mcux gpio driver to dts in commit
4e8f29f319. The sample is now fixed.
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
Adds dts bindings for the fxos8700 interrupt pins to all boards that
have this sensor. The frdm_k64f and hexiwear_k64 connect both sensor
interrupt pins to the mcu, but the frdm_kw41z connects only one.
The fxos8700 driver is currently only aware of one sensor interrupt pin,
therefore the routing of INT1 or INT2 to the driver is handled in each
board's dts.fixup.
The fxos8700 sample application has been broken since the refactoring of
the mcux gpio driver to dts in commit
4e8f29f319. The sample is now fixed.
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
Add a set of Kconfig symbols that allow us to set that the GPIO
driver/SoC support DTS (HAS_DTS_GPIO) and that drivers that need/use
GPIO support DTS as well (HAS_DTS_GPIO_DEVICE).
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
There are certain use cases where the application needs to be able to
explicitly set a specific identity address. This was previously
possible using the bt_storage API, however now that it's gone another
solution is needed.
This patch adds a ne bt_set_id_addr() API which the application can
use to set a specific identity address before calling bt_enable().
Fixes#7434
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Add cs, irq and reset gpios description in spbtle controller
node and use generated defines instead of Kconfig symbols.
Define a bt alias to allow generation of defines with friendly
names.
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
In order to generate GPIO definition for control pin of BlueNRG module
define reset-gpio and irq-gpio in st,spbtle-rf yaml binding.
Add HAS_DTS_SPI_PINS kconfig symbol to control use of the '#define'
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
Now that we can generate gpio info from dts lets add optional support
fot the cs-gpios property in the bus controller node. This matches the
binding spec from Linux on how cs-gpios are handled.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
With recent dts script change we dropped _0 from define names if there
is only a single one. So for the MPU we need to use
CONFIG_SRAM_BASE_ADDRESS instead of CONFIG_SRAM_BASE_ADDRESS_0.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
When we included SoC specific Kconfig files we do something like:
gsource "arch/arm/soc/arm/*/Kconfig.soc"
However, we should do that inside an if block for that SoC family so as
to limit SoC family specific options to only being visible when that SoC
family is selected. So we simply move the gsource and related items
inside the if SOC_FAMILY_<SOC> block.
Fixes: #7452
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
In order to disable the execution of code from the RAM region
we need to declare it in arm_mpu_regions.c file.
Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
In dts.fixup files for used for NXP SoCs, IP clock name was
bound to SIM clock label. This is correct but would require
manual change if IP clock controller was changed in device tree.
Use reference to IP generated define "_CLOCK_CONTROLLER" to get
this value.
Besides, having all IP related values starting with the same prefix
will be easier for possible macro preprocessing (if required one day).
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
'cell_string' yaml attribute has been introduced in order to
help enforcement of specific string during defines generation.
This adds complexity in understanding script behavior as a black
box and create additional dependency which is not strictly required.
For node specific generation functions (pinctrl and interrupts),
this could be replaced directly by an hardcoded version
(as everyone used the same 'cell_string' anyway).
For extract_cells functions, string could be replaced by extracted
property name. As a consequence, we're now able to generate defines
for properties refering to these controllers via phandle.
For instance, in following node
spbtle-rf@0 {
compatible = "st,spbtle-rf";
reg = <0>;
reset-gpios = <&gpioa 8 0>;
};
We'll be able to generate:
#define ST_STM32_SPI_...LE_RF_0_RESET_GPIOS_CONTROLLER "GPIOA"
#define ST_STM32_SPI_...PBTLE_RF_0_RESET_GPIOS_FLAGS_0 0
#define ST_STM32_SPI_..._SPBTLE_RF_0_RESET_GPIOS_PIN_0 8
Only impact for this whole change is for NXP clocks which were the
only ones using 'cell_string' attribute with a value different than
the default one.
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>