Commit Graph

95517 Commits

Author SHA1 Message Date
Karthikeyan Krishnasamy 5e7d74bd23 samples: bluetooth: hci_uart: fix dtsi path in overlay
fix dtsi overlay include path for nrf9160dk_nrf52840

Signed-off-by: Karthikeyan Krishnasamy <karthikeyan@linumiz.com>
2024-05-17 14:40:15 -05:00
Karthikeyan Krishnasamy 89fcb5a9b4 samples: cellular: fix dtsi path in overlay
fix dtsi include path for board nrf9160dk_nrf52840

Signed-off-by: Karthikeyan Krishnasamy <karthikeyan@linumiz.com>
2024-05-17 14:40:15 -05:00
frei tycho 18fd294b5c include: arch: x86: added missing parenthesis
- added missing parenthesis around macro argument expansion

Signed-off-by: frei tycho <tfrei@baumer.com>
2024-05-17 14:39:21 -05:00
Benjamin Cabé bdfb6afe70 samples: net: http_server: add link to HTTP Server doc page
Improve navigability in the documentation by adding a link to the main
HTTP Server documentation page to the HTTP Server sample.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2024-05-17 14:38:15 -05:00
Johann Fischer 64894e8798 sample: hid-mouse: exclude frdm_mcxn947
Board does not specify "zephyr,code" and is fails in twister.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-05-17 16:25:02 +01:00
Johann Fischer 7328690799 samples: usb: add a sample USB 2.0 Extension Descriptor
Add a sample USB 2.0 Extension Descriptor.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-05-17 16:25:02 +01:00
Johann Fischer b0d7d70834 usb: device_next: add initial BOS support
Use the same scheme as for string descriptors. Descriptors can be added
or removed using the existend interface.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-05-17 16:25:02 +01:00
Johann Fischer 29003ff264 usb: bos: cleanup Binary Device Object Store header
We could reuse the BOS header, but there are parts that are only needed
in the legacy device support or used internally and the tests. Move this
parts to the appropriate places.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-05-17 16:25:02 +01:00
Johann Fischer 4f17bc6051 usb: device_next: store bDescriptorType and bLength in descriptor node
It simplifies the macros to create the string descriptors. We also no
longer need placeholders for the SerialNumber descriptor when it is
generated from hwid. In the future, we can store other descriptor types
in the same list.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-05-17 16:25:02 +01:00
Johann Fischer 9b8796400a usb: device_next: rework SerialNumber generation from HWINFO
Do not use application-provided placeholder buffers. Generate
SerialNumber just before ASCII string is converted to UTF16LE. Make
dependency on HWINFO optional, but enabled by default.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-05-17 16:25:02 +01:00
Johann Fischer 48ca72326b usb: device_next: move string descriptor data to a separate structure
Move and rework string descriptor data to a separate structure so we can
share memory with another type. Also add description to the
USBD_DESC_STRING_DEFINE macro.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-05-17 16:25:02 +01:00
Johann Fischer 2f31ee63b5 usb: device_next: convert ASCII7 strings to UTF16LE on the fly
This is slower but should have no real effect. In the future we can
support more than ASCII7 format and store it in other memory areas.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-05-17 16:25:02 +01:00
Johann Fischer f110766072 usb: device_next: add few more string descriptor helpers
Add function to get string descriptor index and function
to remove linked descriptor from a device. This abstracts
it a bit so that the user does not need to know how it is
handled internally.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-05-17 16:25:02 +01:00
Scott Worley d0e0e8ff36 manifest: Update hal_microchip for new MEC5 HAL
Microchip external HAL repository has been updated with
the MEC5 HAL for new chips. MEC5 is a full HAL with chip
headers, C peripheral code, and PINCTRL DTSI files. MEC5
is meant for MEC174x, MEC175x, and also include support
for the older MEC172x named as MECH172x. NOTE: legacy
MEC172x in the currest zephyr tree is not affected.

