Commit graph

56486 commits

Author SHA1 Message Date
Christopher Friedt
86ad71827c release: Zephyr 2.7.0-rc3
Set version to 2.7.0-rc3

Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>
2021-09-27 13:51:03 -04:00
Joakim Andersson
dd0bf5c20b Bluetooth: shell: Log failure to register authentication handlers
Log failure to register authentication handlers since returning errors
from the shell is not visible to the user.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2021-09-27 19:47:50 +02:00
Joakim Andersson
0207e86e38 Bluetooth: shell: Handle return value of GATT service register functions
Handle return value of GATT service register and unregister functions.
Log action to shell.

Fixes: #38013

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2021-09-27 19:47:50 +02:00
Yuguo Zou
5b590faab5 tests: threads: fix kernel/thread_stack test
Fix the broken logic in the kernel/thread_stack test
The modified test should do direct read & write from estimated stack
pointer to highest address in the stack buffer.
Previously this test was start from lowest address in the stack
which would trigger exception of hardware stack checking scheme
violation on ARC boards and other targets with hardware stack
overflow detection.

Signed-off-by: Yuguo Zou <yuguo.zou@synopsys.com>
2021-09-27 12:25:12 -04:00
Robert Lubos
eca98e37d4 samples: net: coap_server: Finetune sample parameters
Finetune coap_server sample parameters for better user experience.

Reduce the maximum retransmission count to release resources earilier in
case client is unreachable and no longer responds. Increase the maximum
number of pending retransmissions, along with the heap size (the buffers
for messages are allocated on a heap), to improve sample responsiveness,
in case multiple unreplied messages are pending retransmission.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2021-09-27 11:36:15 -04:00
Robert Lubos
15ba020343 samples: net: coap_server: Remove observer on notification timeout
In case no reply is received for notification message, remove the
corresponsding observer since it's no longer reachable, freeing slot for
another one.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2021-09-27 11:36:15 -04:00
Robert Lubos
33677ef383 samples: net: coap_server: Fix retransmission mechanism
The retransmission handler only increased the retransmission count, w/o
sending the actual message again. Additionally, the next retransmission
time calculation was broken - it did not take into consideration the
time that has already passed since before retransmission, and re-applied
the entire timeout value.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2021-09-27 11:36:15 -04:00
Erwan Gouriou
2e4eb781f9 tests/lib/cmsis_dsp: matrix: Limit f16 tc execution on ram => 144
binary_f16 and binary_f16.fpu test cases fail when target
SRAM size is below 140k.
Update test case requirements to set min_ram to 144.

Additionally, remove the platform_exclude hich is now useless
(frdm_kw41z ram is 128k).

Fixes #38826

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-09-27 11:35:43 -04:00
Joakim Andersson
b08e5725ef Bluetooth: host: check return value of bt_rand when creating identities
Check the return value of bt_rand when creating identities.
Failure to generate a random IRK would result in the privacy feature
being compromised.

Fixes: #38120

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2021-09-27 17:14:20 +02:00
Joakim Andersson
884ebbbb9e Bluetooth: host: Fix unexpected control flow
Fix unexpected control flow in host keys module. A continue in a do
while false act the same as a break. This entire construct can be
replaced with a simple if else control flow.

Fixes: #38014

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2021-09-27 16:35:54 +02:00
Joakim Andersson
3a8190a194 Bluetooth: SDP: Check len is not zero before accessing data pointer
Check len is not zero before accessing data pointer, the len variable
is not checked before this point so cannot be trusted to not be zero.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2021-09-27 16:34:22 +02:00
Robert Lubos
7abc68d432 doc: net: Remove obsolete note about sockets thread-safety status
The socket API was updated with mutex protection, however this
was not reflected in the documentation. Remove the obsolete note on the
thread-safety status of the socket API, to prevent confusion.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2021-09-27 10:25:59 -04:00
Meng xianglin
10232b536e test: logging: improve test coverage for logging subsystem
Add some test point in existing test cases. Add some test
cases for usersapce.

Signed-off-by: Meng xianglin <xianglinx.meng@intel.com>
2021-09-27 10:19:49 -04:00
Krzysztof Chruscinski
905c430753 tests: lib: cbprintf_package: Fix coverity issue
Ensure that length variables (len0, len1, len2) are positive
before they are used for array indexing.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-09-27 10:15:51 -04:00
Krzysztof Chruscinski
b942aabe69 logging: Fixing coverity issue
Add casting to fix coverity report.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-09-27 10:15:51 -04:00
Christoffer Zakrisson
2ec4986d57 drivers: i2c: sam0: Continue write/read if next message allows it
Update sam0 i2c driver to directly send/receive next message if it is
in the same direction and the current message has no stop or restart
flags. Seems like in some drivers this is the expected behaviour.

