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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
* 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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>