Signed-off-by: Scott Worley <scott.worley@microchip.com>
2024-05-17 16:23:26 +01:00
Evgeniy Paltsev 2df070adb4 ARC: hsdk_2cores: fix broken defconfig
After recent HWv2 model changes there is defconfig file
broken, so we got incorrect platform configuration. Fix that.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Evgeniy Paltsev <PaltsevEvgeniy@gmail.com>
2024-05-17 16:22:27 +01:00
Ederson de Souza 972eecfc17 samples/subsys/llext: EDK sample
Shows a simple application which loads extensions and some simple
extensions. While everything is inside Zephyr tree, everything can
actually be build from different directories (even machines), as long as
the EDK is generated from the application and used by the extensions.
More information is available at sample's README.

This sample is build only for twister, as it requires a few steps to be
properly run, namely build the EDK, install it somewhere, build the
extensions using the EDK and finally build the application with the
extensions.

Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
2024-05-17 16:21:48 +01:00
Ederson de Souza a0ee472a6f tests/misc: Add llext EDK test
This test uses pytest to generate an EDK from a simple Zephyr
application, and uses this EDK to build a simple extension, to ensure
that EDK generation is sane.

Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
2024-05-17 16:21:48 +01:00
Ederson de Souza 4e9a2a7c33 cmake: Handle `imacros` from flags
Instead of hardcoding `autoconf.h` imacro, get the list of imacros from
the llext flags. As those come in the form of absolute paths, they also
need to be massaged to point from the EDK directory without revealing
host complete paths.

Also, the EDK now keeps the imacros on a different flag,
`LLEXT_GENERATED_IMACROS_CFLAGS`, to keep it similar to other generated
includes.

Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
2024-05-17 16:21:48 +01:00
Ederson de Souza cd535b75aa cmake: Reuse llext flags for EDK
Some flags are common between in tree extensions and out of tree
supported by the EDK. Instead of duplicating those flags, the EDK reuses
the llext ones.

However, as the EDK has its own needs, two new lists,
`LLEXT_EDK_APPEND_FLAGS` and `LLEXT_EDK_REMOVE_FLAGS` are defined to
allow EDK to append or remove flags as needed.

Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
2024-05-17 16:21:48 +01:00
Ederson de Souza dc8d7ada19 cmake/modules: Extract flags filtering code to a function
This way they can be reused by the LLEXT EDK.

Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
2024-05-17 16:21:48 +01:00
Ederson de Souza 2f41060fbd cmake/llext-edk: Generate more granular CFLAGS
Besides the LLEXT_CFLAGS, which have all that is needed to compile,
generate more granular ones, LLEXT_INCLUDE_CFLAGS,
LLEXT_ALL_INCLUDE_CFLAGS, LLEXT_GENERATED_INCLUDE_CFLAGS and
LLEXT_BASE_CFLAGS. These are done for convenience, as they can help on
different setups, such as unit testing.

Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
2024-05-17 16:21:48 +01:00
Ederson de Souza 967168a536 subsys/llext: Generate syscalls stubs for EDK exclusively for userspace
A new Kconfig option which generates syscall stubs assuming that
extensions will always run on userspace, thus simplifying linking
them, as there's no need for z_impl_ stubs (used for direct syscalls),
CONFIG_LLEXT_EDK_USERSPACE_ONLY.

While defining __ZEPHYR_USER__ could have the same effect for optmised
builds, people building extensions on debug environments - thus
non-optimised - would suffer, as they'd need to somehow make the stubs
available (by either exporting the symbol or implementing dummy stubs).

Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
2024-05-17 16:21:48 +01:00
Ederson de Souza d156a03074 cmake: New target which generates a sort of development kit for llext
Loadable extensions need access to Zephyr (and Zephyr application)
includes and some CFLAGS to be properly built. This patch adds a new
target, `llext-edk`, which generates a tar file with those includes and
flags that can be loaded from cmake and make files.

A Zephyr application willing to expose some API to extensions it loads
only need to add the include directories describing such APIs to the
Zephyr ones via zephyr_include_directories() CMake call.

A new Kconfig option, CONFIG_LLEXT_EDK_NAME allows one to control some
aspects of the generated file, which enables some customization - think
of an application called ACME, willing to have a ACME_EXTENSION_KIT or
something.

