Commit graph

82620 commits

Author SHA1 Message Date
Florian Grandel 7db0184e1b drivers: ieee802154: nRF5: remove RX PHR offset workaround
Builds upon the newly introduced nrf_802154_phr_timestamp_get() function
to calculate RX timestamps according to the timestamp definitions
introduced in earlier commits and removes the prior workaround to
calculate the start-of-frame message timestamp point.

Fixes: #59245

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2023-08-16 17:06:16 +02:00
Florian Grandel eacec3dad2 modules: openthread: radio: encapsulate OT 32-bit timestamp
OT does not have 64 bit timestamp support. This is a limitation of OT
and not of the IEEE 802.15.4 driver API. Therefore any workaround
related to such OT idiosyncracies should be encapsulated inside the OT
adapatation layer.

This change moves the OT-specific conversion of OT 32 bit timestamps to
Zephyr 64 bit timestamps into the OT adaptation layer.

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2023-08-16 17:06:16 +02:00
Chris Collins 2bf231f39a adc: ads1x1x: improve behaviour during i2c errors
Fixes #61401

The ADS1x1x driver has a bad habit of assuming i2c operations will
always suceed - this fixes the two worse cases in the code I could
identify (there may yet be more).

* During initial ADC setup, if either of the two I2C operations
  (read or write) fails, raise the error immediately to the caller
  rather than letting it fall through to the acquisition thread.

  This ensures that we only ever attempt to give a result that was
  definitely connected to our attempt to start the capture.

* If the acquisition thread encounters an I2C error, raise the error
  but do not terminate the aquisition thread.  This ensures the
  application can attempt to fix the condition that caused the I2C
  error and try again.

Signed-off-by: Chris Collins <kuroneko@sysadninjas.net>
2023-08-16 17:05:44 +02:00
Grant Ramsay 45701e696a kernel: sched: Disable FPU context when thread ends
When `CONFIG_FPU_SHARING` is enabled each `k_thread` struct has a saved
floating point context (`saved_fp_context`). During a context switch, the
current FPU owner's (`_current_cpu->arch.fpu_owner`) registers are saved
to its `saved_fp_context`, and the destination threads FPU registers are
loaded from its `saved_fp_context`.

When a thread ends, it does not release ownership of the FPU
(`_current_cpu->arch.fpu_owner`). This is problematic if the `k_thread`
struct was allocated on the stack. The next context switch will save the
FPU registers into `k_thread -> saved_fp_context` which may now be out of
scope. This will likely (but not always) result in a crash.

Adding `arch_float_disable(thread);` when a thread ends disables
preservation of floating point context information, fixing this issue

