Commit Graph

98303 Commits

Author SHA1 Message Date
Robert Lubos 0ca2a3cce0 net: lib: lwm2m: Fix expected block calculation
Coverity reported that a formula used to calculate the next expected
block in case the block size from the request differs our own block size
has a bug. The expression used to calculate the block size diff would
evaluate to an unsigned integer, giving (wrongly) enormous results in
case block size from the request is smaller than the Zephyr's default.

It turns out however, that this formula is no longer needed at all.
Since commit d3081e2f30, Zephyr's LwM2M
implementation will no longer negotiate the block size in case of write
operation, but simply comply with the block size included in the
request. This means that calculating the diff makes no longer sense and
can be safely removed - the next expected block number should be simply
increased by 1.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-06-26 08:59:56 -04:00
Robert Lubos 0528df9a4e net: shell: udp: Check net_pkt_read_u8 result
In case packet read fails for any reason, there's no point proceeding or
printing the byte, just break the loop in such case.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-06-26 08:59:41 -04:00
Jamie McCrae b325f50599 doc: release: 3.7: Add note on build system watch file fix
Adds a note that an issue with watched files has been fixed

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2024-06-26 08:59:24 -04:00
Robert Lubos ee451e5cf0 net: sockets: tls: Fix iov_len comparison in sendmsg()
vec->iov_len is of type size_t, so the comparison was always true.
Additionally, doing the memcpy() when iov_len was 0 did not really make
sense, so do it only when the actual length is larger than 0.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-06-26 12:39:51 +02:00
Chris Friedt 9ada52f060 fdtable: replace z_ prefix with zvfs_ for fdtable.h functions
For each of the fdtable.h functions listed below, convert the
z_ prefixed semi-private functions to use the zvfs_ prefix.

ZVFS stands for Zephyr Virtual File System and
is intended to be a common library used by the C library,
POSIX API, Networking, Filesystem, and other areas.

There are already a few functions in fdtable.h that use the
zvfs_ prefix, so this change is mostly about unifying them in
a way that uses a suitable prefix ("namespace") so that it can
be considered a public API.

- z_alloc_fd
- z_fdtable_call_ioctl
- z_finalize_fd
- z_finalize_typed_fd
- z_free_fd
- z_get_fd_obj
- z_get_fd_obj_and_vtable
- z_get_obj_lock_and_cond
- z_reserve_fd

Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
2024-06-26 12:33:02 +02:00
Abderrahmane Jarmouni 66e7bdde53 samples: drivers: counter: alarm: add stm32-rtc test case
A specific test case for STM32 RTC is needed because of the way Counter
node is selected in preprocessing.
Tests STM32 RTC_Alarm using counter_ll_stm32_rtc driver.
This also clarifies how STM32 RTC Alarm can be used in this test.

Signed-off-by: Abderrahmane Jarmouni <abderrahmane.jarmouni-ext@st.com>
2024-06-26 06:01:18 -04:00
Johan Hedberg 63d97c1556 Bluetooth: shell: Fix missing check for buffer allocation
In practice this allocation is very unlikely to fail, however being
consistent with checking for a failure keeps Coverity happy.

Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2024-06-26 05:59:15 -04:00
Andrzej Głąbek de2efdee97 include: adc: Fix initialization of .differential in ADC_CHANNEL_CFG_DT
This is a follow-up to commit ff0f389d0b.

When the `zephyr,differential` property is used together with a driver
that selects `ADC_CONFIGURABLE_INPUTS`, the `differential` field is
initialized twice what causes a compilation error in C++. Fix this by
refactoring the logic around initialization of `.differential`.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2024-06-26 05:59:01 -04:00
Andreas Ålgård eb4c76a6ec net: lib: dhcpv4_server: Fix client ID bug
First byte of client ID should be htype, followed by the client address.
See: https://datatracker.ietf.org/doc/html/rfc1533#section-9.12

Signed-off-by: Andreas Ålgård <aal@ixys.no>
2024-06-26 05:58:49 -04:00
Robert Lubos 0aeecbbbfb net: tcp: Fix peer pointer use in net_tcp_endpoint_copy()
net_tcp_endpoint_copy() used wrong pointer to copy peer address.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-06-26 05:58:36 -04:00
Robert Lubos f3dbd38a77 net: tcp: Conditionally compile entire tcpv4/6_init_isn()
Partial conditional compilation within tcpv4/6_init_isn() caused
errors in coverity, as hash variable seemed to be used w/o
initialization.

