Commit graph

42829 commits

Author SHA1 Message Date
Andrew Boie
7d920ba39b drivers: use K_KERNEL_STACK macros
None of these threads run in user mode and we can save some
memory.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-08-04 12:16:43 -04:00
Corentin Dorothée
37aca482e9 samples: hci_spi: Fix cmd_hdr and acl_hdr usage
Fixes #27266.
cmd_hdr and acl_hdr local structs were read but never written.
Causing unpredictable errors in bt_tx_thread such as :
"Invalid HCI CMD packet length" in hci.c:2280
or Imprecise data bus errors on nrf52810.

cmd_hdr and acl_hdr are now filled with the received data
from SPI Master.

Signed-off-by: Corentin Dorothée <corentin.dorothee@gmail.com>
2020-08-04 17:53:18 +02:00
Simon Glass
6b50f643da drivers: i2c: Add a dump routine
Add a function to dump out a set of I2C messages. It uses debug logging
so it only useful for debugging.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-08-04 17:50:39 +02:00
Daniel Leung
cae8bd7408 sys: util: cast input of KB() to size_t for large number
Numbers in C macros are treated as signed integer. This causes
issues when using macro KB(x). If the result is larger than
(2^31 - 1), it is treated as a negative number downstream.
For example, the RAM size of up_squared is 2GB. The result of
KB(CONFIG_SRAM_SIZE) should be 2147483648, but due to being
casted as signed, the result is instead -2147483648. Any
calculations using this would be incorrectly. Fix it by
casting x in KB(x) to size_t first.

Fixes #27164

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2020-08-04 17:45:22 +02:00
Joakim Andersson
f327ed2fb9 kernel: Add note regarding safe use of the k_work_pending return value
Add note regarding safe use of the k_work_pending return value. Similar
to the note for k_delayed_work_pending.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-08-04 17:32:56 +02:00
Joakim Andersson
ea9590448d kernel: Add k_delayed_work_pending to check if work has been submitted
Add k_delayed_work_pending similar to k_work_pending to check if the
delayed work item has been submitted but not yet completed.
This would compliment the API since using k_work_pending or
k_delayed_work_remaining_get is not enough to check this condition.
This is because the timeout could have run out, but the timeout handler
not yet processed and put the work into the workqueue.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-08-04 17:32:56 +02:00
Jui-Chou Chung
ed642dcd24 drivers: spi: nrfx: Update get_nrf_spim_frequency for nRF5340 HS-SPI
Using SPIM_FREQUENCY_FREQUENCY_M32 to check if the device has HS-SPI and
able to use higher SPI clock than 8MHz.

Signed-off-by: Jui-Chou Chung <jui-chou.chung@nordicsemi.no>
2020-08-04 17:24:41 +02:00
Andrew Boie
8da93b136c logging: use kernel stack
The logging thread runs in supervisor mode.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-08-04 09:45:50 -05:00
Andrew Boie
1452ca4edc mgmt: use kernel stack
This doesn't run in user mode, save some memory if
userspace is enabled.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-08-04 09:44:37 -05:00
Robert Lubos
ab9f8bac28 net: lwm2m: Update lifetime on Register Update event
The LwM2M server might modify the lifetime value while the device is
registered, hence it's needed to obtain the value directly from the
Server object instance, before each Register Update.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2020-08-04 16:29:40 +02:00
Robert Lubos
b9caaf217e net: lwm2m: Fix Security and Server object instance matching
A proper way to match a Security object instance with a Server object
instance is via Short Server ID resource. Both coupled object instances
should carry the same value of this resource in order to me considered
matched.

This was not implemented in the LwM2M library and it was incorrectly
assumed that the Security object instance index corresponds to the
Server object instance index. While such apporach works is simple
scenario, it might yield incorrect results when bootstrap is used.

Fix this, by verifyng the Short Server ID resource in the Secuirty
instance used, and finding a matching Server instance. The server object
instance is stored for future use in the engine.