Signed-off-by: Grant Ramsay <gramsay@enphaseenergy.com>
2023-08-16 17:05:25 +02:00
Andrzej Głąbek 993cb30240 samples: blinky_pwm: Use nRF SW PWM driver on nRF DKs
The default nRF hardware PWM driver is not very suitable for this
sample as that driver does not allow setting a period longer than
~262 ms. Use the nRF SW PWM driver instead. This will also ensure
that the driver is built by CI for nRF52, nRF53, and nRF91 Series.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2023-08-16 16:33:03 +02:00
Andrzej Głąbek 839769e724 dts: arm: nordic: Move sw_pwm node to nrf_common.dtsi
Since the pwm_nrf_sw driver can now be used on all nRF SoCs, add its
corresponding DT node in the common file included by all those SoCs.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2023-08-16 16:33:03 +02:00
Andrzej Głąbek 88ab153ac4 drivers: pwm_nrf5_sw: Rename to pwm_nrf_sw
Since the driver can now be also used on nRF91 Series, its name need to
be updated to not cause confusion.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2023-08-16 16:33:03 +02:00
Andrzej Głąbek 8c1c666bab drivers: pwm_nrf5_sw: Extend to work also with DPPI
Instead of directly configuring PPI channels, use the GPPI helper
provided by nrfx. This allows using the driver on nRF53 an nRF91
Series where DPPI is available instead of PPI.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2023-08-16 16:33:03 +02:00
Andrzej Głąbek 9e860062b6 drivers: pwm_nrf5_sw: Use GPIOTE SET and CLR tasks when available
When possible, use separate GPIOTE tasks for setting the PWM output
high and low instead of using one task to toggle it. This is crucial
for DPPI where the same task cannot be used in more than one channel.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2023-08-16 16:33:03 +02:00
Andrzej Głąbek c43cef01fd drivers: pwm_nrf5_sw: Make proper use of 32-bit timers
When a 32-bit timer is configured as the generator, use its full
bit width.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2023-08-16 16:33:03 +02:00
Andrzej Głąbek b82f2d9ec2 drivers: pwm_nrf5_sw: Clear GPIOTE config only when switching to GPIO
Otherwise a glitch can appear on the PWM output when the GPIOTE channel
is reconfigured (when GPIOTE releases the pin, GPIO takes control and
drives it to the last written state which may be different than that
used recently by GPIOTE).

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2023-08-16 16:33:03 +02:00
Andrzej Głąbek b04fd975b6 drivers: pwm_nrf5_sw: Use nrfx HALs instead of direct register accesses
This makes the code easier to maintain.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2023-08-16 16:33:03 +02:00
Flavio Ceolin 3c1394c17a doc: vulnerabilities: Add information about CVE-2023-4265
Add information about CVE-2023-4265

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2023-08-16 15:05:35 +02:00
Alberto Escolar Piedras 732b03ced6 native_sim: Update native simulator to latest and align with it
Align with the latest upstream native simulator
4c595794588f9d7f67fcf0fe05c3db02892a00f9
including:

* 4c59579 Makefile: Add option to build native part
* 910f934 Makefile: NSI_EXTRA_INCLUDES option and lots of commentary
* d9bf489 cmd line parsin: Minor header refactoring
* 02f3555 cmd line cleanup: Run as NSI_TASK instead of calling expl.
* 2c88173 Split exit call in two
* 2b989b4 CPU IF change: nsif_cpu0_cleanup() to return int
* e696228 HW scheduler: Add API to get next event time
* ae0e9e8 native irq ctrl: Miscellaneous fixes and improvements
* 3fd84cd NSI_TASK: Add compile check of valid priority
* 7e09fb8 HW events: Change internal storage

And two minor updates to the native_sim board,
to align with this updated version:
* nsif_cpu0_cleanup(void) now must return an int
* We need to explicitly tell the native simulator build we want
  the native components built

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-08-16 15:05:12 +02:00
Andrei Emeltchenko 451c4779c8 fs: ext2: Fix dereference before NULL check
It does make sense to dereference after NULL check.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-08-16 15:04:48 +02:00
Andrei Emeltchenko 5d05b41b6a fs: ext2: Correct structure initialization
Correct structure initialization for ext2_lookup_args structre.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-08-16 15:04:48 +02:00
Andrei Emeltchenko 7d4c84b8a8 fs: ext2: Fix buffer overun
Rearrange check to make sure we do not access inode_pool[MAX_INODES].

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-08-16 15:04:48 +02:00
Andrei Emeltchenko 4170eb2433 fs: ext2: Remove comparing unsigned < 0
Remove never true comparisons for ext2.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-08-16 15:04:48 +02:00
Bi Jian 243516e6e5 bluetooth: audio: fix code comments error
Added PB_Flag 0b10:The ISO_SDU_Fragment field contains a complete SDU.

Signed-off-by: Bi Jian <bi_jian@qq.com>
2023-08-16 15:04:28 +02:00
Manuel Argüelles 5d3d4eb8b0 tests: syscalls: add faulty address for s32z270dc2_r52 boards
Default faulty address does not generate the expected fault on the
s32z270dc2_r52 boards.