As those functions are not really used at all if
CONFIG_NET_TCP_ISN_RFC6528 is disabled, we can just conditionally
compile entire functions to avoid confusion.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-06-26 05:58:36 -04:00
Fabian Blatz f95f57c668 doc: release: 3.7: Add note on LVGL changes
Adds release notes for the LVGL Zephyr module.

Signed-off-by: Fabian Blatz <fabianblatz@gmail.com>
2024-06-26 05:58:24 -04:00
Tomasz Bursztyka 7f8cc43a0b MAINTAINERS: Add another maintainer to the device driver model
Better have 2 maintainers on this critical part.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@proton.me>
2024-06-25 21:27:15 -04:00
Johann Fischer 90081578ae doc: mm: fix heap function references in documentation
Add missing doxygengroup Low Level Heap Allocator and Multi-Heap Wrapper
Utility.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-06-25 21:26:55 -04:00
Luca Burelli d4ea1da10e llext: fix llext_find_section(), remove llext_section_by_name()
The function llext_section_by_name() is used only in one place, and it
expects the caller to have the section headers cache available. This
cache is freed after the ELF file is loaded, so the function is not
usable in the context where it is called.

Remove the function and replace the call with a direct search in the
ELF file section headers array, as was done before 08eb314c35.

Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
2024-06-25 21:25:33 -04:00
Luca Burelli 95cab98110 llext: fix section addresses at link time by using sh_info
Currently, the code uses the section name to identify the target section
of a relocation. This is not reliable, as the section name is not
guaranteed to be in a specific format. Instead, use the sh_info field of
the relocation section header to identify the target section.

This is a tricky change, as it requires a workaround for the Xtensa
port, whose code path diverges here into the `link_plt` function and
ultimately different arch-specific code. Avoiding this divergence
will require additional refactorings.

Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
2024-06-25 21:25:33 -04:00
Luca Burelli a1550c4db1 llext: fix llext_load() optimization
The optimization in llext_load() to avoid using the generic path for
sections that are cached in memory was broken for two reasons:
- it was comparing an ELF section index to LLEXT_MEM_BSS, which is a
  llext_mem enum, and
- it was using the wrong section address for the cached sections since
  the "merged sections" feature was introduced in 709b2e44bf.

This patch fixes both issues using the new llext_loaded_sect_ptr()
helper function.

Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
2024-06-25 21:25:33 -04:00
Luca Burelli ee6074a35d llext: calculate offsets for ELF sections in memory areas
The recent changes to the loader code merged related sections together,
making sure the merged sections are self-coherent. This, however, did
not take into account that the original ELF sections are now a _subset_
of the merged section - and might not start from the beginning of the
merged section.

This patch converts the `sect_map` member of `struct llext_loader` to a
structure with two fields:
- mem_idx: the memory area index where the ELF section is mapped
- offset: the offset of the ELF section inside the memory area

The offset is calculated after all sections are merged and the final
groups are defined. This will allow the loader to correctly calculate
the address of symbols and relocations in the merged sections.

Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
2024-06-25 21:25:33 -04:00
Luca Burelli e42549c632 llext: add a test for llext_find_section
Add a new test case that verifies that llext_find_section() returns the
correct offset for a symbol in a loadable extension. This exploits the
fact that in the STORAGE_WRITABLE cases, the symbol addresses will be
inside the ELF file buffer, so they can be easily compared.

Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
2024-06-25 21:25:33 -04:00
Luca Burelli cec4be3a84 llext: rework test and sample coverage
This patch reworks the testcase.yaml and sample.yaml files for the llext
subsystem to further reduce the number of tests performed by CI while
improving overall coverage.

The following changes are introduced by this commit:

- Remove the arch_allow field from the common section to allow any arch
  to be tested in the build_only test. All other tests explicitly narrow
  down the arches they are applicable to.
- In addition to platforms with active issues, also exclude a number of
  platforms that are always skipped by the runtime filter due to
  RAM/Flash limitations.
- Add integration_platforms to limit the test count to a few selected
  platforms which are representative of the different arches.
- Remove a number of duplicate SLID tests and group them into a single
  test that covers both ARM and Xtensa architectures.
- Test the relocatable case on ARM as well.

Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
2024-06-25 21:25:33 -04:00
Luca Burelli 6c5983492b llext: set proper LLEXT_STORAGE default for Xtensa
This patch sets the default value for LLEXT_STORAGE_WRITABLE to 'y' on
the Xtensa architecture. This is necessary because it does not currently
support the read-only mode for the LLEXT storage.

