Commit graph

80105 commits

Author SHA1 Message Date
Grzegorz Swiderski
87aa25e4ad sysbuild: Fix exporting BOARD.+ through sysbuild cache
Lately, sysbuild started filtering out variable names matching ^BOARD
during sysbuild cache file generation. As a result, one of the cache
variables that is no longer exported to other domains is BOARD_ROOT,
which breaks the recent support for out-of-tree boards in sysbuild.

Of those variables, the only one which is reasonable to filter out is
BOARD itself, because the purpose of that is to substitute a different
value for the one found in sysbuild's own CMake cache, which has the
board revision stripped out.

Update the relevant if-condition and use a single regex for brevity.

Fixes #59114.

Signed-off-by: Grzegorz Swiderski <grzegorz.swiderski@nordicsemi.no>
2023-06-12 07:27:40 -04:00
Henrik Brix Andersen
b7717058ac doc: release-notes: add CAN release notes for v3.4.0
Add CAN related release notes for Zephyr v3.4.0.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-06-12 06:44:04 -04:00
Alberto Escolar Piedras
bc090178ab doc: release: 3.4: Fix indent in ARCH's lists
So they render properly.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-06-12 06:43:11 -04:00
Alberto Escolar Piedras
15ad2be01a doc: release: 3.4: Add BabbleSim related points
Add relevant bsim related changes.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-06-12 06:43:11 -04:00
Alberto Escolar Piedras
6bf47f52fa doc: release: 3.4: Add more flash simulator changes
Add some extra relevant changes to the flash simulator

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-06-12 06:43:11 -04:00
Alberto Escolar Piedras
dc90066390 doc: release: 3.4: Add POSIX arch and POSIX boards changes
Add points related to the POSIX arch and boards to the
3.4 release notes.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-06-12 06:43:11 -04:00
Daniel Leung
7839d36d0b doc: release-notes/3.4: bits on Xtensa
This adds a few bits on additions and changes on Xtensa.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-06-12 06:41:44 -04:00
Daniel Leung
50c70f553e doc: release-notes/3.4: small bit about PCIe
Added a small bit about PCIe where it can now filter
using class/revision register.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-06-12 06:41:44 -04:00
Daniel Leung
2f3a164fbe doc: release-notes/3.4: add bits for UART
This adds bits for various additions and fixes on UART
drivers.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-06-12 06:41:44 -04:00
Vinayak Kariappa Chettimada
05aabdc6d9 Bluetooth: Controller: Rework internal header includes
Rework internal header files to not have includes, rather
have the required includes in the c source files.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2023-06-12 06:20:24 -04:00
Carles Cufi
22f73992b2 Bluetooth: Rework the HCI header set
In order to have clean, self-contained HCI headers that do not have any
dependencies towards the Host or any other part of the system (except
types), reorganize the headers in the following way:

- Split out the macros and structs from hci.h to a new hci_types.h
- Merge the existing hci_err.h into the new hci_types.h

Fixes #58214.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2023-06-12 06:20:24 -04:00
Christopher Friedt
a17fc4ff2b doc: release: 3.4: add posix api deprecations
Add POSIX API deprecations to v3.4 release notes.

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
2023-06-11 21:38:44 -04:00
Anas Nashif
d14519cb24 release: bump release to 3.4.0-rc3
Bump release to 3.4.0-rc3.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-06-11 10:09:53 -04:00
Christopher Friedt
efe9111b21 doc: services: posix: update c-lang support section
Several C language items have gained support in Zephyr over
time.

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
2023-06-11 05:08:35 -04:00
Lars Knudsen
a7254b85e1 shell: Fix BT verbose scan logging
Fix endianness printout of values.

Handle service data output with initial UUID.

Signed-off-by: Lars Knudsen <lakd@demant.com>
2023-06-11 05:08:08 -04:00
Christopher Friedt
533c1985dc doc: services: posix: update posix supported items
Several items needed to be updated in POSIX documentation.