Signed-off-by: Manuel Argüelles <manuel.arguelles@nxp.com>
2023-08-16 15:04:14 +02:00
Sylvio Alves bcb59b8f46 soc: esp32s3: fix heap_sentry reference
Fix heap_sentry value to point final useful stack area.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2023-08-16 15:03:57 +02:00
Benjamin Cabé d0d3f1446a boards: Add OpenOCD runner to bbc_microbit*
Add the ability to flash/debug BBC micro:bit boards using OpenOCD.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2023-08-16 15:03:06 +02:00
Grzegorz Swiderski 199cc7f91b cmake: Fix scope pollution in zephyr_get(... MERGE)
Clear the output variable with an empty string, before appending to it.
Unsetting the variable locally is insufficient, because its value from
the parent scope or cache can still creep into the final result.

Signed-off-by: Grzegorz Swiderski <grzegorz.swiderski@nordicsemi.no>
2023-08-16 15:01:57 +02:00
Grzegorz Swiderski 7f4b1abb39 cmake: Don't lose global sysbuild value with zephyr_get(... MERGE)
According to the doc comment:

  If using MERGE then SYSBUILD GLOBAL will get both the local and global
  sysbuild scope variables (in that order, if both exist).

This stopped working in commit 8460d91e32,
when support for `zephyr_get(... VAR <multiple-variables>)` was added.

Instead of returning both values, the local sysbuild scope value would
clobber the global one. Fix this by splitting the internal `sysbuild`
scope into `sysbuild_local` and `sysbuild_global`, in that order.

Signed-off-by: Grzegorz Swiderski <grzegorz.swiderski@nordicsemi.no>
2023-08-16 15:01:57 +02:00
Grzegorz Swiderski 5ef7229a8c tests: cmake: Add zephyr_get
As `zephyr_get()` grows in complexity and significance, it must continue
working as expected. Unfortunately, it has a few minor bugs already, but
they will be taken care of in the next few commits. Before that, though,
let's go ahead and add a test suite for this function.

For now, some tests will pass by using incorrect values, annotated with
the `# BUG` comments; they will be removed in later patches. The purpose
of having them now is to make it easier to see what's about to be fixed.

Signed-off-by: Grzegorz Swiderski <grzegorz.swiderski@nordicsemi.no>
2023-08-16 15:01:57 +02:00
Daniel Leung d59944465a arch: common: use zephyr_library for all source files
The zephyr_library() used to only be called if
CONFIG_GEN_ISR_TABLES is enabled. Which means that any
zephyr_library_*() calls are putting things into another
library if CONFIG_GEN_ISR_TABLES is disabled. So pull
the call to zephyr_library() to outside. Also moves
semihost.c into the library.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-08-16 15:00:49 +02:00
Diego Elio Pettenò 905652fc15 atsamd2x_xpro: follow best practices.
This updates the configurations for these two boars to match the expected
best practices for new boards, as discussed in #61140.

Signed-off-by: Diego Elio Pettenò <flameeyes@meta.com>
2023-08-16 15:00:25 +02:00
Andreas Deininger 8f66f854c3 ci: Bump checkout action to latest version
Bump checkout action to latest version v3

Signed-off-by: Andreas Deininger <andreas@deininger.net>
2023-08-16 14:59:16 +02:00
Parthiban Nallathambi 2c4fb882bb modbus: use macro for function code for input register
use MODBUS_FC04_IN_REG_RD for input register reading function code 4.

Signed-off-by: Parthiban Nallathambi <parthiban@linumiz.com>
2023-08-16 14:58:47 +02:00
Diego Elio Pettenò 00dadc6c38 doc: use a linked reference rather than a GitHub reference.
Instead of sending the user out of the documentation site to GitHub
to read the testing instructions, link to the generated page for the
documentation.

Signed-off-by: Diego Elio Pettenò <flameeyes@meta.com>
2023-08-16 14:58:20 +02:00
YuLong Yao 0ad0dea200 driver: wifi: esp32: fix esp32_wifi_send not work in ap mode
use `ESP_IF_WIFI_AP` when call esp32_wifi_send in ap mode

