Enable System Configuration Controller clock in clock_control
instead of gpio controller when we set a gpio as interrupt.
We use System Configuration Controller to manage external
interrupts and internal voltage reference for 48 MHz HSI
used in USB device.
Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
In STM32L0 series, HSI48 requires VREFINT and its buffer
with 48 MHz RC to be enabled. This patch enables
VREFINT reference for HSI48 oscillator.
Signed-off-by: Ilya Tagunov <tagunil@gmail.com>
Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
USB LL API provides the EP_TYPE_* defines. STM32Cube does not
provide USB LL API for STM32L0 family. Map EP_TYPE_* defines
to PCD_EP_TYPE_* defines.
Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
As this test uses dummy L2 driver, there is no need for ethernet
specific setup as that is not used for anything.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
When creating IPv4 packet, the IPv4 header contained uninitialized
values. This was reported by valgrind.
Conditional jump or move depends on uninitialised value(s)
at 0x8066AB0: calc_chksum (utils.c:386)
by 0x8066C99: calc_chksum_pkt (utils.c:428)
by 0x806710A: net_calc_chksum (utils.c:487)
by 0x8067B8D: net_calc_chksum_icmpv4 (net_private.h:138)
by 0x8067FEC: net_icmpv4_set_chksum (icmpv4.c:90)
by 0x8068E7A: net_icmpv4_send_error (icmpv4.c:338)
by 0x807272F: send_icmp_error (connection.c:773)
by 0x80731A3: net_conn_input (connection.c:992)
by 0x806A34D: net_ipv4_process_pkt (ipv4.c:212)
by 0x805D8B9: process_data (net_core.c:103)
by 0x805D939: processing_data (net_core.c:117)
by 0x805E498: net_rx (net_core.c:300)
Uninitialised value was created by a stack allocation
at 0x804A437: setup_ipv4_tcp (main.c:297)
Conditional jump or move depends on uninitialised value(s)
at 0x8067117: net_calc_chksum (utils.c:489)
by 0x8067B8D: net_calc_chksum_icmpv4 (net_private.h:138)
by 0x8067FEC: net_icmpv4_set_chksum (icmpv4.c:90)
by 0x8068E7A: net_icmpv4_send_error (icmpv4.c:338)
by 0x807272F: send_icmp_error (connection.c:773)
by 0x80731A3: net_conn_input (connection.c:992)
by 0x806A34D: net_ipv4_process_pkt (ipv4.c:212)
by 0x805D8B9: process_data (net_core.c:103)
by 0x805D939: processing_data (net_core.c:117)
by 0x805E498: net_rx (net_core.c:300)
by 0x805E51D: process_rx_packet (net_core.c:312)
by 0x8085E87: work_q_main (work_q.c:39)
Uninitialised value was created by a stack allocation
at 0x804A437: setup_ipv4_tcp (main.c:297)
Fixes#7447
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
The options array was not initialized to 0 and the size of the
array was not set properly. This caused following error in valgrind
Conditional jump or move depends on uninitialised value(s)
at 0x8056777: coap_find_options (coap.c:1096)
by 0x804AEFF: test_parse_simple_pdu (main.c:455)
by 0x80500E6: zephyr_app_main (main.c:1585)
by 0x807E231: bg_thread_main (init.c:254)
by 0x80842D7: _thread_entry (thread.c:201)
by 0x8059618: posix_thread_starter (posix_core.c:301)
by 0x40752C8: start_thread (in /usr/lib/libpthread-2.25.so)
by 0x4182055: clone (in /usr/lib/libc-2.25.so)
Fixes#7447
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
This will lead invalid IPv6 address to be generated. This was seen
in valgrind.
Conditional jump or move depends on uninitialised value(s)
at 0x40371A4: bcmp (vg_replace_strmem.c:1100)
by 0x8058833: net_ipv6_addr_cmp (net_ip.h:542)
by 0x805B999: ipv6_addr_find (net_if.c:768)
by 0x805BC8C: net_if_ipv6_addr_add (net_if.c:846)
by 0x804A7D7: _iface_ip6_add (mgmt.c:271)
by 0x804A5DC: test_core_event (mgmt.c:251)
by 0x804AD1D: test_mgmt (mgmt.c:320)
by 0x807EA81: run_test_functions (ztest.c:56)
by 0x807EC3C: test_cb (ztest.c:196)
by 0x8085AFD: _thread_entry (thread.c:201)
by 0x8051B43: posix_thread_starter (posix_core.c:301)
by 0x40752C8: start_thread (in /usr/lib/libpthread-2.25.so)
Fixes#7447
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
This removes some tricky math to calculate lengths and offsets,
ensuring that, when appending the WebSocket UUID to the handshake
key, the key_accept buffer won't overflow.
Coverity-ID: 183057
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
Rewrite prepare_reply() to reduce unnecessary string copies and calls
to net_pkt_append_all(). Also reduces some of the tricky string length
calculations.
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
This is handier in some ways compared to the symbol reference pages. The
search feature is more flexible, and you get to see which dependencies
are currently unsatisfied.
Signed-off-by: Ulf Magnusson <ulfalizer@gmail.com>
STM32Cube HAL core initialization functions HAL_GetTick()
and HAL_Delay() are implemented in all STM32 series. This
patch moves these functions in file stm32cube_hal.c under
"common" folder to reduce code duplication.
Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
The rx_prio_queue k_fifo object has not been used for anything for a
really long time. The use for it was originally removed by the following
commit:
commit ad475d863a
Author: Szymon Janc <ext.szymon.janc@tieto.com>
Date: Fri Apr 22 11:36:04 2016 +0200
Bluetooth: Remove RX priority fiber
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This patch fixes a coverity issue with the post increment of ni inside
an zassert call. There might be side effects of non-debug builds that
would cause the code to not do the right thing.
Coverity-ID: 185391
Signed-off-by: Andy Gross <andy.gross@linaro.org>
This patch fixes an overrun detected via Coverity. The
lsm6dsl_odr_to_freq_val function takes an index as argument. If the
index is out of bounds, the expected behavior was to return the last
element of an array. The actual behavior was to overrun the array.
Fixes: #7482
Signed-off-by: Andy Gross <andy.gross@linaro.org>
This patch fixes a coverity issue with checking the outcome of a call
to net_if_config_ipv6_get().
Coverity-ID: 183478
Signed-off-by: Andy Gross <andy.gross@linaro.org>
The document talks of settings_handler fields such
as ch_name and ch_set, whereas the actual names
are name, h_set, etc.
Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
This patch fixes a couple of coverity issues pertaining to
uninitialized members of a sigevent structure.
Coverity-ID: 183070
Coverity-ID: 185276
Signed-off-by: Andy Gross <andy.gross@linaro.org>
This patch fixes a coverity issue with dereferencing a null ptr. The
test needs to make sure there is a valid udp hdr before inspecting the
contents.
Coverity-ID: 183484
Coverity-ID: 183480
Signed-off-by: Andy Gross <andy.gross@linaro.org>
This commit gets the following incremental search improvements in from
upstream:
- 1d3db5de9b8c2 ("menuconfig: Add search with multiple search
strings")
This makes a search string like 'foo bar' match all symbol names
that match both 'foo' and 'bar' (which can be regexes), regardless
of the order in which they appear in the match. This is faster and
more flexible than having to type a bunch of '.*'.
- 9bf8fc6e6907e ("menuconfig: Add prompts to incremental search")
This makes the incremental searcher search prompt strings as well as
symbol names.
The prompt is now displayed next to the symbol name in the list of
matches as well.
Signed-off-by: Ulf Magnusson <ulfalizer@gmail.com>
I've collected some of the common issues encountered with doc reviews
into a new contributing document, and included use of the
Zephyr-specific extension for generating code building examples.
Updated conf.py and created an external list of substitutions making it
easier to manage them without editing the sphinx conf file (and
documented this).
Tweaked the comments in the application.py extension python code to
render better in the generated doc that extracts these comments (keeps
the documentation in the python code too to ease maintenance when
updates are made).
Updated the sample template to mention use of this sphinx extension.
fixes: #6831fixes: #6811
Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
The sequence number was acting as a stop-gap for missing persistent
storage. Now that we have the settings support in place it's no longer
needed.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Enable BT_SETTINGS and remove any custom flash access used for the
sequence number. We do settings_load() before bt_mesh_provision() and
use the return value from the latter to identity that settings_load()
had recoved a full configuration.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
The logic for restoring the sequence number was flawed in that it
would not always cause an incremented sequence write upon the
transmission of the first packet. The reason the code didn't work is
that it assumed the stored value was a multiple of SEQ_STORE_RATE,
however since the sequence number is stored in a deferred fashion
that's not always true.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
We can implicitly trust locally originated messages, so there's no
need to burden the RPL with them.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Add support for storing the remaining configuration server model
states (all of which are one byte values). The states are stored under
a single settings key bt/mesh/Cfg.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Add support for storing the heartbeat publication persistently. The
information is only stored as "publish indefinitely" or as "periodic
publishing disabled" since we can't know for how long the node is
powered off. The information is stored under the settings key
bt/mesh/HBPub.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Add support for storing the model publication information
persistently. The addresses are stored under the settings key
bt/mesh/s/<mod id>/pub for SIG models and bt/mesh/v/<mod id>/pub for
vendor models.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
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>