Make sure the default reflects this instead of asking the user to
manually set it.

Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
2024-06-25 21:25:33 -04:00
Luca Burelli 2ba545c5c6 llext: test: align ELF file buffers to 4k
The ELF files should be aligned to at least sizeof(elf_word) to avoid
issues. Use a larger value to ease debugging, since it reduces the
differences in addresses between similar runs.

Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
2024-06-25 21:25:33 -04:00
Nicolas Pitre a53ddff3b6 tests: demand_paging: touch memory with more useful content
When content validation fails it is rather difficult to figure out the
cause if some meaningless byte mismatches another meaningless byte.
Let's store each memory location with its own virtual address so if a
mismatch occurs when reading it back it is obvious where it comes from.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2024-06-25 21:19:40 -04:00
Henrik Brix Andersen 771a362f4b soc: nxp: lpc: lpc55xxx: fix CONFIG_LPC55XXX_USB_RAM defaults
Setting a boolean Kconfig option default to "n" after having set it to "y"
does not make the option disabled. Instead, avoid setting default to "y"
for SoCs known not to have dedicated USB RAM.

Fixes: #73912

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2024-06-25 21:19:18 -04:00
Pisit Sawangvonganan 1e03106d75 net: ip: fix typo
Utilize a code spell-checking tool to scan for and correct spelling errors
in all files within the `subsys/net/ip` directory.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-06-25 21:19:00 -04:00
David Leach 96aad48be0 samples: sensor: qdec: fix mimxrt1050_evk build failure.
Recent PR turned on test case for twister which revieled a bug
with building the test case for RT1050 EVK. The touch_controller
DTS node was removed a by commit 57ad325e and further deprecated
by bde07beb5 when the platform was converted to tread displays as
shields.

Signed-off-by: David Leach <david.leach@nxp.com>
2024-06-25 21:18:47 -04:00
David Leach 28b91fddb7 MAINTAINERS: nxp drivers: add MarkWangChinese to NXP Drivers
Add MarkWangChinese to NXP drivers. He helps support USB, Bluetooth

Signed-off-by: David Leach <david.leach@nxp.com>
2024-06-25 19:15:35 -04:00
Sercan Erat 03ac4c80c0 boards: rak: rak11720: Add missing flag and fix wrong spi pins
Update dts file to use the new HCI api of apollo3 blue.
Fixing wrongly define spi cs pins for rak11720.

Signed-off-by: Sercan Erat <sercanerat@gmail.com>
2024-06-25 19:15:02 -04:00
Keith Packard 0491000c16 tests/kernel: Add test for constructors in C
Make sure constructors are run even when not using C++.

Signed-off-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-06-25 19:14:37 -04:00
Alberto Escolar Piedras 6e977ae2d5 lib c/cpp: Move .ctor .init_array handling from C++ to kernel
* Move ctors and init_array from the CPP library
  to the kernel library, as this is common for both C
  and C++ and it is the kernel who is running it.
* Rename the hidden kconfig option CPP_STATIC_INIT_GNU
  STATIC_INIT_GNU instead.
* If STATIC_INIT_GNU is not selected verify there is
  constructors left behind.
* Rename common-rom-cpp.ld to common-rom-init.ld
* Rename z_cpp_init_static to z_init_static,
  and have the kernel always call it.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
Signed-off-by: Keith Packard <keithp@keithp.com>
2024-06-25 19:14:37 -04:00
Félix Turgeon 5cd580ce44 scripts: coredump: Add register write handler to arm cortex-m gdbstubs.
When working with coredumps, it is useful to be able to modify base
registers. Adding this capability allows implementing scripts to
inspect backtrace of threads other than current the current thread.

Signed-off-by: Félix Turgeon <felixturgeon@meta.com>
2024-06-25 19:14:20 -04:00
Fabio Baltieri 766de73e08 doc: release: 3.7: add input release notes
Just few new drivers and two migrated ones.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2024-06-25 19:13:41 -04:00
Yong Cong Sin 9a8d1360cb posix: signal: use the provided argument in the macros
The `SIGNO_WORD_IDX` & `SIGNO_WORD_BIT` macros should have
used its own argument `_signo` instead of `signo`. It didn't
cause and error because the function's argument has `signo`.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2024-06-25 19:13:30 -04:00
Declan Snyder 3fe65eec7f samples: adc_dt: Move frdm_rw612 overlay to boards
The overlay was in the root of the sample folder instead of the boards
folder. This is clearly a mistake.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2024-06-25 19:13:15 -04:00
J. Neuschäfer a0d1d0619d arm: Fix typo in comment
Change "etxra" to "extra" in Kconfig comment.

