Commit graph

93856 commits

Author SHA1 Message Date
Wilfried Chauveau 72312feead arch: arm: cortex_m: Use cmsis api instead of inline asm in arch_irq_*
Asm is notoriously harder to maintain than C and requires core specific
adaptation which impairs even more the readability of the code.

Signed-off-by: Wilfried Chauveau <wilfried.chauveau@arm.com>
2024-04-15 09:09:28 -07:00
Wilfried Chauveau 8e55468af2 arch: arm: cortex_m: use C rather than asm in isr_wrapper & exc_exit
Asm is notoriously harder to maintain than C and requires core specific
adaptation which impairs even more the readability of the code.

This is a first step in reducing the amount of ASM in arch/arm/cortex_m

Signed-off-by: Wilfried Chauveau <wilfried.chauveau@arm.com>
2024-04-15 09:09:28 -07:00
Wilfried Chauveau 85feaa60e2 arch: arm: cortex_m: Use r* register names rather than v*
v* register aliases are uncommon and it can be surprising to find them.
This change makes use of r* register names for a more consistent
experience of reading assembly.

Signed-off-by: Wilfried Chauveau <wilfried.chauveau@arm.com>
2024-04-15 09:09:28 -07:00
Wilfried Chauveau 4c3f6ea5b2 arch: arm: cortex_m: Document why __aeabi_read_tp impl requires ASM impl
This method has special ABI requirement that requires the use of ASM.
This change documents why this is required & adds reference to the
related specification.

Signed-off-by: Wilfried Chauveau <wilfried.chauveau@arm.com>
2024-04-15 09:09:28 -07:00
Jamie McCrae a2ed8162c8 cmake: modules: boards: Add normalised variables
Adds a new variable NORMALIZED_BOARD_QUALIFIERS which contains
the board qualifiers in file-name format, this allows for
constructing strings in applications (e.g. for folder names) prior
to Zephyr being found for things like APPLICATION_CONFIG_DIR. Also
adds NORMALIZED_BOARD_TARGET.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2024-04-15 08:31:55 -07:00
Kai Vehmanen 7fd0a7a5eb soc: intel_adsp: replace icache ISR workaround with custom idle solution
A workaround to avoid icache corruption was added in commit be881d4cf2
("arch: xtensa: add isync to interrupt vector").

This patch implements a different workaround by adding custom logic to
idle entry on affected Intel ADSP platforms. To safely enter "waiti"
when clock gating is enabled, we need to ensure icache is both unlocked
and invalidated upon entry.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2024-04-15 16:26:39 +02:00
Marek Matej 213bad1de0 soc: espressif: add missing linker symbols
Provide missing symbols to the default linker scripts.

Signed-off-by: Marek Matej <marek.matej@espressif.com>
2024-04-15 16:26:20 +02:00
Lukasz Mrugala a0d1b778a4 scripts: twister: Fix overbroad Mock in environment unit tests
os.path.abspath was mocked too broadly, leading to errors for some users,
while being undetected in the CI.
This change narrows down the mock effect, fixing the problem.

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
2024-04-15 16:25:51 +02:00
Jonathan Rico 0794b22c9c Bluetooth: l2cap: Fix SDU buffer leak
`ret` is the amount sent from the current buffer. `sent` contains the
total amount that was transferred in the while loop.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2024-04-15 16:24:12 +02:00
Alberto Escolar Piedras becf4c1c81 tests/bsim: Fix not detecting failures
b0339136c1
Broke the check for failed bsim tests.
Let's fix it.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-04-15 16:24:12 +02:00
Torsten Rasmussen 4959a0241e cmake: fix issue with parsing version file located in /VERSION
Fixes: #71384