Signed-off-by: YuLong Yao <feilongphone@gmail.com>
2023-08-16 14:56:27 +02:00
Moritz Fischer 9e8a8b4e85 soc: arm: common: cortex_m: Move arm_mpu_mem_cfg.h
Move arm_mpu_mem_cfg header to common include directory.

The benefits are two-fold:
- Allow for out of tree SoC definitions to use them to
  define mpu_regions.
- Remove odd relative include path

Signed-off-by: Moritz Fischer <moritzf@google.com>
2023-08-16 14:56:06 +02:00
Andrei Emeltchenko 0f96355b98 soc: raptor_lake: Disable watchdog by default
Without status line, watchdog is enabled by default. The desired
behaviour is to have it disabled and enable only when watchdog
is used, with overlay files. The same way how it is done for
samples/drivers/watchdog and tests/drivers/watchdog/wdt_basic_api.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-08-16 14:54:17 +02:00
Daniel DeGrasse d8bdddd52f arch: arm: aarch32: introduce CONFIG_BUILD_ALIGN_LMA
Introduce CONFIG_BUILD_ALIGN_LMA. When enabled, this symbol will add a
padding section after the final read only data section in the image.
This padding section will ensure that the LMA of the data sections
follows the same alignment restrictions as the VMA does. This LMA alignment
is needed for objcopy to adjust the LMA address of the output ELF file.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2023-08-16 14:53:58 +02:00
Daniel DeGrasse c255130910 boards: shields: rk055hdmipi4ma0: add probe address to RT595-EVK
Add probe address setting to RT595-EVK, to work around board issue with
routing of INT GPIO that prevents GPIO from being set to output mode.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2023-08-16 14:53:03 +02:00
Anisetti Avinash Krishna f6aa3e8adb drivers: gpio: gpio_intel: Corrected offset to check PMODE
Corrected offset to read PMODE to check function number.

Signed-off-by: Anisetti Avinash Krishna <anisetti.avinash.krishna@intel.com>
2023-08-16 14:52:47 +02:00
Fabio Baltieri f2e275639d ethernet: smsc91x: rework the device node hierarchy
Rework the devicetree definition for smsc91x to put the mdio and
ethernet device at the same level, and make the phy a child of the mdio
node.

This allows matching up the device initialization sequence with the
devicetree hierarchy.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-08-16 14:52:31 +02:00
Fabio Baltieri e9e111b513 ethernet: smsc91x: fix a build warning
Move few variable inside a case statement to avoid build warning for
unused variables in some specific configuration.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-08-16 14:52:31 +02:00
Fabio Baltieri acbb7a39bb ethernet: smsc91x: select MDIO
This driver implements an MDIO device. Enable the MDIO driver to avoid a
build error for:

orphan section `._device.static.3_CONFIG_MDIO_INIT_PRIORITY_'

Also set the proper compatible in mdio_shell so that the ethernet tests
build correctly.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-08-16 14:52:31 +02:00
Andrei Emeltchenko 530d16915a boards: acrn: Fix documentation spelling
Simple documentation fix.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-08-16 14:51:56 +02:00
Andrzej Głąbek ff0f389d0b dts: bindings: adc-controller: Add zephyr,differential property
Add a property that allows explicit selection of the differential
input mode for ADC channels in DTS. This is useful for controllers
that do not have configurable inputs, so the zephyr,negative-input
property that implicitly selects the differential mode is not
specified for them.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2023-08-16 14:51:03 +02:00
Christophe Dufaza ad48c51651 devicetree: edtlib: prefixes which are not vendors are NOT vendors
In Linux, checkpatch.pl relies on the vendor-prefixes.yaml file
to validate manufacturers in compatible strings.
In addition to the vendors defined in vendor-prefixes.txt,
the YAML file includes expressions for "prefixes which are not vendors":
these expressions do NOT define special manufacturers that may appear
in compatible strings, and are never involved as such in DTS files.
We can rather see them as bulk-definitions of JSON/YAML properties
suitable for the dt-schema tools.

OTHO, in Zephyr, checkpatch.pl relies on the vendor-prefixes.txt file,
which does not include these additional prefixes, but edtlib.EDT adds
them as hard-coded special values.

This is confusing, if not incorrect:

- the fact that edtlib.EDT (and thus its client code in the
zephyr/scripts directory) actually allows these vendors
in compatible strings is buried in the source code
- checkpatch.pl (with vendor-prefixes.txt) in Zephyr behaves neither like
checkpatch.pl (with vendor-prefixes.yaml) in Linux, nor like edtlib.EDT
(with _VENDOR_PREFIX_ALLOWED)
- Zephyr should not treat these "prefixes which are not vendors" as
valid manufacturers in compatible strings to begin with

Signed-off-by: Christophe Dufaza <chris@openmarl.org>
2023-08-16 14:50:26 +02:00
Benedikt Schmidt 9555cf2f72 CODEOWNERS: add codeowner of MAX31790
Add myself as codeowner of the previously committed PWM
driver for the MAX31790.

Signed-off-by: Benedikt Schmidt <benedikt.schmidt@embedded-solutions.at>
2023-08-16 14:49:50 +02:00
Benedikt Schmidt 8cd463e035 CODEOWNERS: add codeowner of STM32L451
Add myself as codeowner of the previously committed SoC
STM32L451.

Signed-off-by: Benedikt Schmidt <benedikt.schmidt@embedded-solutions.at>
2023-08-16 14:49:50 +02:00
Benedikt Schmidt 69ff3e4f2e CODEOWNERS: add codeowner of PCAL64XXA
Add myself as codeowner of the previously committed GPIO
expander driver for the PCAL64XXA.

Signed-off-by: Benedikt Schmidt <benedikt.schmidt@embedded-solutions.at>
2023-08-16 14:49:50 +02:00
Benedikt Schmidt 0a5f00874d CODEOWNERS: add codeowner of BD8L600FS
Add myself as codeowner of the previously committed GPIO
expander driver for the BD8L600FS.

Signed-off-by: Benedikt Schmidt <benedikt.schmidt@embedded-solutions.at>
2023-08-16 14:49:50 +02:00
Benedikt Schmidt d6f3473a56 CODEOWNERS: add codeowner of ADS114S0X
Add myself as codeowner of the previously committed ADC
driver for the ADS114S0X.

Signed-off-by: Benedikt Schmidt <benedikt.schmidt@embedded-solutions.at>
2023-08-16 14:49:50 +02:00
Benedikt Schmidt c40d83be04 CODEOWNERS: add codeowner of STM32H735
Add myself as codeowner of the previously committed SoC
STM32H735 and its disco board.

Signed-off-by: Benedikt Schmidt <benedikt.schmidt@embedded-solutions.at>
2023-08-16 14:49:50 +02:00
Magdalena Kasenberg 7bf502d806 Bluetooth: Audio: Fix missing setting of data and meta len
A recent refactor of bt_audio_codec_cap to flat arrays missed setting
data_len and meta_len fields.

Signed-off-by: Magdalena Kasenberg <magdalena.kasenberg@codecoup.pl>
2023-08-16 14:48:11 +02:00
Magdalena Kasenberg cce76eed24 bluetooth: tester: bap: Add support for BAP/USR tests
Extend Codec capabilities of the server.

At Codec Config operation initiated autonomously by server, all ASEs
with lower IDs than the requested one have to be initated first due
to API limitation.

In some BAP/USR (server role) test cases the PTS sends the MMI 202
to configure the Sink ASE to streaming state, in some others it does not.
For now, let's autonomously send Receiver Start Ready at ASE Enabled.

Signed-off-by: Magdalena Kasenberg <magdalena.kasenberg@codecoup.pl>
2023-08-16 14:48:11 +02:00