Signed-off-by: J. Neuschäfer <j.ne@posteo.net>
2024-06-25 19:13:00 -04:00
Abe Kohandel de69ebd1f8 usb: correct udc_dev parameter name
Rename uhc_dev parameter of USBD_DEVICE_DEFINE macro to udc_dev to
reflect that this is a USB Device Controller device and not a USB Host
Controller device.

Signed-off-by: Abe Kohandel <abe.kohandel@gmail.com>
2024-06-25 14:16:48 -04:00
Luis Ubieda 089eaf93ec sensor: lm75: Enforce dependency of int-gpios with Trigger feature
As pointed out on #57586: `LM75_TRIGGER_GLOBAL_THREAD` can't be enabled
without the int-gpios being present in the DTS node. This commit
requires at least one LM75 instance featuring it, otherwise it won't
work.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2024-06-25 14:16:28 -04:00
Tomasz Leman a3835041bd intel_adsp/ace: power: Use MMU reinit API on core context restore
Replace the MMU initialization call with the new MMU re-initialization
API during the core context restore process in the ACE power management
code.

The previous code was directly calling `xtensa_mmu_init()` upon
restoring the core context, which is not appropriate when the MMU
context may have been preserved during low-power states. The new
`xtensa_mmu_reinit()` API is designed to re-establish the MMU context
without overwriting the existing page table, ensuring that any runtime
changes to the MMU configuration are retained.

Changes made in this patch:
- Removed the call to `xtensa_mmu_init()` from the
  `_restore_core_context()` function.
- Added a call to `xtensa_mmu_reinit()` after restoring the
  miscellaneous registers.

This update aligns the ACE power management code with the correct MMU
handling procedures when recovering from low-power states, as per the
recent changes in the Xtensa MMU support.

Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
2024-06-25 14:15:27 -04:00
Tomasz Leman a983a5e399 dts: xtensa: intel: Remove non-existent power domains from ACE30 PTL DTS
This patch removes definitions of power domains from the ACE30 PTL DTS
file that do not exist in the actual hardware.

The following power domain nodes have been removed:
- 'ml1_domain' with a bit-position of <13>
- 'io3_domain' with a bit-position of <11>
- 'io2_domain' with a bit-position of <10>

These nodes were previously included in the DTS file but do not
correspond to any physical power domain in the ACE30 PTL hardware. Their
presence in the DTS could lead to confusion and misconfiguration, as the
software might attempt to interact with non-existent hardware features.

By removing these nodes, the DTS now accurately reflects the hardware
capabilities of the ACE30 PTL platform, ensuring that the power
management infrastructure within the firmware operates based on the
correct hardware configuration.

Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
2024-06-25 14:15:27 -04:00
Tomasz Leman a2eada74c6 dts: xtensa: intel: Remove ALH nodes from ACE 3.0 PTL DTS
Remove the Audio Link Hub (ALH) nodes from the ACE 3.0 PTL DTS file.

This patch cleans up the Device Tree Source (DTS) for the ACE 3.0 PTL
platform by removing the definitions of the ALH DAI nodes. The ALH
interface is not utilized in the ACE 3.0 PTL architecture, making these
nodes redundant.

The following changes are made:
- Deleted the 'alh0' and 'alh1' nodes, which were previously defined
  with FIXME comments indicating a problematic modeling of individual
  ALH channels/instances using node labels.

This cleanup helps to prevent confusion and potential errors in device
configuration by ensuring that the DTS reflects the actual hardware
capabilities of the ACE 3.0 PTL platform.

Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
2024-06-25 14:15:27 -04:00
Tomasz Leman 442e697a8f dts: xtensa: intel: Reorder power domains by bit position in ACE30
Rearrange the power domain entries in the ACE30 PTL device tree source
file to be in ascending order according to their bit positions. This
reordering improves the readability of the device tree source by
grouping power domains logically according to their bit position within
the power management registers.

The changes in this patch include:
- Moving 'ml1_domain' and 'ml0_domain' to their correct positions
  according to their bit-position values (13 and 12, respectively).
- Adjusting the order of 'io3_domain', 'io2_domain', 'io1_domain', and
  'io0_domain' to reflect their bit positions (11, 10, 9, and 8).
- Placing 'hub_hp_domain' and 'hst_domain' at their new positions
  according to their bit-position values (6 and 5).