All EDK Kconfig options are behind CONFIG_LLEXT_EDK, which doesn't
depend on LLEXT directly - so that EDK features can be leveraged by
downstream variations of loadable extensions.

Also, each arch may need different compiler flags for extensions: those
are handled by the `LLEXT_CFLAGS` cmake flag. An example is set for GCC
ARM.

Finally, EDK throughout this patch means Extension Development Kit,
which is a bad name, but at least doesn't conflict with SDK.

Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
2024-05-17 16:21:48 +01:00
Rafał Kuźnia 9cba85bb8d soc: nrf54h: use word accesses to SPI_DW peripheral
The nRF54H20 EXMIF peripheral requires word accesses. Doing accesses of
byte or half-word sizes results in bus fault.

Signed-off-by: Rafał Kuźnia <rafal.kuznia@nordicsemi.no>
2024-05-17 16:18:56 +01:00
Piotr Dymacz 5409c7c130 boards: st: nucleo_wba55cg: add mcuboot-{led0,button0} aliases
This adds DT aliases for LED and button used in recovery mode of the
MCUboot bootloader, on the 'nucleo_wba55cg' board.

Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
2024-05-17 15:07:54 +02:00
Piotr Dymacz 35c08ea636 boards: st: nucleo_wba55cg: define all LEDs and buttons
This board includes three gpio-connected LEDs and push-buttons. Include
all missing defines in board's DTS and while at it, fix existing button
definition (missing pull-up enable) and align node names with other
boards (e.g. 'nucleo_wb55rg').

Provided changes were tested on real board with 'blinky' and 'button'
samples.

Additionally, duplicated LED nodes no longer required were removed from
overlay file for this board, in 'suspend_to_ram' sample.

Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
2024-05-17 15:07:54 +02:00
Alberto Escolar Piedras 19df415f91 samples/posix/env: Change integration platform
There is some instability problems with qemu_riscv32
https://github.com/zephyrproject-rtos/zephyr/issues/72858
which cause this sample test to fail in CI at random.
Let's change the integration platform to a reliable one,
so this test focuses on the sample and does not produce
false test failures due to the platform.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-05-17 15:07:46 +02:00
Johann Fischer 619dd3022d samples: usb: add nrf54h20dk to allowed platforms
nRF54H20DK board is first major user of new UDC DWC2 driver.
Add nRF54H20DK (Application CPU) to allowed platforms in USB device
samples.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-05-17 14:05:08 +01:00
Johann Fischer 53adf6f490 boards: nrf54h20dk: enable USB device controller
Enable USB device controller.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-05-17 14:05:08 +01:00
Johann Fischer c00071574a dts: nordic: update USBHS node
Add "nordic,nrf-usbhs" vendor compatible and new required properties.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-05-17 14:05:08 +01:00
Johann Fischer 715e4ce6f3 drivers: udc_dwc2: prevent access to registers if USBHS is not ready
On USBHS, we cannot access the DWC2 register until VBUS is detected and
valid. Kernel event API is used to block if a valid VBUS signal is not
present when the user tries to force usbd_enable().

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-05-17 14:05:08 +01:00
Johann Fischer acd2fa7972 drivers: udc_dwc2: fix interpretation of NUMDEVEPS and INEPS fields
The NUMDEVEPS field provides the number of endpoints in addition to the
control endpoint. It is used to iterate over GHWCFG1 register value to
get correct number of configured IN/OUT endpoints. To get it correctly,
we need to use it internally as number including control endpoint.

Interpretation of INEPS misses +1 because value 0 means 1 IN endpoint
and so on.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-05-17 14:05:08 +01:00
Johann Fischer b117155320 drivers: udc_dwc2: add vendor quirks to support Nordic USBHS controller
Add vendor quirks to support Nordic USBHS controller.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-05-17 14:05:08 +01:00
Johann Fischer 6d06a8cea9 drivers: udc_dwc2: use devicetree to configure endpoint capabilities
Although we can get the number of configured OUT and IN endpoints and
endpoint capabilities from the DWC GHWCFGn registers, we need to
configure the number of endpoint configuration structs at build time. On
some platforms, we cannot access the hardware register at pre-init, so
we use the GHWCFGn values from the devicetree to provide endpoint
capabilities. This can be considered a workaround, and we may change the
upper layer internals to avoid it in the future.