Fixes #36857

Signed-off-by: Christoffer Zakrisson <rustypig91@gmail.com>
2021-09-27 10:13:19 -04:00
Jamie McCrae
285a0737a3 Bluetooth: host: Fix non-extended adverts not being limited to 31 bytes
Fixes an issue whereby the application is configured for extended
advertising mode but advertises in legacy mode with a large device name
which should be limited to 31 bytes

Signed-off-by: Jamie McCrae <jamie.mccrae@lairdconnect.com>
2021-09-27 10:10:00 -04:00
Emil Gydesen
439c5ce6de Bluetooth: ISO: Remove duplicate struct bt_iso_chan declaration
The struct was declared twice (once as an opaque type) in
iso.h, but was unneeded. Removed to avoid confusion about
whether it is an opaque type.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-09-27 10:09:37 -04:00
Krzysztof Chruscinski
581c20e242 drivers: uart: Cleanup not supported API handling
Fixed discrepancy between documentation and actual returned
error code when API is not enabled or not supported by a
device. Added detection of case when device does not implement
uart_callback_set but ASYNC api is enabled. Returning -ENOSYS in
that case.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-09-27 10:08:28 -04:00
Gerard Marull-Paretas
b4b1212c21 doc: release notes: add details on device PM changes
Add some details on the changes made in the device power management area
(callback simplification).

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-09-27 10:07:26 -04:00
Gerard Marull-Paretas
f647a5c8ec drivers: display: st7789v: remove incorrect error check
The st7789v_transmit function does not return any error code (void), so
ret = st7789v_transmit(...) is wrong.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-09-27 08:24:21 -04:00
Joakim Andersson
05755df9c1 Bluetooth: host: Ignore return value of change-aware when reading DBhash
Ignore the return value of the bt_gatt_change_aware function when the
client is reading the database hash characteristic value. This is the
point where the client becomes change-aware, so nothing else should be
done if the client is change-unaware.

Fixes: #38012

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2021-09-27 08:23:17 -04:00
Szymon Janc
6440c9eb51 bluetooth: host: Fix legacy SMP pairing
This is a regression introduced in b8770acc28 when
aligning with BT Core Spec 5.3 naming convention.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2021-09-27 08:13:48 -04:00
Gerson Fernando Budke
a60ce93042 doc: release: 2.7: Add note about risc-v
Add risc-v general notes related to cpu bindings and ITCM/DTCM cache
linker support.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2021-09-26 21:46:28 -04:00
Gerson Fernando Budke
607e2cbae4 doc: release: 2.7: Add note about modem
Added modem gsm_ppp changes.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2021-09-26 21:46:28 -04:00
Gerson Fernando Budke
e142f4d908 doc: release: 2.7: Add note about west openocd runner
Added OpenOCD note related to zephyr thread awareness.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2021-09-26 21:46:28 -04:00
Gerson Fernando Budke
cda4eebdf0 doc: release: 2.7: Add notes about Atmel related changes
Add 2.7.0 release notes for Atmel SoCs, drivers and boards.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2021-09-26 21:46:28 -04:00
Gerson Fernando Budke
b54e7bfe0d doc: release: 2.7: Add notes about Cypress related changes
Add 2.7.0 release notes for Cypress SoCs and board.

Signed-off-by: Gerson Fernando Budke <gerson.budke@atl-electronics.com>
2021-09-26 21:46:28 -04:00
Vinayak Kariappa Chettimada
3adffa01ab Bluetooth: Fix minor conditional compile related comment
Fix minor conditional compile related comment.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-09-25 17:37:00 -04:00
Lauren Murphy
7ab16c457b doc: update coding guidelines compliance stages
Updates wording in Coding Guidelines page to remove outdated timelines
and correct the criteria for each stage. Changes reflect that we are
in stage 1 and will not reach stage 2 until the CI for enforcing
coding guidelines has been established.

Signed-off-by: Lauren Murphy <lauren.murphy@intel.com>
2021-09-24 17:14:48 -04:00
Alexandre Mergnat
05f205066b copyright: add missing license
Solderpad Hardware License

Signed-off-by: Alexandre Mergnat <amergnat@baylibre.com>
2021-09-24 17:07:37 -04:00
Xabier Marquiegui
3566cf11ba drivers: eth: e1000: only enable e1000 clock on e1000 configured
e1000 clock should only be enabled by default if e1000 driver is
configured

Signed-off-by: Xabier Marquiegui <xmarquiegui@ainguraiiot.com>
2021-09-24 17:05:11 -04:00
Torsten Rasmussen
734e52899a cmake: linker: arm: utilize zephyr_linker_group(... SYMBOL SECTION)
The root cause of #38591 was region symbols being placed before the
section description for data region.