* add `_POSIX_BARRIERS` top Option Requirements
* update `_POSIX_THREAD_ATTR_STACK*` in Option Requirements
* add `pthread_barrier_*()` to `POSIX_THREADS_BASE`
* update `pthread_cond_destroy()` and `pthread_setcancelstate()`

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
2023-06-10 10:08:25 -04:00
Emil Gydesen
b0d6437653 Bluetooth: Audio: Shell: Increase number of streams for unicast client
Increase CONFIG_BT_BAP_UNICAST_CLIENT_GROUP_STREAM_COUNT to match
CONFIG_BT_ISO_MAX_CHAN.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-06-10 05:16:59 -04:00
Emil Gydesen
9ed72eb0e6 tests: Bluetooth: CAP: BSIM: Set initiator as d=0 and acceptor as d=1
Typically the client is the first device in our babblesim tests, so
reordered the initiator and acceptor for the CAP tests to conform to
that.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-06-10 05:16:39 -04:00
Emil Gydesen
b635a47c70 tests: Bluetooth: CAP: Add bsim test for unicast_audio_cancel
Add test of the unicast audio cancel that can cancel any pending
procedures. This is done by adding a new blocking behavior in the
cap acceptor.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-06-10 05:16:39 -04:00
Emil Gydesen
7712f81171 Bluetooth: CAP: Shell: Add cmd_cap_initiator_unicast_cancel
Add cmd_cap_initiator_unicast_cancel to call the cancel
function.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-06-10 05:16:39 -04:00
Emil Gydesen
e9c1be88ca Bluetooth: CAP: Add Initiator cancel procedure
Add function to cancel any current proecedure. This is useful
in cases where the connection to one or more acceptors is lost
or if some acceptor does not respond to our requests for whatever
reason.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-06-10 05:16:39 -04:00
Emil Gydesen
65c2f8ef37 Bluetooth: BAP: Release stream on codec config if requested
An ASCS endpoint may go into either the idle or codec configured
state when a stream is released. However since we have such a high
coupling between audio streams and endpoints, we need to consider
the endpoint as having been released (i.e. gone to the IDLE state).

This is handled by a boolean state variable for now, but we may
want to consider a more generic approach where streams and
endpoints may be less coupled.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-06-10 05:15:37 -04:00
Emil Gydesen
f3f8380296 Bluetooth: BAP: modify when ASCS disconnects the CIS
When an audio stream in a bidirectional CIS is released,
it should not disconnect the CIS if there is still a stream
for the opposite direction streaming. Only if both streams
are not in a streaming state, should ASCS attempt to disconnect
the CIS.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-06-10 05:15:37 -04:00
Emil Gydesen
bc89eabfdd Bluetooth: BAP: Remove bad log error from bt_audio_valid_codec
There was a LOG_ERR from debugging.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-06-10 05:14:12 -04:00
Nikolay Agishev
6e940c513c ARC: Fix portability.posix.common.arcmwdtlib test
portability.posix.common.arcmwdtlib test fails with ARCMWDT libc.
This path fixes the test.

STDIN_FILENO and others macroses are used in libc-hooks.c only. So they
defined localy.

Signed-off-by: Nikolay Agishev <agishev@synopsys.com>
2023-06-09 14:17:50 -04:00
Thomas Stranger
f8f8fa2e24 doc: release notes: add 1-wire release notes for 3.4.0
Add 1-Wire related release notes for Zephyr v3.4.0.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2023-06-09 14:16:50 -04:00
Rubin Gerritsen
9cb339166e Samples: iso_connected_benchmark: Fix invalid latency
The default transport latency was not valid.
Set it to a value that is large enough.
The minimum possible transport latency is 16580 us,
but this assumes the controller ignores the RTN=2.
If the controller uses the RTN=2, the transport latency will
be slightly larger than 30 ms depending on
how the controller chooses to setup the ISO link.

Therefore, we set it to 40 ms to ensure the default
configuration is valid.

How these numbers were found:

For unframed PDUs this is defined in Core_v5.4, Vol 6,
Part G, Section 3.2.2:
  Transport_Latency =
    CIG_Sync_Delay + FT * ISO_Interval - SDU_Interval

Because unframed PDUs are being used, the ISO interval needs
to be a multiple of SDU interval.
If MaxPDU = MaxSDU and the PHY is 2M, this results in that
the maximum subevent size is:
2120 * 2 + 2 * 150 = 4540.
For 2 CISes this is 9080 us > 7500
Therefore, the controller has to set the ISO interval to a
minimum of 15000 us in order to fit the packets.

Based upon this info, the controller has the freedom to ignore
or use the requested RTN=2.
1. Ignore -> NSE is 2: Minimum ISO interval is 15000 us
2. RTN = 2, Increase NSE: 4 * 4540 = 18160 -> ISO_Interval = 22500 us
3. RTN = 2, Increase the FT to 2, NSE = 2 -> ISO_Interval = 15000 us

For (1):
  Transport_Latency = CIG_Sync_Delay + 15000 - 7500
                    = CIG_Sync_Delay + 7500
For (2):
  Transport_Latency = CIG_Sync_Delay + 22500 - 7500
                    = CIG_Sync_Delay + 15000
For (3):
  Transport_Latency = CIG_Sync_Delay + 2 * 15000 - 7500
                    = CIG_Sync_Delay + 22500