A VERSION file placed in `/` or `<drive>:\` was accidentally being
picked up during `find_package(Zephyr)`.

This happened because Zephyr loads the VERSION file to determine if it
is the correct Zephyr to use.

During initial phase of find_package(), then APPLICATION_SOURCE_DIR is
not defined, causing one version file to be picked up from `/VERSION`
instead of `<app>/VERSION`. `/VERSION` is outside any Zephyr repo, west
workspace, or the application itself and therefore should not be picked
up accidentally.

Fix this be checking that APPLICATION_SOURCE_DIR is defined, and only
when defined, look for a VERSION file there.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2024-04-15 14:05:38 +02:00
Bartosz Sokolski e1ef3e41de boards: nrf54l15pdk_nrf54l15_cpuapp: add twister yaml for PDK 0.3.0
add twister yaml to support PDK 0.3.0 in tests

Signed-off-by: Bartosz Sokolski <bartosz.sokolski@nordicsemi.no>
2024-04-15 05:03:47 -07:00
Emil Gydesen 2b7f5dce25 Bluetooth: Audio: Shell: Runtime config of CAP/GMAP ACs
Modifies the audio configuration (ac) commands for CAP
and GMAP to use the default presets instead of supplying
the preset as arguments. This will allow the user to
use the `bap preset` command to configure everything in the
codec configuration before the AC commands are issued.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-04-15 12:56:33 +02:00
Emil Gydesen dd7e77b77c Bluetooth: BAP: Shell: Fix bad PA sync ref for sink auto scan
When creating a broadcast sink using the auto scan feature,
the call to bt_le_per_adv_sync_create would use a local
PA sync pointer, instead of one from the per_adv_syncs
array, making it impossible to stop the PA sync afterwards.

This commit modifed the auto_scan so that it properly uses
the per_adv_syncs array, while still assigning the PA sync
in the shell broadcast sink struct.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-04-15 12:55:52 +02:00
Emil Gydesen 24f0a83326 Bluetooth: Audio: Shell: Fix chan alloc print for mono
The print_codec_cfg_chan_allocation did not take the case where
chan_allocation == BT_AUDIO_LOCATION_MONO_AUDIO into account,
in which case it should print "Mono".

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-04-15 12:55:35 +02:00
Emil Gydesen 06b31aa4b9 docs: Bluetooth: Audio: Add notes on the design and data placements
Add notes on how the LE Audio stack is designed and why data is
sometimes placed and controlled by the stack or the application.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-04-15 12:54:58 +02:00
Brad Kemp 3e2c067010 net: wifi: shell: update wifi ap enable to use get opt parsing
The commit 8256d02d3a introduced
getopt parsing for the wifi connect command
This needs to be updated for the wifi ap enable since ap
enable also uses the same parsing as connect.
The use of getopt removes the parameter ordering restrictions

Signed-off-by: Brad Kemp <brad@beechwoods.com>
2024-04-15 12:53:47 +02:00
Krzysztof Chruściński 685e6cec9b drivers: serial: nrf: Adapt config dependencies to nrf54h20
DT nodes and compatible had been renamed and Kconfig option was relying
on the names that do not exists.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2024-04-15 12:53:09 +02:00
Juliane Schulze ca92f96f41 drivers: lis2dh: read reference register prior to wakeup
Fixes #71371

Signed-off-by: Juliane Schulze <juliane.schulze@deveritec.com>
2024-04-15 12:52:39 +02:00
Robert Lubos 9a52efb29e tests: net: tcp: Replace test case numbers with enums
So far test cases in TCP test suite were represented by magic numbers.
With the increasing size of this test suite, it started to become
troublesome to follow, which number represents which test case or what
number can a new test case get.

Introduce a new enum for the test suite, which can be used to represent
individual test case. It simplifies adding new test cases (test case ids
are now defined in a single place, so easier to extend), and also
improves code readability.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-04-15 12:51:52 +02:00
Robert Lubos b1adbbe0be tests: net: tcp: Add test case verifying FIN with data processing
Verify, that when TCP stack received FIN packet containing data bytes,
the data is provided to the application and respective seq/ack counters
are updated respectively.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-04-15 12:51:52 +02:00
Robert Lubos a0f0e55668 net: tcp: Fix FIN with data handling
In case FIN packet included data bytes, Zephyr would ignore the
data. It wasn't passed to the application, and it wasn't considered
when bumping the ACK counter. This ended out in connection timing out,
instead of being properly terminated.

Fix this, by refactoring FIN processing in TCP_ESTABLISHED state.
Instead of handling FIN/FIN,ACK/FIN,ACK,PSH cases separately, have a
common handler when FIN flag is present, and when ACK flag is present
along with FIN. When FIN is present, take any potentially incoming data
into account.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-04-15 12:51:52 +02:00
Caleb Perkinson 2fc42054a5 doc: correct sparkfun,serlcd.yaml
yaml file did not match device tree bindings.

Signed-off-by: Caleb Perkinson <calebperkinson@gmail.com>
2024-04-14 15:39:34 -07:00
Gaetan Perrot 0b51d37f35 posix: Implement test for isastream
Add tests for `isastream()`

signed-off-by: Gaetan Perrot <gaetanperrotpro@gmail.com>
2024-04-13 20:23:34 -04:00
Gaetan Perrot 4f9338a66b doc: posix: mark isastream as supported
`isastream ()` is now implemented, mark it so.

signed-off-by: Gaetan Perrot <gaetanperrotpro@gmail.com>
2024-04-13 20:23:34 -04:00
Gaetan Perrot 51439f012a posix: Implement isastream
`isastream()` is required as part of _XOPEN_STREAMS Option Group.

signed-off-by: Gaetan Perrot <gaetanperrotpro@gmail.com>
2024-04-13 20:23:34 -04:00
Théo Battrel 4a30aab2ae ci: compliance: Update Kconfig check
Take into account the Kconfig symbols in tests and samples that are
defined using the logging template.

This avoid using the `UNDEF_KCONFIG_WHITELIST` for those symbols.

Update the list to remove the symbols that were added for that reason.

Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
2024-04-13 07:17:45 -04:00
Mike J. Chen 5518b0c698 drivers: i3c: i3c_mcux: retry when timeout occurs in emit stop
Have seen timeout error occur when doing an emit stop at
end of a multiple register write to a mmc5633 mag sensor IC.
The i3c_mcux driver would return on such an error without
doing the k_condvar_broadcast(), since the stop wasn't
technically done (or unclear if it was), and then future
transfers requests waiting on the condvar could be blocked
forever. Add a limited retry when a timeout occurs to
avoid such a stall condition from happening.

Signed-off-by: Mike J. Chen <mjchen@google.com>
2024-04-13 07:05:36 -04:00
Aleksander Wasaznik a64d20f6f0 Bluetooth: host: sched-lock bt_recv()
`bt_recv` is invoked from the BT long work queue, which is preemptible.
The host uses cooperative scheduling to ensure thread safety.

Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
2024-04-13 07:05:20 -04:00
Dominik Ermel 78ddcdd6fa tests/disk_access: Add flash-disk overlay for testing
Adds native_posix overlay and modifies code to allow testing
flash-disk access.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2024-04-13 07:04:24 -04:00
Mahesh Mahadevan e37d1a5489 dts: nxp_mcxn94x: Add DMA channels for FlexComm nodes
Copy the DMA channel information to both UART and SPI
instances of the Flexcomm as only one of them can be
active.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2024-04-13 07:03:55 -04:00
Aleksandar Cecaric 0144ed6b63 arch: riscv: update coredump for 64BIT RISCV
Add RISCV 64bit registers and parse them in coredump script.

Signed-off-by: Aleksandar Cecaric <aleksandar.cecaric@nextsilicon.com>
2024-04-13 07:03:23 -04:00
Celina Sophie Kalus 325f22a16f tests: posix: eventfd: Add ioctl F_SETFL test
Add a test to protect against future regressions in the ioctl F_SETFL
operation of eventfd. Flags are set and unset and validity of the file
descriptor is checked by reading and writing.

Signed-off-by: Celina Sophie Kalus <hello@celinakalus.de>
2024-04-13 06:00:08 -04:00
Celina Sophie Kalus 5bd86eaddb posix: eventfd: Fix unsetting internal flags in ioctl
Commit e6eb0a705b ("posix: eventfd: revise locking, signaling, and
allocation") introduced a regression where the internal flags of an
event file descriptor would be erased when calling the F_SETFL ioctl
operation.

This includes the flag EFD_IN_USE_INTERNAL which determines whether
this file descriptor has been opened, thus effectively closing the
eventfd whenever one tries to change a flag.

Signed-off-by: Celina Sophie Kalus <hello@celinakalus.de>
2024-04-13 06:00:08 -04:00
Declan Snyder 12f48fe896 doc: services: pm: Reword System PM Doc
The following changes:
- Generally reword all the paragraphs to hopefully by clearer and
  easier to read by using more straighforward and direct wording,
  and avoiding run on sentences and ambiguous/wrong grammar, etc.
- Move Examples to the bottom of the page.
- Fix a typo in the code expression where there was an extra
  parentheses.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2024-04-12 21:56:35 -04:00
Emilio Benavente 8adb7c17ca boards: nxp: frdm_mcxn947: PWM Support
Updated frdm_mcxn947 to add FlexPWM Support,
including updating the docs file.

Signed-off-by: Emilio Benavente <emilio.benavente@nxp.com>
2024-04-12 16:53:03 -04:00
Emilio Benavente d2bfed764c dts: arm: nxp: nxp_mcxn94x: Add PWM Support
Added the dts node for FlexPWM Support.

Signed-off-by: Emilio Benavente <emilio.benavente@nxp.com>
2024-04-12 16:53:03 -04:00
Laurentiu Mihalcea 94d156c9c8 nxp: imx8ulp: enable serial interface
Enable serial interface on i.MX8ULP.

This also includes a SHA update for hal_nxp which
pulls in the following commits relevant to Zephyr:

* 3366f234ed47 build: hal_nxp: add TPM counter support
* 6544455fcf46 Compile in PXP driver if LVGL is set to use
PXP.
* 31463a848bcd devices: MIMX8UD7: add definition for
LPUART_RX_TX_IRQS

Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
2024-04-12 16:52:38 -04:00
Ricardo Rivera-Matos 30b27c73c3 regulator: cp9314: Cleans sleep related preprocesor directives
Removes conditional calling k_busy_wait() on single threaded
systems and uses k_sleep for both single and multi threaded
systems.

Commit e375d82 ("kernel: Implement k_sleep for Single Thread")
eliminated the need to call k_busy_wait() on single threaded
systems in place of k_sleep.

Signed-off-by: Ricardo Rivera-Matos <rriveram@opensource.cirrus.com>
2024-04-12 16:52:18 -04:00
Ricardo Rivera-Matos 7afc5932f0 regulator: regulator_common: Cleans sleep related preprocesor directives
Removes conditional calling k_busy_wait() on single threaded
systems and uses k_sleep for both single and multi threaded
systems.

Commit e375d82 ("kernel: Implement k_sleep for Single Thread")
eliminated the need to call k_busy_wait() on single threaded
systems in place of k_sleep.

Signed-off-by: Ricardo Rivera-Matos <rriveram@opensource.cirrus.com>
2024-04-12 16:52:18 -04:00
Marcin Niestroj 3431d09f09 drivers: wifi: esp_at: fix missing channel in scan result
WiFi scan results were not updated with information about channel, after
scan results parsing was updated. Fix that.

Fixes: a6b06004c2 ("drivers: wifi: esp_at: handle commas in SSIDs during
  scan and status")
Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2024-04-12 16:51:52 -04:00
Alberto Escolar Piedras e41ed3886f manifest: Update nRF hw models to latest
* Update the HW models module to
123d37db9cae528d51530c61ba0422192bc03bda

Including the following:
* 123d37d RTC: Fix for TASKS_TRIGOVRFLW with stopped counter

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-04-12 16:51:23 -04:00
Jukka Rissanen 9324723889 net: pkt: Remove obsolete and not used TCP flag
The tcp_first_msg field is no longer used so remove it.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-04-12 16:50:59 -04:00
Marc Herbert 89493ee56b Revert "toolchain: gcc: Simplify GEN_ABSOLUTE_SYM and GEN_ABSOLUTE_SYM_KCONFIG"
This reverts commit 87779e73f8.

Commit 87779e73f8 ("toolchain: gcc: Simplify GEN_ABSOLUTE_SYM and
GEN_ABSOLUTE_SYM_KCONFIG") "unified the variants from using a
target-specific dialects to a target-agnostic solution". While reducing
duplication is always desired, this "unification" got rid of some
differences between architectures. Among others, this commit generalized
the use of the `c` constant operand modifier in the `GEN_ABSOLUTE_SYM()`
macro. Before this commit, the `c` modifier was NOT in use in a number
of architectures!

Generally speaking, reducing copy/paste/diverge must always be performed
in _two_ distinct phases with ample testing time between the two phases:

1. First, perform functional changes that remove the divergence.

   < give plenty enough time for testing >

2. Finally, remove the identical copies.

More specifically, I understand the `c` modifier may be required by some
architectures, but it's causing problems on other(s). Notably, it broke
the build with one pre-C11, gcc-based Xtensa toolchain:

```
14:03:17 kernel_offsets.h: Assembler messages:
14:03:17 kernel_offsets.h:28: Error: bad expression
14:03:17 kernel_offsets.h:28: Error: junk at end of line,
                                first unrecognized character is `c'
14:03:17 kernel_offsets.h:29: Error: bad expression
14:03:17 kernel_offsets.h:29: Error: junk at end of line,
                                first unrecognized character is `c'