Additionally, remove an extra Server object instance that was created
when the bootstrap procedure was used. Since the boostrap Security
object instance does not have the corresponding Server object, it's
enough to have a single Server instance.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2020-08-04 16:29:40 +02:00
Jeremy LOCHE
74fa8cef21 drivers: bluetooth: hci_spi: add missing gpio_dt_flags to spi_cs_config
Fixes #27280 by adding the new gpio_dt_flags to the
HCI spi cs config.

Signed-off-by: Jeremy LOCHE <lochejeremy@gmail.com>
2020-08-04 16:18:54 +02:00
Jukka Rissanen
9e8c1b0bbf net: tcp2: Verify that options are read correctly
Remove the static buffer for TCP options. Make sure that the
options were read properly to temp buffer.

Fixes: #25729
Coverity-CID: 210056

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-08-04 16:18:18 +02:00
Marcin Niestroj
5b12c23b44 mgmt: smp: shell: remove useless data->end member
Value of this member was never assigned, so it was always 0. Remove it
to simplify code a little bit.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-08-04 16:18:06 +02:00
Martí Bolívar
5be0d00d41 treewide: remove unnecessary DT GPIO/PWM flags checks
Now that the relevant APIs generalize properly for bindings without
flags, we can remove some special case checks from the tree.

I couldn't find any more, but I did this kind of quickly, so it's
possible I missed some.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-08-04 07:35:26 -05:00
Martí Bolívar
c981323839 devicetree: pwms: make flags default to 0
Just as was done for GPIO flags, make PWM flag accessors default to 0
when there are no flags. This makes the API easier to use correctly.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-08-04 07:35:26 -05:00
Martí Bolívar
884d6e6941 devicetree: gpio: make flags default to 0
The vast majority of devicetree bindings for GPIO controllers are
expected to have "flags" cells in their respective GPIO specifiers,
but that's not required by the specification and we want to make sure
to support that.

However, so many drivers and applications initialize gpio_dt_flags_t
values that it's silly to require each and every one of them to check
for the flags value and fall back to the sensible default flags value
of 0 when it does not exist.

Make the API easier to use correctly by returning 0 in the devicetree
core API for accessing flags, whenever there are no flags defined.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-08-04 07:35:26 -05:00
Martí Bolívar
922b469fd4 devicetree: add accessors with default values
Add a variety of property and specifier cell accessors that fall back
on a default value supplied by the caller if the devicetree does not
contain the requested data.

This is useful for avoiding use of COND_CODE_1() and similarly tricky
macros in applications and drivers.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-08-04 07:35:26 -05:00
Martí Bolívar
fd7447522d tests: devicetree: cleanup / refactor
Move some common macros shared between different unit test functions
up to the top of the file to make them easier to spot and keep them a
bit tidier.

This cleanup excludes macros that are only used for specific purposes
in a single function.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-08-04 07:35:26 -05:00
Martí Bolívar
a5582fbaf4 devicetree: reorder instance property macros
Reorder the instance number property access macros. The non-instance
number ones appear in this order: DT_PROP(), DT_PROP_LEN(),
DT_PROP_HAS_IDX(), DT_PROP_BY_IDX(), DT_LABEL().

Improves readability slightly by moving code around so INST versions
appear in the same order as non-INST versions.

No functional changes expected.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-08-04 07:35:26 -05:00
chao an
5328adcff5 Bluetooth: Mesh: Fix tx seg buffer with NULL pointer reference
Fix tx seg buffer with NULL pointer reference if enable mesh friendly

Signed-off-by: chao an <anchao@xiaomi.com>
2020-08-04 12:47:05 +03:00
Luiz Augusto von Dentz
6c7a387e9f Bluetooth: ATT: Fix handling to EATT channels
EATT channels use bt_l2cap_chan_send which does return the number of
bytes sent on success not 0 as bt_l2cap_send.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2020-08-04 10:38:27 +03:00
Øyvind Rønningstad
f72aef15d2 sanitycheck: Make --hardware-map and --west-flash together
When passing a using --hardware-map, sanitycheck would ignore extra
args passed via --west-flash, such as --west-flash="--erase".

This is because the command with the extra args was overwritten by the
command with the runner info from the hardware map.

This patch merges those code paths so they are aware of each other and
of --west-runner.