To support both schemes with the linker generator, a new
`SYMBOL SECTION` argument has been added to the zephyr_linker_group()
function.

This commit updates the arm/linker.cmake CMake linker file to use the
new `SYMBOL SECTION` argument for the data region group and text region
group so that those two groups now behave identical to the behavior when
using the cortex_m linker.ld template.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2021-09-24 15:13:13 -04:00
Torsten Rasmussen
57ab0342d3 cmake: linker generator: group symbol from section
The root cause of #38591 was region symbols being placed before the
section description for data region.

Some region start symbols are placed before section description, other
region start symbols are placed inside the first section in the region
and thus identical to the sections own first symbol.

To support both schemes with the linker generator, a new
`SYMBOL SECTION` argument has been added to the zephyr_linker_group()
function.

The ld_script.cmake linker script generator has been updated to support
the new argument so that generated ld linker script has identical
behavior to the templated ld linker scripts.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2021-09-24 15:13:13 -04:00
Torsten Rasmussen
15e834a687 linker: __data_region_start equal to __data_start
Fixes: #38591, #38207, #37861

The commit 65a2de84a9 aligned the data
linker symbol for sections and regions.

The data region symbol start has been placed outside the sections thus
being defined as the address of the region before alignment of the first
section in the data region, usually the `datas` section.

The symbol defining the start address of the data section is after
section alignment.
In most cases the address of the data region start and datas section
start will be identical, but not always.
The data region symbol is a new linker symbol and existing code has
been depending on the old data section start symbol.
Thus, the update to the use of the data region start symbol instead of
data ram start symbol thus results in a different address when the
section is aligned to a different address.

To ensure the original behavior in all cases, the data region start
address is now moved inside the data section.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2021-09-24 15:13:13 -04:00
Aurelien Jarno
18c9dfdd8f soc: arm: stm32lx: fix using MSI as wake-up clock source
Following the migration of the clock source configuration in DTS (commit
2691541ad2), HSI is always used as wake-up source on STM32LX. It is
reconfigured as MSI just after, but it slightly increase the wake-up
time and power consumption.

It happens as the file defining STM32_SYSCLK_SRC_MSI is not included.
Fix that.

Fixes #38807

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2021-09-24 14:09:15 -04:00
Steven Lemaire
2aa0bb2422 drivers: i2c: gecko: fix typo of the BUILD_ASSERT
In the macro I2C_VALIDATE_LOC, there was a typo preventing the
compilation.

Signed-off-by: Steven Lemaire <steven.lemaire@zii.aero>
2021-09-24 14:08:42 -04:00
Ryan Erickson
1715e39414 modem: hl7800: separate IO interrupt config
The interrupt config flags for an IO should be separate
from the standard IO configs because the interrupt config
is a separate API.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2021-09-24 11:30:37 -04:00
Piotr Pryga
2637c0ed22 Bluetooth: controller: Fix compilation error due to missing includes
When CONFIG_ARM_MPU is explicitly unset in application prj.conf there
were build warnings related with implicit declarations of following
symbols: NRF_DT_GPIOS_TO_PSEL, __WFE, __SEV.
Lack of NRF_DT_GPIOS_TO_PSEL lead to build error due to undeclared
dfegpio0_gpios symbol.

The cause for the warnings and error were missing soc.h includes in
few source files. The missing includes were added in this commit.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2021-09-24 09:20:38 -04:00
Henrik Brix Andersen
8b8fed9044 MAINTAINERS: add myself as riscv collaborator
Add myself as collaborator for RISC-V architecture related code.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2021-09-24 08:27:56 -04:00
Stephanos Ioannidis
0ae9f5a626 cmake: Set minimum required Zephyr SDK version to 0.13.1
This commit sets the minimum required Zephyr SDK version to 0.13.1,
which fixes the following critical issues:

1. Xtensa initial malloc failure (GitHub issue #38258)
2. ARMv8-M security extension vulnerability (CVE-2021-35465)

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2021-09-24 07:35:40 -04:00
Stephanos Ioannidis
04e67e2593 Revert "lib: newlib: Add workaround for #38258"
The commit 9bd1483afeb18f4225ec7b0340b0d4e20efb7d01 was added as a
workaround for the Xtensa initial malloc failure bug.

This bug has been fixed in the Zephyr SDK 0.13.1 release and therefore
this workaround is no longer needed.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2021-09-24 07:35:40 -04:00
Krzysztof Chruscinski
8e66894d4e drivers: regulator: Fix k_work_schedule return code handling
k_work_schedule may return other non-negative value than 0.
When driver was adapted to the new k_work API that was not
taken into account.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-09-24 06:36:50 -04:00
Carles Cufi
611284021c doc: relnotes: Add a comment to the Bluetooth 2.6 release notes
The Zephyr 2.6 release notes, in the Bluetooth section, refers the user
to a commit message which had a couple of typos in it. Clarify this in
the very release notes.

Fixes #36692.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2021-09-23 13:26:19 -04:00
Florian Vaussard
52638a000f net: ipv6_fragment: send ICMPv6 Time Exceeded upon reassembly timeout
RFC 2460 Sec. 5 requires that a ICMPv6 Time Exceeded message is sent
upon reassembly timeout, if we received the first fragment (i.e. the one
with a Fragment Offset of zero).

Implement this requirement.

Signed-off-by: Florian Vaussard <florian.vaussard@gmail.com>
2021-09-23 13:21:09 -04:00
Florian Vaussard
c66b4288e0 net: ipv6_fragment: fix shift_packets() algorithm
The purpose of shift_packets() is to make room to insert one fragment in
the list. This is not what it does currently, potentially leading to
-ENOMEM even if there is enough free room.

To see the current behaviour, let's assume that we receive 3 fragments
in reverse order:
- Frag3(offset = 0x40, M=0)
- Frag2(offset = 0x20, M=1)
- Frag1(offset = 0x00, M=1)

After receiving Frag3 and Frag2, pkt[] will look like:

  .-------.-------.-------.
  | Frag2 | Frag3 | NULL  |
  | 0x20  | 0x40  |       |
  '-------'-------'-------'
    pkt[0]  pkt[1]  pkt[2]

When receiving Frag1, shift_packets(pos = 0) is called to make some room
at position 0. It will iterate up to i = 2 where there is a free
element. The current algorithm will try to shift pkt[0] to pkt[2], which
is indeed impossible but also unnecessary. It is only required to shift
pkt[0] and pkt[1] by one element in order to free pkt[0] to insert
Frag1.

Update the algorithm in order to shift the memory only by one element.
As a result, the ENOMEM test is only simpler: as long as we encounter
one free element, we are guaranteed that we can shift by one element.
Also assign a NULL value to the newly freed element since memmove() only
copy bytes.

Signed-off-by: Florian Vaussard <florian.vaussard@gmail.com>
2021-09-23 13:21:09 -04:00
Florian Vaussard
a9917d9bd4 net: ipv6_fragment: improve reassembly condition
Currently net_ipv6_handle_fragment_hdr() performs 2 distinct tests: it
checks the M-bit of the most recent fragment to decide if we can proceed
with the reassembly. Then it performs some sanity checks which can lead
to dropping the whole packet if not successful.

The test on the M-bit assumes that fragments arrive in order. But this
will fail if packets arrive out-of-order, since the last fragment can
arrive before some other fragments. In that case, we proceed with the
reassembly but it will fail because not all the fragments have been
received.

We need a more complete check before proceeding with the reassembly:
- We received the first fragment (offset = 0)
- All intermediate fragments are contiguous
- The More bit of the last fragment is 0

Since these conditions can also detect a malformed fragmented packet, we
can replace the existing sanity check that is performed before
reassembly. As a bonus, we can now detect and rejected overlapping
fragments, since this can have some security issues (see RFC 5722).

Signed-off-by: Florian Vaussard <florian.vaussard@gmail.com>
2021-09-23 13:21:09 -04:00
Florian Vaussard
4fe978661a net: ipv6_fragment: store M-bit in addition to the offset
Currently we only store the fragment offset. But in some cases it might
be necessary to also inspect the M-bit (More Fragment) of all received
fragments.

Modify the semantics of the field to store all the flags, rename the
setter to account for this change, and add a getter for the M-bit.

Signed-off-by: Florian Vaussard <florian.vaussard@gmail.com>
2021-09-23 13:21:09 -04:00
Florian Vaussard
0fcf87540e net: ipv6_fragment: remove special handling of 1st fragment
The special handling of the 1st fragment in unnecessary, since it will
be correctly handled even without it. Moreover it causes some corner
cases, like a single packet with a fragment header (M=0), to be
incorrectly handled since the reassembly code is skipped.

Remove the special handling of the 1st fragment to fix these problems.

Signed-off-by: Florian Vaussard <florian.vaussard@gmail.com>
2021-09-23 13:21:09 -04:00
Florian Vaussard
108ccfe60c net: ipv6_fragment: check the length also for the first fragment
Currently the requirement of the length being a multiple of 8 is not
tested for the first fragment, since the first fragment takes a
different path due to the goto.

Move the test earlier in the process, so that it is performed on all
fragments, including the first one.

Signed-off-by: Florian Vaussard <florian.vaussard@gmail.com>
2021-09-23 13:21:09 -04:00