...
```

While newer Xtensa toolchains accept `c`, they also ignore it. `c` makes
no difference whatsoever with all the (working) Xtensa toolchains I
tested. So for `Xtensa`, `c` is a best useless and at worse breaking the
build.

Up to gcc version 12 (2022), the `c` constant modifier was documented as
X86-specific!
https://gcc.gnu.org/onlinedocs/gcc-12.3.0/gcc/Extended-Asm.html#x86Operandmodifiers

Only starting with gcc version 13 (2023), the `c` modifier was
officially supported as "generic":
https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/Extended-Asm.html#Generic-Operand-Modifiers

`c` was very likely working with other architectures before 2023, but
not officially and we don't know which architectures and we don't know
when.

Note toolchain/gcc.h is included by toolchain/llvm.h and also used by
clang. The status of `c` across clang versions is unknown.

While I personally hate copy/paste/diverge with a passion, these macros
GEN_ABSOLUTE_SYM() and GEN_ABSOLUTE_SYM_KCONFIG() are very small so that
particular duplication is very reasonable. Architecture-specific code is
tricky and portability across toolchain and toolchain versions even
more. Testing low-level changes like this across different architectures
would also require demanding and unlikely coordination across different
architectures/companies.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2024-04-12 15:30:40 -04:00
Seppo Takalo 51d80a9838 net: lwm2m: Allow CoAP block size to be changed
Allow changing the CoAP Block-wise transfers block-size
for subsequent GET requests.

It looks like Leshan switches block size back to its
configured value, if it is smaller.
So even when we send block N=0 with size of 512, Leshan
seem to handle that properly but still asks N=2 with
block size 256(if that is configured).

Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
2024-04-12 09:14:36 -04:00
Ayush Singh 71437f71df samples: net: sockets: echo_client: Enable subg tcp
- TCP should not be disbled by default for subg in this particular
  sample since it is mostly used to test network rather than
  performance.

Signed-off-by: Ayush Singh <ayushdevel1325@gmail.com>
2024-04-12 15:03:57 +02:00
Ayush Singh e9963be3af samples: net: sockets: echo_server: Enable subg tcp
- TCP should not be disbled by default for subg in this particular
  sample since it is mostly used to test network rather than
  performance.

Signed-off-by: Ayush Singh <ayushdevel1325@gmail.com>
2024-04-12 15:03:57 +02:00
Alberto Escolar Piedras 4f7b144ef6 arch posix: When building for the native_simulator only link ASAN once
Only request the linker to link ASAN in the final stage, not
during the partial linking stage.
This fixes a link issue when building with llvm.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-04-12 15:03:35 +02:00
Alberto Escolar Piedras b59b21f8bb arch posix: pass -fsanitize-recover=all also to native_simulator build
If the CONFIG_ASAN_RECOVER option is set, also pass
-fsanitize-recover=all to the build of the native simulator
built files.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-04-12 15:03:35 +02:00
Alberto Escolar Piedras 1fcc245eda native_simulator: Get latest from upstream
Align with native_simulator's upstream main
6f6b359c4fe26ddeed8a65ad55f5bc402d3b7f91

Which includes:
* 6f6b359 Avoid issue with llvm address sanitizer

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-04-12 15:03:35 +02:00