Signed-off-by: Øyvind Rønningstad <oyvind.ronningstad@nordicsemi.no>
2020-08-03 20:40:50 -04:00
Maciej Perkowski
e7f4074799 sanitycheck: Modify expected_subcases
Before sanitycehck was removing all `test_` chars in test cases'
names. This test has to be modify to work with the improved behavior

Signed-off-by: Maciej Perkowski <Maciej.Perkowski@nordicsemi.no>
2020-08-03 19:46:15 -04:00
Maciej Perkowski
034d4f2156 sanitycheck: Fix test cases names
This commit limits the removal of `test_` from test case name
to only the first occurance. There are test cases with `test_`
also in the middle of their names and removing it couses mismatches
between extracted testcases and the names obtained when passing

Signed-off-by: Maciej Perkowski <Maciej.Perkowski@nordicsemi.no>
2020-08-03 19:46:15 -04:00
Gerson Fernando Budke
70ff1d73c4 samples: updatehub: Move from net to subsys:mgmt folder
Zephyr introduced subsys/mgmt folder for MCU management. Move UpdateHub
sample to its correspondent folder at sample/subsys/mgmt folder.

Signed-off-by: Gerson Fernando Budke <gerson.budke@ossystems.com.br>
2020-08-03 16:33:06 +02:00
Gerson Fernando Budke
29544a1ceb updatehub: Move from lib to subsys:mgmt folder
Zephyr introduced subsys/mgmt folder for MCU management. Move UpdateHub
to this newly and dedicated space.

Signed-off-by: Gerson Fernando Budke <gerson.budke@ossystems.com.br>
2020-08-03 16:33:06 +02:00
Maureen Helm
6364338815 boards: arm: Fix incorrect Kconfig dependencies for FXAS21002_DRDY_INT1
The fxas21002 sensor driver defines the Kconfig symbol
FXAS21002_DRDY_INT1 to depend on FXAS21002_TRIGGER, but the warp7_m4
board defconfig was incorrectly overriding it to depend on FXAS21002.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2020-08-03 13:52:24 +02:00
Maureen Helm
700d08e0f5 boards: arm: Fix incorrect Kconfig dependencies for FXOS8700_DRDY_INT1
The fxos8700 sensor driver defines the Kconfig symbol FXOS8700_DRDY_INT1
to depend on FXOS8700_TRIGGER, but several board defconfigs were
incorrectly overriding it to depend on FXOS8700.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2020-08-03 13:52:24 +02:00
Alexandre Bourdiol
2f6beb31d4 boards: arm: nucleo_g474re: add device tree rng okay
Tested with tests/drivers/entropy

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2020-08-03 13:52:04 +02:00
Maureen Helm
22b512ef0e boards: arm: Fix broken link in lpcxpresso55s16 board doc
Fixes a broken link to the lpc55s16 soc user manual.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2020-08-03 13:51:42 +02:00
Mahesh Mahadevan
59b045e6a4 MXRT600: Update defconfig SYS_CLOCK value
The power API for this platform is available in binary form
which cannot be included inside Zephyr. This platform is running
at the slower default speed till we have a way to call the power
API's to raise the core voltages.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2020-08-03 13:50:32 +02:00
chao an
9e64d379f0 Bluetooth: Mesh: configurable advertiser stack size
Add a configurable Kconfig option for advertiser thread stack size

Change-Id: Ia59a03311706de929d1833fa46cff66652620e7a
Signed-off-by: chao an <anchao@xiaomi.com>
2020-08-03 13:50:21 +02:00
Rihards Skuja
4a16095e8a drivers: sensor: nrf5: only assert on errors
After changes made in ff089217cb, clock control release can now return
non-negative values on success.

Signed-off-by: Rihards Skuja <rihardssk@mikrotik.com>
2020-08-03 13:50:08 +02:00
Krzysztof Chruscinski
e4d14e8516 drivers: serial: nrf_uart: Improve detection of late uart_rx_buf_rsp
Removed potential race condition between uart being disabled and
rx_buf_rsp call.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2020-08-03 13:49:57 +02:00
Krzysztof Chruscinski
b5c6e2f263 drivers: serial: nrf_uarte: Detect late uart_rx_buf_rsp call
Added detection of uart_rx_buf_rsp call which happend to late when
uart is already disabled.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2020-08-03 13:49:57 +02:00
Krzysztof Chruscinski
2891256b67 drivers: serial: Add error code to uart_rx_buf_rsp
API did not cover a case when uart_rx_buf_rsp is called when receiver
is already disabled. It may happen if uart_rx_buf_rsp is called too
late and active transfer is already finished. In that case -EACCES is
returned.