As shown in Core_v5.4, Vol 6, Part B, Section 4.5.14,
CIG_Sync_Delay needs to be larger than or equal to the length of
all ISO events. That is, the sum of the subevents:

For (1): CIG_Sync_Delay = 2 * 4540 = 9080
For (2): CIG_Sync_Delay = 4 * 4540 = 18160
For (3): CIG_Sync_Delay = 2 * 4540 = 9080

This results in the following transport latencies:

For (1): Transport_Latency = 9080 + 7500 = 16580
For (2): Transport_Latency = 18160 + 15000 = 33160
For (3): Transport_Latency = 9080 + 22500 = 31580

Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
2023-06-09 14:16:34 -04:00
Rubin Gerritsen
faecdff7a2 Samples: iso_connected_benchmark: Use BT_LE_ADV_OPT_ONE_TIME
It is not intentional to continue advertising once a connection has been
established for two reasons:
 1. We do not configure enough connection contexts for this
 2. We don't want to generate controller scheduling conflicts that can
    possibly reduce performance.

Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
2023-06-09 14:16:34 -04:00
Emil Gydesen
1a3fd597a8 Bluetooth: ISO: Log status as hex instead of decimal
Log status values in events as hex instead of decimal
to make it easier to compare to the spec and hci_err.h

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-06-09 14:16:15 -04:00
Benjamin Cabé
7ebe4889f3 drivers: auxdisplay: Fix rows/columns inversion
JHD1313 is 16 columns x 2 rows.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2023-06-09 13:23:36 -04:00
Benjamin Cabé
0445c7e7d5 drivers: auxdisplay: Set background to white
Fixed inconsistency between code & comments and actually set
background to black

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2023-06-09 13:23:36 -04:00
Benjamin Cabé
3b181641d2 drivers: auxdisplay: Fix text direction handling
Fixed Input Set handling.
Flag had misleading names: whether "entry" happens to the left or to the
right is dependent on whether increment mode is active or not), so
switched to just using a "SHIFT" y/n flag instead. It also reflects better
the contents of the datasheet).
Updated romance text direction accordingly ("increment, no shift").

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2023-06-09 13:23:36 -04:00
Benjamin Cabé
f307e200c2 drivers: auxdisplay: Fix jhd1313 compilation issues
Added several missing undeclared config variables causing the driver to
not compile properly.
Fixes #59078.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2023-06-09 13:23:36 -04:00
Gerson Fernando Budke
f220e26703 doc: release: 3.4: Add notes about Gigadevices
Add 3.4.0 release notes for Gigadevices

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2023-06-09 13:18:14 -04:00
Gerson Fernando Budke
fb74e5ecc5 doc: release: 3.4: Add notes about Atmel
Add 3.4.0 release notes for Atmel.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2023-06-09 13:18:14 -04:00
Christopher Friedt
1d71fb765f doc: release: 3.4: add posix api release notes
Add POSIX API release notes for v3.4.0.

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
2023-06-09 13:17:18 -04:00
Christopher Friedt
89cf4cea56 posix: pthread: mitigate include order sensitivity
Previously, the `posix_internal.h` header needed to be exposed
to the application because we had non-trivial details for
most posix types (pthread, mutex, cond, ...). Since most of
those have been simplified to a typedef'ed integer, we
no longer need to expose that header to the applicaiton.

Additionally, it means that we can adopt normalized
header order in posix.