Also, add a new vendor quirk to fill in platform-specific controller
capabilities.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-05-17 14:05:08 +01:00
Johann Fischer efb286dfdf drivers: udc_dwc2: rework vendor quirks
Rework and rename vendor quirks to better reflect where they intended to
be called. Number of quirks probably not final and will be trimmed
later.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-05-17 14:05:08 +01:00
Johann Fischer 67cdccc1c2 drivers: udc_dwc2: rework controller initialization
Move most of the controller initialization to a separate function called
during udc_enable(). This allows us to add support for the platform
where the device controller is only available when VBUS is present and
the PHY is powered.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-05-17 14:05:08 +01:00
Yong Cong Sin 5f1e1c7b34 drivers: sensor: sensor_shell: fix infinite loop when doing `sensor get`
Should increment `ch.chan_idx` instead of `channel_idx`,
otherwise we will be stucked in the loop forever.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2024-05-17 14:34:09 +02:00
Krzysztof Chruściński 24082d582f arch: arm: cortex_m: pm_s2ram: Add option for custom marking
s2ram procedure used RAM magic word for marking suspend-to-RAM. This
method may not work in some cases, e.g. when global reset does not
reset RAM content. In that case resuming from s2ram is detected when
global reset occurred.

RAM magic word method is the default but with
CONFIG_PM_S2RAM_CUSTOM_MARKING a custom implementation can be provided.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2024-05-17 14:33:47 +02:00
Emil Gydesen c547079cc2 Bluetooth: Audio: Upgrade from experimental to unstable
This commit upgrades the LE audio API and implementation
from experimental to unstable.

LE Audio have existing for quite a few years in Zephyr
and is not going anywhere, but at the same time it still
has significant effort remaining before it can be
considered stable.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-05-17 14:33:39 +02:00
Jens Rehhoff Thomsen a2ebe49259 Bluetooth samples: Keep broadcast assistant connected
When Broadcast Sink is connected to Broadcast Assistant then keep
connection when Broadcast Source is removed.

Signed-off-by: Jens Rehhoff Thomsen <jthm@demant.com>
2024-05-17 12:41:04 +02:00
Evgeniy Paltsev 47b334c619 ARC: nSIM: cmake: launch cores in direct order for simulation run
Align cmake launch script with west runners

Signed-off-by: Evgeniy Paltsev <PaltsevEvgeniy@gmail.com>
Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
2024-05-17 12:40:52 +02:00
Evgeniy Paltsev 0af51b072c ARC: nSIM: west: launch cores in direct order for simulation run
We've reversed core launch order to workaround issue of
ARConnect initialization interfere with secondary cores
startup (we don't want to workaround it in runtime as it's
only possible in case of debug session).

However it bring us new issues with the simulation run:
 - mismatch arcnum (core ID) with ARConnect ID
 - mismatch arcnum (core ID) with CPU name in nSIM instruction traces

To avoid these issues let's use direct core order for simulation
runs.

Signed-off-by: Evgeniy Paltsev <PaltsevEvgeniy@gmail.com>
Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
2024-05-17 12:40:52 +02:00
Laurentiu Mihalcea ae082064ff drivers: dai: sai: write some data into TX FIFO before start
While running the following command:

	aplay ... | arecord ...

multiple times, it was discovered that the SAI transmit
FIFO goes into underrun. This only happened in the
beginning, a few BCLK cycles after unmasking the transmit
data line. With the following flow:

	1) Trigger start on RX
		a) Do TX and RX software reset
		b) Enable RX FIFO error interrupt
		c) Enable RX DMA requests
		d) Enable receive data line
		e) Enable transmitter
		f) Enable receiver

	    ..... some time has passed .....

	2) Trigger start on TX
		a) Enable DMA requests
		b) Enable transmit data line