Some implementations already returned that error in that case.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2020-08-03 13:49:57 +02:00
Andrei Emeltchenko
fb44188ebb west: sign: Move imgtool specific docs to appropriate place
Move documentation specific to imgtool to appropriate place.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2020-08-03 13:49:17 +02:00
Andrei Emeltchenko
51182ab881 west: sign: Add rimage signing tool documentation
Add documentation specific to rimage signing tool.

Fixes #26596

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2020-08-03 13:49:17 +02:00
Andrew Boie
8b531aa996 canbus: use kernel stacks
These threads don't run in user mode, save some memory
if userspace is enabled.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-08-02 10:50:12 -04:00
Marcin Niestroj
4137d3380f net: ppp: select RING_BUFFER via Kconfig
PPP implementation uses ring_buffer API, but RING_BUFFER Kconfig option
was not selected so far. This resulted in linker errors about undefined
reference to `ring_buf_get_claim' and 'ring_buf_put'.

Add missing RING_BUFFER selection via Kconfig, so PPP driver is properly
built.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-08-01 08:13:50 -04:00
Andrew Boie
c0d3ed0d1c net: use kernel stacks
These threads don't run in user mode, save some memory if
userspace is enabled.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-08-01 08:13:15 -04:00
Andrew Boie
5a137998bf shell: SHELL_DEFINE() create kernel stacks
These shell threads run in supervisor mode.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-08-01 08:12:47 -04:00
Andrew Boie
99c211dbc6 shell: fix irq stack extern declaration
This is a kernel stack now.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-08-01 08:12:47 -04:00
Carles Cufi
244f826e3c cmake: remove _if_kconfig() functions
This set of functions seem to be there just because of historical
reasons, stemming from Kbuild. They are non-obvious and prone to errors,
so remove them in favor of the `_ifdef()` ones with an explicit
`CONFIG_` condition.

Script used:

git grep -l _if_kconfig | xargs sed -E -i
"s/_if_kconfig\(\s*(\w*)/_ifdef(CONFIG_\U\1\E \1/g"

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-08-01 12:35:20 +02:00
Vinayak Kariappa Chettimada
dc48999ee1 Bluetooth: controller: Fill event counter in sync info
Fill the referenced event counter of the Periodic
Advertising SYNC_IND PDU into the sync info struct in the
Common Extended Advertising Header Format.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-07-31 19:04:23 +02:00
Jordan Yates
8896da1d60 drivers: serial: uart_nrfx_uarte: init cleanup rx
When `CONFIG_UART_ASYNC_API` is enabled, cleanup any pending synchronous
receptions at initialization time. Pending receptions are present when
this driver is used with the default mcuboot application.

When `CONFIG_UART_ASYNC_API` is not enabled, RX is always enabled by
this driver. As mcuboot does not use the async API, and does not cleanup
the UART driver before jumping to the next application, that application
boots with RX still enabled. This results in a 500uA increase in current
consumption.

Fixes #26555

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2020-07-31 18:47:55 +02:00
Carles Cufi
6b9ea24b1d manifest: Update MCUBoot revision
Commit 135b5ce860 was mistakenly merged with a reference to a Pull
Request instead of a SHA. Correct this so that it references a real SHA.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-07-31 18:32:44 +02:00
Jukka Rissanen
dea5b74a2c net: Separate net_pkt priority from traffic class
User can always set the network packet priority as it is not
related to traffic class.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-07-31 18:11:51 +02:00
Alexandre Bourdiol
8978071334 STM32H7: manage Dual core boot whatever option bytes configuration
Manage Dual core boot automatically whatever Option Bytes
configuration.
No more need of KConfig STM32H7_DUAL_CORE_BOOT to match
Option Bytes.

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2020-07-31 11:09:18 -05:00