Additionally, keep more implementation details hidden
and prefer the static keyword on internal symbols where
possible.

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
2023-06-09 12:27:04 -04:00
Christopher Friedt
d9bae7ce65 tests: posix: improvements to pthread_pressure test
* allow `qemu_cortex_a53`
* disallow `qemu_leon3
* remove `TEST_DURATION_S` range
* additional report formatting

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
2023-06-09 12:27:04 -04:00
Christopher Friedt
e1f8ea1ad7 posix: pthread: add option for pthread_create() barrier
To enable testing, introduce `CONFIG_PTHREAD_CREATE_BARRIER`.

Some observations were made that running several Qemu SMP targets
concurrently could lead to synchronization problems. On such
targets, it was found that the synchronization issues were
mitigated by introducing a `pthread_barrier_t` shared between
`pthread_create()` and the spawned thread.

It is suggested to enable the option when running many
SMP tests concurrently in several parallel Qemu processes,
e.g. with `twister`.

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
2023-06-09 12:27:04 -04:00
Christopher Friedt
85e18746b8 posix: pthread: rework pthreads to use zephyr api
Previously, pthreads suffered from some race conditions.
This was almost inevitable given that it was maintained in
parallel to Zephyr's threading and synchronization API.

The unfortunate side-effect of with that is that it did not
receive the reliability and other improvements that
`k_thread`s did.

Here, we perform a significant update of pthread code so
that it depends directly on public Zephyr API. With that,
we reuse as many concepts as possible and pthreads benefits for
free from any improvement made to Zephyr's threading and
synchronization APIs.

Included with this change, we
* implement state with `ready_q`, `run_q`, and `done_q`
* use `pthread_barrier_wait()` to sync `pthread_create()`
* synchronize internal state with a spinlock

These pthreads are considerably more reliable than
before.

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
2023-06-09 12:27:04 -04:00
Christopher Friedt
08ba17683b posix: cond: use k_condvar instead of posix_cond
The internal representation of `pthread_cond_t`,
`struct posix_cond`, is an identical clone of `struct k_condvar`
but without the benefit of being able to use all of the
existing `k_condvar_*()` suite of functions.

The first step in the right direction was switching
the external representation of `pthread_cond_t` to a simple
`int`. Let's take the next step in the right direction, which
is getting rid of `struct posix_cond`.

For now, let's keep this change as a simple type
substitution. Eventually, we should be able to fully switch
to Zephyr API internally.

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
2023-06-09 12:27:04 -04:00
Christopher Friedt
0d7ef2297b posix: mutex: use k_mutex instead of posix_mutex
The internal representation of `pthread_mutex_t`,
`struct posix_mutex`, is basically a clone of `struct k_mutex`
but without the benefit of being able to use all of the
existing `k_mutex_*()` suite of functions.

The first step in the right direction was switching
the external representation of `pthread_mutex_t` to a simple
`int`. Let's take the next step in the right direction, which
is getting rid of `struct posix_mutex`.

The only significant difference between `struct k_mutex` and
`struct posix_mutex` is that the latter needs a `type` field.

Since there were a fixed number of `struct posix_mutex`, we
can just externalize the `type` field and reuse
`struct k_mutex` as-is.

For now, let's keep this change as a simple type
substitution. Eventually, we should be able to fully switch
to Zephyr API internally.

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
2023-06-09 12:27:04 -04:00
Christopher Friedt
f35fb33b94 posix: pthread: reimplement pthread_barrier using zephyr objects
Previously pthread_barrier_t was implemented in terms of wait
queues and internal scheduler functions.

This introduced some obstacles and inconsistency. In order
to be more consistent, rely only on Zephyr's public API and
reuse as many concepts as possible.

Deprecate `PTHREAD_BARRIER_DEFINE()` since it's non-standard.

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
2023-06-09 12:27:04 -04:00
Carlo Caione
8eeb5c992e riscv: Move directory to *-privileged
Because the spec is "privileged" not "privilege".

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2023-06-09 11:46:29 -04:00
Carlo Caione
edd3437826 riscv: Rename Kconfig symbol to *_PRIVILEGED
Rename SOC_FAMILY_RISCV_PRIVILEGE to SOC_FAMILY_RISCV_PRIVILEGED because
the spec is "privileged".

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2023-06-09 11:46:29 -04:00
Mahesh Mahadevan
e94b6f901b drivers: usb_mcux: Fix disable and reset functions
1. Fix the reset function to reset correctly.
2. Ensure the controller handle is initialized before
   calling the SDK functions.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2023-06-09 11:45:55 -04:00
Tomasz Moń
3b14268e41 drivers: usb_dc_native_posix: Check data length before copy
Fail requests if the data does not fit inside buffer.

This commit only adds missing sanity checks but the native posix driver
remains broken at the design level. The amount of work to fix the native
posix driver in legacy USB stack is deemed too great to be worth it.

Coverity-CID: 195841, GitHub issue #58564
Coverity-CID: 240244, GitHub issue #58570

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2023-06-09 11:45:16 -04:00
Lars Knudsen
fb408077df shell: Fix shell_vfprintf when vt100 is disabled
Without this fix, for every call to shell_vfprintf,
a prompt string and vt100 codes are printed too,
resulting in mangled log output.

Signed-off-by: Lars Knudsen <lakd@demant.com>
2023-06-09 11:44:49 -04:00
Vinayak Kariappa Chettimada
5eb17bca21 samples: Bluetooth: hci_usb: Disable USB_CDC_ACM
BlueZ btusb does not recognize hci_usb sample as Bluetooth
Controller when CDC ACM is enabled in the sample.

Refer to https://github.com/zephyrproject-rtos/zephyr/issues/29107

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2023-06-09 11:44:02 -04:00
Emil Gydesen
8eaeb73753 tests: Bluetooth: Split CAP initiator tests to unicast and broadcast
Split the cap_initiator_test.c to two new files
cap_initiator_broadcast_test.c and
cap_initiator_unicast_test.c as the two barely had any
common functionality, and the file was getting too large.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-06-09 11:42:39 -04:00