and configuration in mind:

	1) RX is SYNC with TX
	2) TX is ASYNC
	3) Each FSYNC edge is 32-bit wide
	4) Each frame contains 2 32-bit words

this points to the following possibilites:

	1) The transmitter is enabled so close to the
	start of a new frame that even though the DMA requests
	are asserted, the DMAC doesn't have enough time
	to service them until the module goes into underrun
	=> the timing is bad.

	2) The transmitter is enabled somewhat close to
	the start of a new frame such that the DMAC is not
	fast enough to service the module until it goes into
	underrun => DMAC is too slow AND the timing is bad.

Although the exact cause was not pinpointed, this patch
aims to fix the problem by writing a frame's worth of 0s
in the transmit FIFO. This way, even if we're dealing with
scenario 1) or 2), the DMAC has plenty of time to perform
the transfer (i.e: a frame), thus avoiding the underrun.

Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
2024-05-17 12:40:43 +02:00
Yong Cong Sin b0394425e1 drivers: sensor: st: vbat: check for ADC nodes
The vbat driver requires the adc node to be enabled:

```c
.adc = DEVICE_DT_GET(DT_INST_IO_CHANNELS_CTLR(inst))
```

Update its Kconfig to depend on `DT_HAS_ST_STM32_ADC_ENABLED`,
which is the `"st,stm32-adc"` compat that all ST ADC bindings
include, this will guarantee that at least one ADC node is
enabled, but not necessarily the ADC used by the vbat node.

To make sure that it at least compiles, we init the `adc`
pointer only if the specified ADC node is enabled, otherwise
it will points to `NULL`.

Finally, check if the `adc` points to `NULL` in
`stm32_vbat_init`. We are not relying on the existing
`device_is_ready` check because `DEVICE_DT_GET` will not
return `NULL` if the ADC is enabled. `adc == NULL` means
that the ADC node is not enabled in the devicetree.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2024-05-17 11:39:19 +02:00
Marcin Niestroj a15cc704e0 samples: net: echo_server: set IPV6_V6ONLY
This sample assumes that two separate sockets can be bound on IPv4 and
IPv6. On Linux (via Native Simulator Offloaded Sockets) this is possible
when there is no IPv4 to IPv6 mapping. Same can be true to other offloaded
sockets.

CONFIG_NET_IPV4_MAPPING_TO_IPV6 is disabled for this sample, so IPv4 to
IPv6 mapping is disabled for Zephyr native IPv6 layer. For offloaded
sockets this option does not define whether mapping is enabled or not, so
try to unconditionally (and without error checking) disable it.

This patch fixes compatibility with NSOS, since two separate sockets can be
bound on the same address and port, one for IPv4 and second for IPv6.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2024-05-17 11:12:43 +02:00
Marcin Niestroj 3a9ae1878f tests: socket: udp: reduce SO_PRIORITY from 8 to 6 for NSOS compatbility
According to 'man 7 socket' about SO_PRIORITY:

  Setting a priority outside the range 0 to 6 requires the CAP_NET_ADMIN
  capability.

So use 6 instead of 8, in order to make UDP socket tests pass with native
offloaded sockets on native_sim platform.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2024-05-17 11:12:43 +02:00
Marcin Niestroj 87a6df2a9b drivers: nsos: support IPV6_V6ONLY getsockopt() and setsockopt()
Handle IPV6_V6ONLY option in getsockopt() and setsockopt() APIs.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2024-05-17 11:12:43 +02:00
Marcin Niestroj d47ec4f75d drivers: nsos: support IPPROTO_TCP getsockopt() and setsockopt()
Handle IPPROTO_TCP specific options in getsockopt() and setsockopt() APIs.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2024-05-17 11:12:43 +02:00
Marcin Niestroj 736fe29349 drivers: nsos: support ioctl(FIONREAD)
This further increases compatibility with tests defined in
'tests/net/socket/udp/'.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2024-05-17 11:12:43 +02:00
Marcin Niestroj cd2c425efe drivers: nsos: support setsockopt(SO_RCVTIMEO)
Handle timeout on receive that is configured using SO_RCVTIMEO.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2024-05-17 11:12:43 +02:00