No functional changes are introduced with this patch. It solely aims to
make the device tree source more intuitive and easier to navigate when
mapping power domains to their respective control bits.

Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
2024-06-25 14:15:27 -04:00
Ievgen Ganakov d1b5d7092e intel_adsp: ace30: Correct power control register bitfield definitions
This patch updates the power control and status register bitfield
definitions in the ACE30 PTL ADSP power management header to match the
documented hardware specifications. The previous definitions contained
discrepancies that did not align with the actual hardware layout,
potentially leading to incorrect assumptions and usage within the
firmware.

Changes made in this patch:
- Renamed 'rsvd0' to 'rsvd4' to accurately represent the reserved bits
  starting at bit position 4.
- Removed the 'rsvd6' field, which was incorrectly defined and is not
  present in the hardware register layout.
- Adjusted the bit widths for 'ioxpgs' and 'mlpgs' to correctly reflect
  the number of bits these fields occupy in the hardware.
- Introduced a new 'rsvd15' field in both 'ace_pwrctl2' and
  'ace_pwrsts2' structures to account for the remaining reserved bits,
  ensuring the structure sizes accurately represent the full register
  width.

By correcting these bitfield definitions, the firmware's power
management code will now be consistent with the actual hardware design,
improving reliability and maintainability of the codebase.

Signed-off-by: Ievgen Ganakov <ievgen.ganakov@intel.com>
Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
2024-06-25 14:15:27 -04:00
Robert Lubos 4ba53a6325 samples: net: sockets: echo_client/server: Remove duplicate configs
A few configs in prj.conf were duplicated, remove duplicates.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-06-25 14:15:16 -04:00
Robert Lubos 67187f620b samples: net: sockets: echo_client/server: Bump ZVFS_OPEN_MAX config
Recent POSIX changes caused that 3 file descriptors are now preallocated
for stdin/out/err. This caused file descriptor shortage in all-in TLS
configuration of the sample, hence increase the maximum FD count.

In the server sample this manifested itself as an accept() error. This
triggered a busy loop though in the sample, as in case of accept()
errors it'd just try again w/o any delay. This made this issue hard to
investigate, so to avoid such cases in the future, make the accept()
failure fatal in the echo_server sample.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-06-25 14:15:16 -04:00
Robert Lubos fa27d706ea samples: net: sockets: echo_client/server: Bump DTLS max frag len
Echo samples exchange data fragments longer than the default DTLS max
fragment length introduced in commit
f033cd5601. Hence, need to increase this
config value for the sample.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-06-25 14:15:16 -04:00
Robert Lubos 9391ca9893 samples: net: sockets: echo_client: Bump NET_SOCKETS_POLL_MAX config
Commit 3046e95d85 introduced eventfd use
in the sample, increasing the pollfd array size, however the config
indicating maximum number of monitored events remained intact, so the
sample didn't really work.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-06-25 14:15:16 -04:00
Bartosz Sokolski 72197097ae drivers: i2s_nrfx: Fix division by 0 in divider calculation
Skip cases which would result in division by 0 in clock calculation

Signed-off-by: Bartosz Sokolski <bartosz.sokolski@nordicsemi.no>
2024-06-25 12:19:20 -04:00
Jonathon Penix afba61608e arm64: linker: lld: Handle symtab/strtab/shstrtab to fix warnings
lld will produce warnings for the symtab, strtab, and shstrtab sections
if --orphan-handling=warn is specified and there are no matching rules
in the linker script for these sections.

Handle these sections when building with lld to prevent the warnings.

Signed-off-by: Jonathon Penix <jpenix@quicinc.com>
2024-06-25 12:18:57 -04:00
Bjarki Arge Andreasen 9f867a1893 samples: net: cellular_modem: disable AT shell for NRF91_SLM
The NRF91_SLM has no additional AT channel for the AT shell to
use. This commit disables the AT shell for boards which use
the NRF91_SLM.

Signed-off-by: Bjarki Arge Andreasen <bjarki@arge-andreasen.me>
2024-06-25 12:18:40 -04:00
Bjarki Arge Andreasen a58abd0450 drivers: modem: cellular: correct user DLCI channels
The supported modems don't have the same number or assignment
of DLCI channels. For example, the NRF91_SLM only has DLCI
channel 3 assigned to GNSS tunneling, where the ublox sara r5
has DLCI 3 assigned to an additional AT channel, and DLCI 4
assigned to GNSS tunneling.

This commit updates the creation and assignment of DLCI
channels and pipelinks to match the capabilties of each modem.

Signed-off-by: Bjarki Arge Andreasen <bjarki@arge-andreasen.me>
2024-06-25 12:18:40 -04:00