Compare commits

...

118 Commits

Author SHA1 Message Date
Vinayak Kariappa Chettimada
4ebecae78a Bluetooth: Controller: Fix connection update interval_us variables
Fix connection update microsecond interval variable data
type, to use 32-bit so that a value upto 2000 seconds, i.e.
4 seconds interval and 499 peripheral latency can be stored.

Regression in commit abfe5f17a9 ("Bluetooth: Controller:
1 ms connection").

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
(cherry picked from commit 0a4480ce61)
2025-07-11 11:24:10 -10:00
Glenn Andrews
5e24e48342 boards: disco_l475_iot1: fix arduino_i2c assignment
0f05f58bf5 assigned the `arduino_i2c` to the incorrect pins for the Arduino UNO connector. This assigns them back.

signed-off-by: Glenn Andrews <glenn.andrews.42@gmail.com>
(cherry picked from commit a2da571172)
2025-07-10 06:27:54 -10:00
Benjamin Cabé
6753a86f27 doc: _templates: show correct version in sidebar in case of releases
Ensure that version indicator in sidebar is correct in case of releases.

Fixes zephyrproject-rtos/zephyr#91799.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
(cherry picked from commit bbfaf8adec)
2025-06-23 13:04:19 -07:00
Fabian Blatz
aabd3a1826 modules: lvgl: Register print callback after lv_init
Move initialization of the print callback handler after calling lv_init, as
the latter zeroes the global callback structure.

Signed-off-by: Fabian Blatz <fabianblatz@gmail.com>
(cherry picked from commit 5cffb8e5a6)
2025-06-05 13:07:45 -07:00
Henrik Brix Andersen
5bef9327b0 tests: drivers: virtualization: qemu_kvm_arm64.overlay: fix SPDX license
"UNLICENSED" is not a valid SPDX License Identifier. Remove it from the
list and just keep "Apache-2.0".

Fixes: #89413

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
(cherry picked from commit b240f11592)
2025-06-03 21:40:31 -07:00
Jukka Rissanen
7c48241e5e net: http: server: Select POSIX_C_LIB_EXT instead of FNMATCH
The CONFIG_POSIX_C_LIB_EXT will get support for fnmatch() function.
The old CONFIG_FNMATCH is deprecated.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
(cherry picked from commit 0f90affcdf)
2025-06-03 21:39:52 -07:00
Jukka Rissanen
63d789ac0b net: http: server: The detail length of wildcard detail was wrong
The path length of the detail resource was not set properly.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
(cherry picked from commit 33cf7dc78a)
2025-06-03 21:39:52 -07:00
Krzysztof Chruściński
c08390df71 drivers: serial: nrfx_uarte: Fix use of PM_DEVICE_ISR_SAFE
PM_DEVICE_ISR_SAFE shall not be used when non-asynchronous API is used
because RX is disabled in suspend action and that takes relatively
long time. In case of PM_DEVICE_ISR_SAFE it is done with interrupts
disabled. RX is not used at all if disable-rx property is set and in
that case PM_DEVICE_ISR_SAFE can be used.

Added macro which determines if ISR safe mode can be used.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
(cherry picked from commit e0f5241b28)
2025-05-23 11:44:33 -07:00
Luis Ubieda
d4374ed2cf sensor: adxl345: Disable Sensor Streaming by default
Have the application enable this feature explicitcly, so that
simple applications do not need to disable this to get the
expected behavior.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2025-05-09 14:06:28 -07:00
Luis Ubieda
0f9a0f4d00 sensor: adxl345: Only enable FIFO Stream with Sensor Stream is enabled
Otherwise with its default configuration (25-Hz, 32-level FIFO),
getting individual samples could be up to 1-second old.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2025-05-09 14:06:28 -07:00
Luis Ubieda
80b607dd8f sensor: adxl345: Fix decoder for non-streaming mode
The following fixes have been applied to this decoder:
- The Q-scale factor was fixed, both for full-scale and non
full-scale modes.
- The data-type decoded is struct sensor_three_axis_data, as
it should for read/decode API.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2025-05-09 14:06:28 -07:00
Luis Ubieda
e465e6168e sensor: adxl345: Add get_size_info API
Used by the sensor-shell in order to retrieve values, otherwise
it crashes.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2025-05-09 14:06:28 -07:00
Dong Wang
0fb81dec80 logging: Assign IDs to log backends early during log_core_init
This commit moves the assignment of backend IDs from the 'z_log_init'
function to the earlier 'log_core_init' function. This ensures that
backend IDs are assigned before they are used in the 'log_backend_enable'
function, preventing incorrect settings of log dynamic filters.

Signed-off-by: Dong Wang <dong.d.wang@intel.com>
(cherry picked from commit 3fac83151d)
2025-05-09 11:59:59 -07:00
Benjamin Cabé
1cdd63e5ba doc: Update Graphviz font configuration
Customize Graphviz dot rendering to use same font stack as our Sphinx
theme.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
(cherry picked from commit c0f76d9363)
2025-05-09 11:57:23 -07:00
Dong Wang
64451449ac logging: Ensure atomic update of log filter slot in LOG_FILTER_SLOT_SET
Replaced the read-modify-write sequence with a single read and write
operation, preventing the intermediate value is wrongly used to filter
out logs of another thread with higher priority that preempts the current
thread.

Signed-off-by: Dong Wang <dong.d.wang@intel.com>
(cherry picked from commit 872f363696)
2025-05-09 10:45:48 -07:00
Chekhov Ma
79696d420e drivers: gpio: adp5585: fix wrong reg during pin configure
The ADP5585_GPO_OUT_MODE_A is used when configuring initial output
during pin configuration, causing pins configured HIGH is incorrectly
configured as open-drain. Replacing the reg with ADP5585_GPO_DATA_OUT
fixes the issue.

Signed-off-by: Chekhov Ma <chekhov.ma@nxp.com>
(cherry picked from commit c87900aa40)
2025-05-09 10:36:07 -07:00
Benjamin Cabé
d5d5a7c7db doc: make graphviz diagrams look good in dark theme
Add filter to invert colors in dark mode.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
(cherry picked from commit fd919b5160)
2025-05-09 10:34:47 -07:00
Jukka Rissanen
215737c229 net: if: Release the interface lock early when starting IPv4 ACD
In order to avoid any mutex deadlocks between iface->lock and
TX lock, release the interface lock before calling a function
that will acquire TX lock. See previous commit for similar issue
in RS timer handling. So here we create a separate list of ACD
addresses that are to be started when network interface comes up
without iface->lock held.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-05-09 10:34:15 -07:00
Jukka Rissanen
60190a93f4 net: if: Release the interface lock early when starting IPv6 DAD
In order to avoid any mutex deadlocks between iface->lock and
TX lock, release the interface lock before calling a function
that will acquire TX lock. See previous commit for similar issue
in RS timer handling.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-05-09 10:34:15 -07:00
Jukka Rissanen
f749a05200 net: if: Release the interface lock early in IPv6 RS timeout handler
The net_if.c:rs_timeout() is sending a new IPv6 router solicitation
message to network by calling net_if_start_rs(). That function will
then acquire iface->lock and call net_ipv6_start_rs() which will try
to send the RS message and acquire TX send lock.
During this RS send, we might receive TCP data that could try to
send an ack to peer. This will then in turn cause also TX lock
to be acquired. Depending on timing, the lock ordering between
rx thread and system workq might mix which could lead to deadlock.
Fix this issue by releasing the iface->lock before starting the
RS sending process. The net_if_start_rs() does not really need to
keep the interface lock for a long time as it is the only one sending
the RS message.

Fixes #86499

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-05-09 10:34:15 -07:00
Jukka Rissanen
3af878f68e net: if: Documentation missing for IPv4 ACD timeout variable
Add documentation for ACD timeout variable as it was missing.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-05-09 10:34:15 -07:00
Jukka Rissanen
05dd94d1dd net: if: Documentation missing for IPv6 DAD start time variable
Add documentation for DAD start time variable as it was missing.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-05-09 10:34:15 -07:00
Sudan Landge
0a8f9bb61c modules: tf-m: update to 2.1.2
Update TF-M to 2.1.2 from version 2.1.1.
This is required to use MbedTLS 3.6.3.

Signed-off-by: Sudan Landge <sudan.landge@arm.com>
2025-05-09 10:27:22 -07:00
Sudan Landge
bbe7ab00de modules: mbedtls: update to 3.6.3
Update Mbed TLS to 3.6.3 as it has CVE fixes.

Signed-off-by: Sudan Landge <sudan.landge@arm.com>
2025-05-09 10:27:22 -07:00
Fabio Baltieri
7ff8f6696c ci: update few workflows to use Python 3.12
The HTML doc build workflow and PR assigner recently started failing to
install python packages, breaking all backports. Seems to work when
using Python 3.12, this is already done in main in bacb99da6d.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2025-05-09 11:19:59 +01:00
Alex An
83e99be7d1 drivers: retained_mem: Fix using multiple nRF retained memory regions
Fixes an error when using multiple nRF retained memory regions caused by
a missing separating comma.

Signed-off-by: Alex An <aza0337@auburn.edu>
(cherry picked from commit fbb75862a1)
2025-05-07 11:02:27 -07:00
Luis Ubieda
94c7905e01 spi_rtio: fix transactions for default handler
This patch fixes transaction op items not performed within a single
SPI transfer. This is common for Write + Read commands, that depend on
the CS kept asserted until the end, otherwise the context will be lost.
A similar fix was applied to i2c_rtio_default on #79890.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
(cherry picked from commit b5ca5b7b77)
2025-05-07 08:14:55 -07:00
Mathieu Choplain
43c79ba72c dts: st: stm32u5: restore correct clocks on multi-bit devices
During the transition to STM32_CLOCK macro (in 57723cf), the `clocks`
property of peripherals requiring more than one bit to be set were
mistakenly modified. Commit 2c3294b079
partially fixed these errors, but some nodes for the U5 series are still
wrong.

Restore `clocks` on affected devices in corresponding STM32U5 DTSI.

Fixes: 57723cf405
Signed-off-by: Mathieu Choplain <mathieu.choplain@st.com>
(cherry picked from commit 37bdc38ec6)
2025-03-20 14:25:06 -07:00
Luis Ubieda
7412674a3c rtio: workq: Select Early P4WQ threads init
Otherwise the RTIO Workqueue is not functional for devices during init.

An example of this issue is devices using SPI transfers with default
spi_rtio.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
(cherry picked from commit 2ce2794987)
2025-02-26 09:38:00 -06:00
Luis Ubieda
0c413db7eb p4wq: Add Kconfig to perform early init on threads
In order to make them functional for devices during init. Default
behavior is to keep late initialization, as before.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
(cherry picked from commit ec45b29ea3)
2025-02-26 09:38:00 -06:00
Simon Guinot
af81a8ba32 drivers: led: lp50xx: check the number of LED colors
The current code assumes (especially in the lp50xx_set_color function)
that the number of LED colors defined in DT is not greater than 3. But
since this is not checked, then this is not necessarily the case...

This patch consolidates the initialization of the lp50xx LED driver by
checking the number of colors for each LED found in DT.

Signed-off-by: Simon Guinot <simon.guinot@sequanux.org>
(cherry picked from commit ffbb8f981a)
2025-02-26 09:31:58 -06:00
Robert Lubos
546386cd1f net: if: Setup DAD timer regardless of DAD query result
In rare occasions when sending DAD NS packet fails, we should still
setup the DAD timer, unless we implement some kind of more advanced
retry mechanism. If we don't do that, the IPv6 address added to the
interface will never be usable in such cases.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
(cherry picked from commit 008a7ca202)
2025-02-26 09:30:50 -06:00
Robert Lubos
aa48023434 net: if: Clear neighbor cache when removing IPv6 addr with active DAD
DAD creates an entry in the neighbor cache for the queried (own)
address. In case the address is removed from the interface while DAD is
still incomplete, we need to remove the corresponding cache entry (just
like in case of DAD timeout) to avoid stale entries in the cache.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
(cherry picked from commit a09fd8e97f)
2025-02-26 09:30:50 -06:00
Robert Lubos
3410679046 tests: net: conn_mgr: Use valid LL address in tests
Using L2 address of length 1 (invalid/unsupported one) confused IPv6
layer during LL address generation - since that length was not a valid
one, the address was not initialized properly and a part of it was set
semi-random. This could result for example in filling out the neighbor
tables.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
(cherry picked from commit 3089a5d116)
2025-02-26 09:30:50 -06:00
Derek Snell
7eab725dfb soc: nxp: rw: Update system core clock frequency
After updating the main_clk, need to update the frequency tracked in
HAL MCUXpresso SDK framework for other drivers.

Signed-off-by: Derek Snell <derek.snell@nxp.com>
(cherry picked from commit 793e44afdd)
2025-02-26 09:28:45 -06:00
Yong Cong Sin
a50476ca00 logging: log_cmds: init uninitialized backend on log_go()
For backends that do not autostart themselves, initialize
& enable them on `log backend <log_backend_*> go`, so
that they function properly.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
(cherry picked from commit f840a35be3)
2025-02-20 13:03:28 -06:00
Yong Cong Sin
ae73df5621 logging: init backend id regardless of autostart
The `id` is basically a compile-time constant. Setting it every
time the backend is enabled is unnecessary. Instead, set it on
`z_log_init()` regardless of whether or not it requires to be
`autostart`ed.

Fixes an issue where the `filter_get`/`filter_set`
accessed the wrong index and displayed the wrong log level when
user accesses the status of an uninitialized backend via:
`log backend <uninitialized_backend> status`.

Also fixes an issue when user tries to list the backends via:
`log list_backends`, where all uninitialized backends will have
ID = 0.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
(cherry picked from commit 8dd9d924fe)
2025-02-20 13:03:28 -06:00
Jordan Yates
f61d53d5b5 bluetooth: increment BT_BUF_CMD_TX_COUNT
The extended advertising start procedure can consume both command
buffers in a single API call, resulting in `bt_le_create_conn_cancel`
being unable to claim a buffer to terminate the connection request.

Increase the command count if both extended advertising and Bluetooth
central are enabled in an application.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2025-02-20 10:56:17 -08:00
Jordan Yates
790bd7c44b bluetooth: host: hci_core: add missing NULL check
Add check that the command buffer claimed in `bt_le_create_conn_cancel`
is not `NULL`. Fixes a fault caused by providing the `NULL` buffer to
`bt_hci_cmd_state_set_init`.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2025-02-20 10:56:17 -08:00
Florian Weber
c2ad663314 rtio: workq: bugfix of memory allocation
This commit fixes the bug that the memory of the work request is
freed up in the work handler, before it is not needed anymore by the p4wq.
This is fixed now, by using the new done_handler in the p4wq
for freeing up that memory.

Signed-off-by: Florian Weber <Florian.Weber@live.de>
(cherry picked from commit b55b9ae72b)
2025-02-20 10:55:30 -08:00
Florian Weber
f0c05671da lib: os: p4wq: add done handler
Add an optional handler to the p4wq to give the submitting code
(e.g. rtio workq) a possibility execute code after the work was
succesfully executed.

Signed-off-by: Florian Weber <Florian.Weber@live.de>
(cherry picked from commit 093b29fdb5)
2025-02-20 10:55:30 -08:00
Jukka Rissanen
b40cacb67d net: Update IP address refcount properly when address already exists
If an IP address already exists when it is tried to be added to the
network interface, then just return it but update ref count if it was
not updated. This could happen if the address was added and then removed,
but for example an active connection was still using it and keeping the
ref count > 0. In this case we must update the ref count so that the IP
address is not removed if the connection is closed.

Fixes #85380

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
(cherry picked from commit ae05221762)
2025-02-20 10:52:59 -08:00
Erwan Gouriou
c1f3c446bc dts: stm32h7: Fix ltdc reset lines
LTDC reset lines where off by 1. Fix it.

Signed-off-by: Erwan Gouriou <erwan.gouriou@st.com>
(cherry picked from commit 6f55a32da8)
2025-02-20 10:46:32 -08:00
Robert Lubos
cd85e0ef82 net: ipv6: Fix Neighbor Advertisement processing w/o TLLA option
According to RFC 4861, ch. 7.2.5:

 "If the Override flag is set, or the supplied link-layer address
  is the same as that in the cache, or no Target Link-Layer Address
  option was supplied, the received advertisement MUST update the
  Neighbor Cache entry as follows

  ...

  If the Solicited flag is set, the state of the entry MUST be
  set to REACHABLE"

This indicates that Target Link-Layer Address option does not need to be
present in the received solicited Neighbor Advertisement to confirm
reachability. Therefore remove `tllao_offset` variable check from the
if condition responsible for updating cache entry. No further changes in
the logic are required because if TLLA option is missing,
`lladdr_changed` will be set to false, so no LL address will be updated.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
(cherry picked from commit 02c153c8b1)
2025-02-20 10:44:32 -08:00
Robert Lubos
e47c933b29 net: ipv6: Send Neighbor Solicitations in PROBE state as unicast
According to RFC 4861, ch. 7.3.3:

 "Upon entering the PROBE state, a node sends a unicast Neighbor
  Solicitation message to the neighbor using the cached link-layer
  address."

Zephyr's implementation was not compliant with behavior, as instead of
sending a unicast probe for reachability confirmation, it was sending a
multicast packet instead. This commit fixes it.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
(cherry picked from commit 8cd213e846)
2025-02-20 10:44:32 -08:00
Robert Lubos
c4cb9bd1af net: ipv6: Fix neighbor registration based on received RA message
When Router Advertisement with Source Link-Layer Address option is
received, host should register a new neighbor marked as STALE
(RFC 4861, ch. 6.3.4). This behavior was broken however, because
we always added a new neighbor in INCOMPLETE state before processing
SLLA option. In result, the entry was not updated to the STALE state,
and a redundant Neighbor Solicitation was sent.

Fix this by moving the code responsible for adding neighbor in
INCOMPLETE state after options processing, and only as a fallback
behavior if the SLLA option was not present.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
(cherry picked from commit fce53922ef)
2025-02-20 10:44:32 -08:00
Lingao Meng
f001cf6de9 Bluetooth: Mesh: Fix Assert in bt_mesh_adv_unref when messages to a proxy
Fixes:https://github.com/zephyrproject-rtos/zephyr/issues/83904

This solution fix is to define a separate variable for the each proxy FIFO.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
(cherry picked from commit 6371080406)
2025-02-13 09:44:08 -08:00
Nazar Palamar
da7ec06d12 test: arm: irq: Add overlays files for Infineon boards
Changed interrupt priority for GPIO, default 6 is not suitable for
for the ZERO_LATENCY_IRQS function used in this test.
used in this test.

Fixes for problem with arm_irq_zero_latency_levels
refer to pull/81377

Signed-off-by: Nazar Palamar <nazar.palamar@infineon.com>
(cherry picked from commit 6172092730)
2025-02-11 10:21:13 -08:00
Nazar Palamar
b0e5803c06 Infineon: board: Add CONFIG_GPIO to defconfigs
Add CONFIG_GPIO from defconfigs for Infineon boards.

Revert pull/81377, which affect some ble samples which
used GPIO.

Signed-off-by: Nazar Palamar <nazar.palamar@infineon.com>
(cherry picked from commit 697efe8b50)
2025-02-11 10:21:13 -08:00
Michal Myczkowski
e104bf9a28 dts: atmel sam4s: fix sram address
Changed Atmel SAM4S series sram adress from 0x20100000 to 0x20000000. Now
it matches what is in Atmel SAM4S Series Datasheet chapter 8
section 1.1 Internal SRAM:

https://ww1.microchip.com/downloads/aemDocuments/documents/OTH/ProductDocuments/DataSheets/Atmel-11100-32-bitCortex-M4-Microcontroller-SAM4S_Datasheet.pdf#G1.1069257

Fixes #85211.

Signed-off-by: Michal Myczkowski <mmyczkowski@antmicro.com>
(cherry picked from commit 3a53845fad)
2025-02-11 10:19:42 -08:00
Jamie McCrae
41bafc5dbf mgmt: mcumgr: grp: img_mgmt: Fix calling confirm
Fixes calling the registered callbacks for image being confirmed
if the confirmation was not successful

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
(cherry picked from commit 98d5aa3792)
2025-02-11 10:18:49 -08:00
Mahesh Mahadevan
37321f0702 boards: frdm_mcxn947: Delete enable of GPIO5 clock
There is no bit to enable GPIO5 clock in the clock control
register.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
(cherry picked from commit bda04093fb)
2025-02-11 10:13:45 -08:00
Dario Binacchi
8c516c6d86 dts: arm: st: re-enable master can gating clock for can2
Commit 57723cf405 ("dts: arm: st: Refactor DTSI files to use macro"),
which replaced raw hex codes by using STM32_CLOCK macro, causes
regression in the case of the CAN device where the previous raw value
contained more than one bit set to 1. The macro is in fact correct only
for values with a single bit set. In all other cases, raw values must
continue to be used.

Tested on STM32F429I-DISC1 board

Fixes: 57723cf405
Co-authored-by: Michael Trimarchi <michael@amarulasolutions.com>
Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
(cherry picked from commit 2c3294b079)
2025-02-11 09:50:03 -08:00
Erwan Gouriou
e397b1b657 drivers: ethernet: stm32: Use MDIO API only if enabled by DTS
Not all STM32 series support Zephyr MDIO API yet, while the API is enabled
by default.
To preserve compatibility, put MDIO API related code under the condition
of "st,stm32-mdio" compatible enablement.

Signed-off-by: Erwan Gouriou <erwan.gouriou@st.com>
(cherry picked from commit 2d81351517)
2025-02-04 16:30:36 -06:00
Luis Ubieda
b1631a2913 samples: sensor🐚 test all channels
Loop through all of the channels and make sure that each
channel has an output.

Changes in patch originally present in #72972.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
Signed-off-by: Luis Ubieda <luisf@croxel.com>
(cherry picked from commit 1e64d7bea1)
2025-02-04 16:29:39 -06:00
Luis Ubieda
c4210d749a tests: sensor: generic_test: Remove special-handling for axis values
Since now they're treated as q31 values when individually queried, as
opposed to lump them in a triplet.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
(cherry picked from commit 19a4261517)
2025-02-04 16:29:39 -06:00
Luis Ubieda
212d0c50f1 sensor: default_rtio_sensor: fix: Treat individual axis data as q31_t
Instead of assuming that an individual axis must contain all
data-values. Additionally, for determining that there's XYZ data, all
three channels must be present in the header.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
(cherry picked from commit 5a1dfc82c3)
2025-02-04 16:29:39 -06:00
Luis Ubieda
2b884a703e sensor: shell: Allow individual axis data to be processed
For the supported channels, instead of just allowing 3-axis data being
printed out, allow individual channels to be processed (e.g: accel_x,
gyro_y, etc).

Signed-off-by: Luis Ubieda <luisf@croxel.com>
(cherry picked from commit 36dfea121d)
2025-02-04 16:29:39 -06:00
Jukka Rissanen
50c415d3ee net: socket: Release packets in accepted socket in close
If we have received data to the accepted socket, then release
those before removing the accepted socket. This is a rare event
as it requires that we get multiple simultaneous connections
and there is a failure before the socket accept is called by
the application.
For example one such scenario is when HTTP server receives multiple
connection attempts at the same time, and the server poll fails
before socket accept is called. This leads to buffer leak as the
socket close is not called for the accepted socket because the
accepted is not yet created from application point of view.
The solution is to flush the received queue of the accepted socket
before removing the actual accepted socket.

Fixes #84538

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
(cherry picked from commit 535e70a298)
2025-02-04 16:27:07 -06:00
Luis Ubieda
0429f17b76 sensor: adxl3xx: Move run-time modification of ODR from cfg to data
Config struct is constant and attempting to modify it triggers a fault.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
(cherry picked from commit 5a9ff03c21)
2025-02-04 16:22:11 -06:00
Chen Shu
5080ba8b0c fs: ext2: Fix nbytes_to_read calculation in ext2_inode_read()
Fix incorrect nbytes_to_read calculation in ext2_inode_read() function.
Previously nbytes_to_read was decremented by read value which caused
incorrect calculation of bytes to read in subsequent iterations.
Now nbytes_to_read is decremented by to_read value which represents
the actual number of bytes read in current iteration.

This fixes potential data corruption issues when reading files from
ext2 filesystem.

Signed-off-by: Chen Shu <751541594@qq.com>
(cherry picked from commit 5a5f05ba4e)
2025-02-04 16:21:32 -06:00
Vinayak Kariappa Chettimada
13e7d6501f Bluetooth: Controller: Fix uninitialized is_aborted in conn done event
Fix uninitialized is_aborted in connection done event.

Relates to commit cadef5a64f ("Bluetooth: Controller:
Introduce BT_CTLR_PERIPHERAL_RESERVE_MAX").

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
(cherry picked from commit f3e398d64c)
2025-02-04 16:20:40 -06:00
Jakub Rzeszutko
4a1ffd8519 shell: fix unsafe API calls and add configurable autoflush behavior
Fixes an issue where the shell API could block indefinitely when called
from threads other than the shell's processing thread, especially when
the transport (e.g. USB CDC ACM) was unavailable or inactive.

Replaced `k_mutex_lock` calls with an indefinite timeout (`K_FOREVER`)
by using a fixed timeout (`K_MSEC(SHELL_TX_MTX_TIMEOUT_MS)`) in shell
API functions to prevent indefinite blocking.

Link: https://github.com/zephyrproject-rtos/zephyr/issues/84274

Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@verkada.com>
(cherry picked from commit b0a0febe58)
2025-01-30 17:54:30 -08:00
Jakub Rzeszutko
98a1a1510c shell: add Kconfig option for configurable autoflush behavior
Introduced a new Kconfig option `SHELL_PRINTF_AUTOFLUSH` to allow
configuring the autoflush behavior of shell printing functions.

Updated `Z_SHELL_FPRINTF_DEFINE` to use the
`CONFIG_SHELL_PRINTF_AUTOFLUSH` setting instead of hardcoding
the autoflush behavior to `true`.

Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@verkada.com>
(cherry picked from commit 8991b954bc)
2025-01-30 17:54:30 -08:00
Tomislav Milkovic
5fe9a7e6f9 drivers: can: can_tcan4x5x: fix compiler build warning/error
Fix compiler warning when optional property reset-gpios
is not supplied in the ti,tcan4x5x-compatible device tree
node

Signed-off-by: Tomislav Milkovic <tomislav.milkovic95@gmail.com>
(cherry picked from commit fb98387f4d)
2025-01-30 17:52:29 -08:00
Mayank Narang
a1eb85002e drivers: sensor: lis2de12: add length check in spi write incr routine
Added a length check in the spi write incr routine to handle both
single and multi byte write operations properly.

Signed-off-by: Mayank Narang <narang.may77@gmail.com>
(cherry picked from commit cb608812cf)
2025-01-30 17:51:43 -08:00
Mayank Narang
58491c40c0 drivers: sensor: lis2de12: fix read accel via spi
The lis2de12 sensor driver spi interface was calling spi read api.
This leads to a single byte operation on reading acceleration data
which is a multi byte operation. Fix it by adding a call to spi read
incr api instead. Added a length check to handle both single and multi
byte read properly.

Signed-off-by: Mayank Narang <narang.may77@gmail.com>
(cherry picked from commit 7b062f5b09)
2025-01-30 17:51:43 -08:00
Luca Burelli
adfc5b3863 tests: cmake: run zephyr_get() tests in script mode
Re-run the zephyr_get() testsuite in script mode after the project
mode testsuite has been executed. This is to ensure that the
zephyr_get() function works correctly in script mode as well.

Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
(cherry picked from commit d492c849a3)
2025-01-30 17:49:53 -08:00
Torsten Rasmussen
58b2b82b44 cmake: use GLOBAL property instead TARGET properties for scoping
Targets are not available in script mode.
To support the Zephyr scoping feature used by snippets and yaml module
then this commit moves from using custom targets to use GLOBAL
properties for scopes.

A scope property is prefixed with `<scope>:<property>` to avoid naming
collisions.
A `scope:<scope-name>` global property is used to track created scopes.
Tracking valid scopes ensure that properties are only set on known
scopes and thus catches typos / naming errors.

Add zephyr_scope_exists() and zephyr_get_scoped() to abstract the
implementation details of the scoped property retrieval and refactor
current code to use them.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
(cherry picked from commit 4e29a35b22)
2025-01-30 17:49:53 -08:00
Pieter De Gendt
2f0e67fee8 drivers: spi: spi_mcux_ecspi: Fix data size when using 16/32 bit transfers
The data size is set using a burst length, the data size for 8/16/32 is
always 1 in those cases.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
(cherry picked from commit 0e8aed7393)
2025-01-22 14:46:39 -08:00
Pieter De Gendt
7d59e9f11e drivers: spi: spi_mcux_ecspi: Ignore chip select channel with cs-gpios
The internal chip selects are limited to 4, however when using GPIOS
does not pose this limitation.
Also set internal channel to 0 if GPIOS are used.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
(cherry picked from commit 7250e987e5)
2025-01-22 14:46:39 -08:00
Alberto Escolar Piedras
de825415d6 tests/subsys/lorawan/frag_decoder: Change random seed
These tests are quite sensitive to the exact random sequence.
After a change of the native_sim entropy generation 2 of them
started failing. Let's set a random seed which avoids the failure.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
(cherry picked from commit 64d4fcd8cb)
2025-01-22 14:43:50 -08:00
Alberto Escolar Piedras
fff6ad389e drivers: entropy: fix native_posix driver for more than 3 byte requests
Fix the native_posix fake entropy driver for more than 3 byte requests,
and specially for native_sim//64 builds.

The host random() provides a number between 0 and 2**31-1 (INT_MAX),
so bit 32 was always 0.
So when filling a buffer with more than 3 bytes we would be filling
each 4th byte with a byte which always had its MSbit as 0.

For LP64 native_sim//64 builds, this was even worse, as the driver had
another bug where we assumed random() returned the whole long filled,
and therefore all 4 upper bytes would be 0.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
(cherry picked from commit b3407f04e7)
2025-01-22 14:43:50 -08:00
Derek Snell
7d2ac02254 drivers: flash: soc_flash_mcux: remove CMD_MARGIN_CHECK
The CMD_BLANK_CHECK can return errors when the flash is readable, and
should only be used after programming, not in is_area_readable().  From
the LPC55S69 datasheet: "As cells age and lose charge, a correctly
programmed address will fail this check, while still being able to be
read successfully for the remaining duration of the data retention time."

Signed-off-by: Derek Snell <derek.snell@nxp.com>
(cherry picked from commit 88b9cb6efc)
2025-01-18 09:00:18 -06:00
Thomas Schranz
72a1c809df soc: sam0: samd5x: xosc32 configurable startup time
Adds Kconfig option to configure the startup time of the external
32KHz crystal oscillator.

Signed-off-by: Thomas Schranz <electronics@wandfluh.com>
(cherry picked from commit cd20154bc7)
2025-01-15 16:32:01 -08:00
Daniel DeGrasse
c861286bc0 drivers: flash: flash_mcux_flexspi_nor: check all 3 bytes of JEDEC ID
The FlexSPI NOR driver should verify all 3 bytes of the JEDEC ID match
the expected value before attempting to use a custom LUT table with a
flash chip. This reduces the odds that an incompatible LUT will be used
with a flash chip, as some flash chips may share the same first byte of
their device ID but not be compatible with the custom LUT table.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
(cherry picked from commit c12030acb9)
2025-01-06 08:37:43 -08:00
Erik Tamlin
3f4037b951 manifest: update percepio
Update the percepio module to use TraceRecorder v4.10.2

Signed-off-by: Erik Tamlin <erik.tamlin@percepio.com>
(cherry picked from commit 91b2156398)
2024-12-27 12:06:38 -08:00
Jukka Rissanen
763665dcda tests: net: dns_dispatcher: Add tests for dispatcher
Make sure that the socket service is properly unregistered when
dispatcher is unregistered.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
(cherry picked from commit d98fe73684)
2024-12-27 11:32:22 -08:00
Jukka Rissanen
d58e1ea145 net: dns: Close socket service properly from dispatcher
We need to close the socket service context when dispatcher is
unregistered.

Fixes #82652

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
(cherry picked from commit da148ab3bc)
2024-12-27 11:32:22 -08:00
Jukka Rissanen
fc639b6b27 net: dns: Avoid errors when DNS dispatcher is already registered
Skip error prints and extra DNS events if DNS dispatcher was already
registered.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
(cherry picked from commit c110331507)
2024-12-27 11:32:22 -08:00
Jukka Rissanen
1d445685bf net: dns: Fix the debug print when dispatcher fails
Depending on DNS type, print the output (mDNS vs DNS) correctly.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
(cherry picked from commit efcfcfe292)
2024-12-27 11:32:22 -08:00
Marcio Ribeiro
6dc5129040 drivers: uart: esp32: reset tx fifo during driver init
Resets uart tx fifo during driver initialization to have a well defined
initial condition mainly preventing unwanted characters being sent

Signed-off-by: Marcio Ribeiro <marcio.ribeiro@espressif.com>
(cherry picked from commit f0516ead27)
2024-12-27 11:31:09 -08:00
DEVER Emiel
d8ab599ecf fs: ext2: Fix ext2 read buffer overflow
Keep track of the amount of bytes read so no buffer overflow occurs.

Signed-off-by: DEVER Emiel <emiel.dever@psicontrol.com>
(cherry picked from commit 336c650646)
2024-12-27 11:29:38 -08:00
Djordje Nedic
8abda1d12f fs: littlefs: Fix cache and lookahead size checks
This fixes an issue where wrong values were checked against block device
defaults. Kconfig values are used when no filesystem config values are
provided, and the buffers are sized according to the Kconfig values,
but the checks were only performed against filesystem config variables.

Signed-off-by: Djordje Nedic <nedic.djordje2@gmail.com>
(cherry picked from commit 2750492e86)
2024-12-27 11:27:37 -08:00
Gerson Fernando Budke
578251beac dts: atmel: samr21: Use samd21 as base
The samr21 is a samd21 with a builtin at86rf233 radio. Use the samd21 as
base for these SoC and drop all duplicated nodes.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
(cherry picked from commit 01fc0a750a)
2024-12-27 11:21:47 -08:00
Gerson Fernando Budke
ca7eba2f11 dts: atmel: saml2x: Define USB node
The saml2x series provide USB to all SoC series. This moves the USB node
from saml21.dtsi to the base file saml2x.dtsi.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
(cherry picked from commit 34fc01e008)
2024-12-27 11:21:47 -08:00
Gerson Fernando Budke
3acaf7a069 dts: atmel: saml21: Exclude DMA node
The DMA is already defined on the base header. This exclude the
duplicated node.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
(cherry picked from commit 2e7599eac6)
2024-12-27 11:21:47 -08:00
Gerson Fernando Budke
ba39f63957 dts: atmel: sam0: Fix aliases and chosen nodes
Reorder and add missing aliases and chosen nodes.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
(cherry picked from commit 748bbd012b)
2024-12-27 11:21:47 -08:00
Gerson Fernando Budke
503d458893 dts: atmel: sam0: Explicity disable nodes
When running tests on sam0 platform was detected that pinctrl for ADC
were not defined for some boards. To force an error at build time
nodes should be explicity disabled. This explicity disable nodes on
devicetree that require some user configuration.

In addition, the adc feature were excluded in some boards and
samr21-xpro was correct updated.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
(cherry picked from commit 162f728787)
2024-12-27 11:21:47 -08:00
Gerson Fernando Budke
8e2f36cfcf dts: atmel: sam0: Normalize dtsi nodes
Keep a consistent order on the nodes definitions to make it easy to read
between all the SoC series.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
(cherry picked from commit 6f1f598a72)
2024-12-27 11:21:47 -08:00
Jamie McCrae
d70bbe0eb6 samples: mgmt: mcumgr: smp_svr: Fix re-advertise issue on connection
Fixes an issue introduced with commit
c6ad4a7927 which wrong restarts
advertising after a device connects when it should only restart
advertising if a device fails to connect

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
(cherry picked from commit 655be99fa7)
2024-12-27 11:19:58 -08:00
Dominik Ermel
fe8dc82b16 drivers/flash: Correct flash_erase userspace handler
As the erase callback is optional, handler should not check
if it is not NULL.

Fixes #81777

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
(cherry picked from commit 486428951b)
2024-12-27 11:18:30 -08:00
Jilay Pandya
17df0f1748 drivers: auxdisplay: jhd1313: fix Out-of-bounds read
fix out of bounds read by doing the comparison with ARRAY_SIZE correctly

Signed-off-by: Jilay Pandya <jilay.pandya@outlook.com>
(cherry picked from commit 3202773b11)
2024-12-27 11:17:37 -08:00
Jukka Rissanen
d6ec225075 net: wifi_cred: Decrease flash usage for error print strings
As the error print strings are very similar, construct the final
output at runtime to save some flash space.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
(cherry picked from commit 3c59bd4fb5)
2024-12-09 13:40:54 -08:00
Jukka Rissanen
e60954d54e net: wifi_cred: Remove extra empty lines
Follow net coding style and remove extra new lines between
variable set and checking its value.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
(cherry picked from commit 8deebcec21)
2024-12-09 13:40:54 -08:00
Jukka Rissanen
18845d2bb5 net: wifi_cred: Introduce variables at the start of function
Follow the net coding style and declare the variables at the start
of the function.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
(cherry picked from commit b2056e0966)
2024-12-09 13:40:54 -08:00
Jukka Rissanen
8fdf221640 net: wifi_cred: Check null before access
We must do null check before trying to access the fields.

Fixes #81980
Coverify-CID: 434549

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
(cherry picked from commit 3aa0c8670e)
2024-12-09 13:40:54 -08:00
Marek Matej
b306b24ec4 dts: espressif: Add flash size options to partition tables
Update the partition table list with 16MB and 32MB options.

Signed-off-by: Marek Matej <marek.matej@espressif.com>
(cherry picked from commit 2dc2cdea75)
2024-12-09 13:40:32 -08:00
Jukka Rissanen
2fe01e9400 tests: net: dns: Add test for invalid DNS answer parsing
Make sure we catch invalid answer during parsing.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
(cherry picked from commit 16669ec4d5)
2024-12-09 13:37:22 -08:00
Jukka Rissanen
aec5129706 net: dns: Check DNS answer properly
The dns_unpack_answer() did not check the length of the message
properly which can cause out of bounds read.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
(cherry picked from commit 6e7fcff579)
2024-12-09 13:37:22 -08:00
Jukka Rissanen
b912e674cf net: dns: Validate source buffer length properly
Make sure that when copying the qname, the source buffer is large
enough for the data.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
(cherry picked from commit 43c2b9cfe8)
2024-12-09 13:37:22 -08:00
Jukka Rissanen
1805b1579f tests: net: dns: Add checking of malformed packet
Make sure we test malformed packet parsing.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
(cherry picked from commit 6f96915a14)
2024-12-09 13:37:22 -08:00
Jukka Rissanen
ce695706c0 net: dns: Check parsing error properly for response
If the packet parsing fails in dns_unpack_response_query(), then
do not continue further but bail out early.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
(cherry picked from commit eb2550a441)
2024-12-09 13:37:22 -08:00
Jukka Rissanen
1e88982fe3 net: ethernet: bridge: Drop the cloned packet in error
We need to drop the cloned packet that was fed to the bridge instead of
returning directly from the function. Without this change we have a
buffer leak.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
(cherry picked from commit c6a1af5c17)
2024-12-09 13:36:03 -08:00
Jukka Rissanen
d4e329483f net: ethernet: bridge: Avoid null pointer access
If the packet cloning failed, bail out in order to avoid
null pointer access.

Fixes #81992
Coverity-CID: 434493

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
(cherry picked from commit ed0dcca2fb)
2024-12-09 13:36:03 -08:00
Jamie McCrae
4d3a4eafd6 mgmt: mcumgr: grp: img_mgmt: Fix misplaced #endif
Fixes a misplaced endif which wrongly excluded functions

Signed-off-by: Jamie McCrae <spam@helper3000.net>
(cherry picked from commit 5437ded36c)
2024-12-09 13:35:23 -08:00
Steven Poon
9c63873db2 net: lib: lwm2m: Fix missing mutex unlock
lwm2m_engine_set() and lwm2m_engine_get() locks
the registry_lock mutex, but this is not unlocked
when setting or getting a time resource where the buffer
lengths are invalid resulting in an early return without
unlocking the mutex. This results in a deadlock when
attempting to lock the registry in another thread.

Signed-off-by: Steven Poon <steven-github@outlook.com>
(cherry picked from commit 30b30c29a3)
2024-12-09 13:35:07 -08:00
Jakub Rzeszutko
bd1db48d25 lib: shell: replace strtol with strtoul in cmd_load for address parsing
Addresses in cmd_load() should always be unsigned. Previously, strtol()
was used, which is limited to signed long values, causing issues with
addresses >= 0x80000000. This commit replaces strtol() with strtoul(),
ensuring proper handling of the full 32-bit address space.

Fixes #81343

Signed-off-by: Aaron Fontaine <aaron.fontaine@dojofive.com>
Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@verkada.com>
(cherry picked from commit 1aaf08f7f1)
2024-12-06 13:47:19 -08:00
Pavel Vasilyev
8ac7bde2b1 bluetooth: mesh: proxy_msg: Fix extracting role from k_work
Fix extracting role from k_work.
Hot fix for #78914

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
(cherry picked from commit f5409bd3de)
2024-12-06 13:40:02 -08:00
Jerzy Kasenberg
98d9f3e551 i2c: target: eeprom_target: Fix buffer write
When larger buffer index was introduced only function:
eeprom_target_write_received() was updated to handle
address-width = 16

This adds the same functionality when buffered API is used,
enabled by CONFIG_I2C_TARGET_BUFFER_MODE.

Signed-off-by: Jerzy Kasenberg <jerzy.kasenberg@codecoup.pl>
(cherry picked from commit e6c9e9a2dd)
2024-12-06 09:55:36 -06:00
Yong Cong Sin
2c5fb2d916 arch: riscv: reg: include required header
Include `zephyr/sys/util.h` for the `STRINGIFY()` macro.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
(cherry picked from commit 45ebd390cf)
2024-12-01 14:49:38 -08:00
Gerson Fernando Budke
3b14973425 drivers: rtc: sam: Add platform on API test coverage
The #81456 fixed the driver issue related to issue #81454. This add
the RTC configurations on sam_v71_xult board to enable test coverage.

Fixes #81454

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
(cherry picked from commit cffb66f5c6)
2024-12-01 14:44:05 -08:00
Alberto Escolar Piedras
aae851fdb5 bluetooth: CTS: Fix includes to avoid build error with some libCs
Remove unnecessary include in header and source file.

gmtime_r() is an extension to the C library, and therefore one
needs to explicitly ask for its prototype to have it exposed.
This is done by defining _POSIX_C_SOURCE so let's do so.

These two changes fix build errors with some libCs.
Tested with pico, newlib, minimal and the host glibc.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
(cherry picked from commit a785548df6)
2024-12-01 14:43:44 -08:00
Matthias Alleman
f7edec7da6 posix: fpu: Fix compiler error when enabling fpu on posix boards
Enabling CONFIG_FPU and CONFIG_FPU_SHARING requires the
definition of `arch_float_disable` and `arch_float_enable`.

Signed-off-by: Matthias Alleman <matthias.alleman@basalte.be>
(cherry picked from commit e7c353bf14)
2024-12-01 14:43:31 -08:00
Andrej Butok
371e3a6769 boards: nxp: fix s26ks512s0 flash write-block-size
- Sets s26ks512s0 flash write-block-size to correct 256KB.
- Optimizes MCUboot partitions to fit the correct write-block-size.

Fixes #80284

Signed-off-by: Andrej Butok <andrey.butok@nxp.com>
(cherry picked from commit a730d9abad)
2024-11-22 13:03:12 -06:00
Chaitanya Tata
07a0ae1a99 drivers: nrfwifi: Remove passing unused flag
This flag is now unused in OSAL as it takes the input via the API.

Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
(cherry picked from commit f537cf311d)
2024-11-22 13:02:54 -06:00
Kapil Bhatt
966da750e1 drivers: wifi: Fix offloaded raw TX feature flags
Pass passive scan and offloaded raw tx feature flags to OSAL.

Signed-off-by: Kapil Bhatt <kapil.bhatt@nordicsemi.no>
(cherry picked from commit 62e06a5072)
2024-11-22 13:02:54 -06:00
Benjamin Cabé
01a3232eeb doc: doxygen: improve formatting for kconfig alias
\verbatim is not giving the right output as we need an inline literal.
Switch to \c instead.

Fixes #81595.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
(cherry picked from commit 83356e924a)
2024-11-22 13:01:56 -06:00
166 changed files with 2251 additions and 733 deletions

View File

@@ -22,6 +22,11 @@ jobs:
runs-on: ubuntu-22.04
steps:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.12
- name: Install Python dependencies
run: |
sudo pip3 install -U setuptools wheel pip

View File

@@ -70,6 +70,11 @@ jobs:
cancel-in-progress: true
steps:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.12
- name: install-pkgs
run: |
sudo apt-get update
@@ -202,6 +207,11 @@ jobs:
- name: checkout
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.12
- name: install-pkgs
run: |
apt-get update

View File

@@ -96,6 +96,25 @@ void posix_arch_thread_entry(void *pa_thread_status)
z_thread_entry(ptr->entry_point, ptr->arg1, ptr->arg2, ptr->arg3);
}
#if defined(CONFIG_FPU) && defined(CONFIG_FPU_SHARING)
int arch_float_disable(struct k_thread *thread)
{
ARG_UNUSED(thread);
/* Posix always has FPU enabled so cannot be disabled */
return -ENOTSUP;
}
int arch_float_enable(struct k_thread *thread, unsigned int options)
{
ARG_UNUSED(thread);
ARG_UNUSED(options);
/* Posix always has FPU enabled so nothing to do here */
return 0;
}
#endif /* CONFIG_FPU && CONFIG_FPU_SHARING */
#if defined(CONFIG_ARCH_HAS_THREAD_ABORT)
void z_impl_k_thread_abort(k_tid_t thread)
{

View File

@@ -2,7 +2,7 @@
* Copyright (c) 2017 Piotr Mienkowski
* Copyright (c) 2017 Justin Watson
* Copyright (c) 2020 Stephanos Ioannidis <root@stephanos.io>
* Copyright (c) 2019-2022 Gerson Fernando Budke <nandojve@gmail.com>
* Copyright (c) 2019-2024 Gerson Fernando Budke <nandojve@gmail.com>
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -17,6 +17,7 @@
led0 = &yellow_led1;
pwm-led0 = &pwm_led0;
pwm-0 = &pwm0;
rtc = &rtc;
sw0 = &sw0_user_button;
sw1 = &sw1_user_button;
watchdog0 = &wdt;
@@ -336,6 +337,10 @@ zephyr_udc0: &usbhs {
};
};
&rtc {
status = "okay";
};
ext1_spi: &spi0 {
};

View File

@@ -22,6 +22,7 @@ supported:
- i2s
- pwm
- netif:eth
- rtc
- spi
- usb_device
- watchdog

View File

@@ -22,6 +22,7 @@ supported:
- i2s
- pwm
- netif:eth
- rtc
- spi
- usb_device
- watchdog

View File

@@ -1,3 +1,6 @@
# Copyright (c) 2024 Gerson Fernando Budke <nandojve@gmail.com>
# SPDX-License-Identifier: Apache-2.0
identifier: samd20_xpro
name: SAM D20 Xplained Pro
type: mcu
@@ -9,7 +12,6 @@ toolchain:
flash: 256
ram: 32
supported:
- adc
- flash
- gpio
- i2c

View File

@@ -1,6 +1,7 @@
# Copyright (c) 2018 Bryan O'Donoghue
# Copyright (c) 2024 Gerson Fernando Budke <nandojve@gmail.com>
# SPDX-License-Identifier: Apache-2.0
identifier: samd21_xpro
name: SAM D21 Xplained Pro
type: mcu
@@ -12,7 +13,6 @@ toolchain:
flash: 256
ram: 32
supported:
- adc
- counter
- dma
- gpio

View File

@@ -1,11 +1,17 @@
/*
* Copyright (c) 2022, Gerson Fernando Budke <nandojve@gmail.com>
* Copyright (c) 2022-2024, Gerson Fernando Budke <nandojve@gmail.com>
* SPDX-License-Identifier: Apache-2.0
*/
#include <dt-bindings/pinctrl/samr21g-pinctrl.h>
&pinctrl {
adc_default: adc_default {
group1 {
pinmux = <PA6B_ADC_AIN6>;
};
};
pwm_default: pwm_default {
group1 {
pinmux = <PA19F_TCC0_WO3>;

View File

@@ -106,6 +106,12 @@
clock-frequency = <48000000>;
};
&adc {
status = "okay";
pinctrl-0 = <&adc_default>;
pinctrl-names = "default";
};
&tcc0 {
status = "okay";
compatible = "atmel,sam0-tcc-pwm";

View File

@@ -1,6 +1,7 @@
# Copyright (c) 2019 Benjamin Valentin
# Copyright (c) 2019-2024 Gerson Fernando Budke
# Copyright (c) 2019-2024 Gerson Fernando Budke <nandojve@gmail.com>
# SPDX-License-Identifier: Apache-2.0
identifier: samr21_xpro
name: SAM R21 Xplained Pro
type: mcu

View File

@@ -17,6 +17,9 @@ CONFIG_UART_CONSOLE=y
# Enable UART driver
CONFIG_SERIAL=y
# Enable GPIO driver
CONFIG_GPIO=y
# Enable clock controller
CONFIG_CLOCK_CONTROL=y

View File

@@ -18,6 +18,9 @@ CONFIG_UART_CONSOLE=y
# Enable UART driver
CONFIG_SERIAL=y
# Enable GPIO
CONFIG_GPIO=y
# Enable clock controller
CONFIG_CLOCK_CONTROL=y

View File

@@ -18,6 +18,9 @@ CONFIG_UART_CONSOLE=y
# Enable UART driver
CONFIG_SERIAL=y
# Enable GPIO driver
CONFIG_GPIO=y
# Enable clock controller
CONFIG_CLOCK_CONTROL=y

View File

@@ -190,10 +190,6 @@ static int frdm_mcxn947_init(void)
CLOCK_EnableClock(kCLOCK_Gpio4);
#endif
#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(gpio5))
CLOCK_EnableClock(kCLOCK_Gpio5);
#endif
#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(dac0))
SPC_EnableActiveModeAnalogModules(SPC0, kSPC_controlDac0);
CLOCK_SetClkDiv(kCLOCK_DivDac0Clk, 1u);

View File

@@ -39,7 +39,7 @@
ahb-write-wait-unit = <2>;
ahb-write-wait-interval = <20>;
status = "okay";
erase-block-size = <4096>;
erase-block-size = <DT_SIZE_K(256)>;
write-block-size = <16>;
partitions {
@@ -48,22 +48,22 @@
#size-cells = <1>;
boot_partition: partition@0 {
label = "mcuboot";
reg = <0x00000000 DT_SIZE_K(128)>;
reg = <0x00000000 DT_SIZE_K(256)>;
};
/* The MCUBoot swap-move algorithm uses the last 11 sectors
/* The MCUBoot swap-move algorithm uses the last 2 sectors
* of the primary slot0 for swap status and move.
*/
slot0_partition: partition@20000 {
slot0_partition: partition@40000 {
label = "image-0";
reg = <0x00020000 (DT_SIZE_M(3) + DT_SIZE_K(44))>;
reg = <0x00040000 (DT_SIZE_M(3) + DT_SIZE_K(512))>;
};
slot1_partition: partition@32B000 {
slot1_partition: partition@3C0000 {
label = "image-1";
reg = <0x0032B000 DT_SIZE_M(3)>;
reg = <0x003C0000 DT_SIZE_M(3)>;
};
storage_partition: partition@62B000 {
storage_partition: partition@6C0000 {
label = "storage";
reg = <0x0062B000 (DT_SIZE_M(58) - DT_SIZE_K(172))>;
reg = <0x006C0000 (DT_SIZE_M(58) - DT_SIZE_K(768))>;
};
};
};

View File

@@ -37,7 +37,7 @@
ahb-write-wait-unit = <2>;
ahb-write-wait-interval = <20>;
status = "okay";
erase-block-size = <4096>;
erase-block-size = <DT_SIZE_K(256)>;
write-block-size = <16>;
partitions {
@@ -46,22 +46,22 @@
#size-cells = <1>;
boot_partition: partition@0 {
label = "mcuboot";
reg = <0x00000000 DT_SIZE_K(128)>;
reg = <0x00000000 DT_SIZE_K(256)>;
};
/* The MCUBoot swap-move algorithm uses the last 11 sectors
/* The MCUBoot swap-move algorithm uses the last 2 sectors
* of the primary slot0 for swap status and move.
*/
slot0_partition: partition@20000 {
slot0_partition: partition@40000 {
label = "image-0";
reg = <0x00020000 (DT_SIZE_M(3) + DT_SIZE_K(44))>;
reg = <0x00040000 (DT_SIZE_M(3) + DT_SIZE_K(512))>;
};
slot1_partition: partition@32B000 {
slot1_partition: partition@3C0000 {
label = "image-1";
reg = <0x0032B000 DT_SIZE_M(3)>;
reg = <0x003C0000 DT_SIZE_M(3)>;
};
storage_partition: partition@62B000 {
storage_partition: partition@6C0000 {
label = "storage";
reg = <0x0062B000 (DT_SIZE_M(58) - DT_SIZE_K(172))>;
reg = <0x006C0000 (DT_SIZE_M(58) - DT_SIZE_K(768))>;
};
};
};

View File

@@ -200,7 +200,7 @@
ahb-write-wait-unit = <2>;
ahb-write-wait-interval = <20>;
status = "okay";
erase-block-size = <4096>;
erase-block-size = <DT_SIZE_K(256)>;
write-block-size = <16>;
partitions {
@@ -209,22 +209,22 @@
#size-cells = <1>;
boot_partition: partition@0 {
label = "mcuboot";
reg = <0x00000000 DT_SIZE_K(128)>;
reg = <0x00000000 DT_SIZE_K(256)>;
};
/* The MCUBoot swap-move algorithm uses the last 11 sectors
/* The MCUBoot swap-move algorithm uses the last 2 sectors
* of the primary slot0 for swap status and move.
*/
slot0_partition: partition@20000 {
slot0_partition: partition@40000 {
label = "image-0";
reg = <0x00020000 (DT_SIZE_M(3) + DT_SIZE_K(44))>;
reg = <0x00040000 (DT_SIZE_M(3) + DT_SIZE_K(512))>;
};
slot1_partition: partition@32B000 {
slot1_partition: partition@3C0000 {
label = "image-1";
reg = <0x0032B000 DT_SIZE_M(3)>;
reg = <0x003C0000 DT_SIZE_M(3)>;
};
storage_partition: partition@62B000 {
storage_partition: partition@6C0000 {
label = "storage";
reg = <0x0062B000 (DT_SIZE_M(58) - DT_SIZE_K(172))>;
reg = <0x006C0000 (DT_SIZE_M(58) - DT_SIZE_K(768))>;
};
};
};

View File

@@ -35,6 +35,6 @@
};
};
arduino_i2c: &i2c3 {};
arduino_i2c: &i2c1 {};
arduino_spi: &spi1 {};
arduino_serial: &uart4 {};

View File

@@ -3251,8 +3251,9 @@ function(zephyr_get variable)
set(sysbuild_global_${var})
endif()
if(TARGET snippets_scope)
get_property(snippets_${var} TARGET snippets_scope PROPERTY ${var})
zephyr_scope_exists(scope_defined snippets)
if(scope_defined)
zephyr_get_scoped(snippets_${var} snippets ${var})
endif()
endforeach()
@@ -3317,11 +3318,54 @@ endfunction(zephyr_get variable)
# <scope>: Name of new scope.
#
function(zephyr_create_scope scope)
if(TARGET ${scope}_scope)
zephyr_scope_exists(scope_defined ${scope})
if(scope_defined)
message(FATAL_ERROR "zephyr_create_scope(${scope}) already exists.")
endif()
add_custom_target(${scope}_scope)
set_property(GLOBAL PROPERTY scope:${scope} TRUE)
endfunction()
# Usage:
# zephyr_scope_exists(<result> <scope>)
#
# Check if <scope> exists.
#
# <result>: Variable to set with result.
# TRUE if scope exists, FALSE otherwise.
# <scope> : Name of scope.
#
function(zephyr_scope_exists result scope)
get_property(scope_defined GLOBAL PROPERTY scope:${scope})
if(scope_defined)
set(${result} TRUE PARENT_SCOPE)
else()
set(${result} FALSE PARENT_SCOPE)
endif()
endfunction()
# Usage:
# zephyr_get_scoped(<output> <scope> <var>)
#
# Get the current value of <var> in a specific <scope>, as defined by a
# previous zephyr_set() call. The value will be stored in the <output> var.
#
# <output> : Variable to store the value in
# <scope> : Scope for the variable look up
# <var> : Name to look up in the specific scope
#
function(zephyr_get_scoped output scope var)
zephyr_scope_exists(scope_defined ${scope})
if(NOT scope_defined)
message(FATAL_ERROR "zephyr_get_scoped(): scope ${scope} doesn't exists.")
endif()
get_property(value GLOBAL PROPERTY ${scope}_scope:${var})
if(DEFINED value)
set(${output} "${value}" PARENT_SCOPE)
else()
unset(${output} PARENT_SCOPE)
endif()
endfunction()
# Usage:
@@ -3342,7 +3386,8 @@ function(zephyr_set variable)
zephyr_check_arguments_required_all(zephyr_set SET_VAR SCOPE)
if(NOT TARGET ${SET_VAR_SCOPE}_scope)
zephyr_scope_exists(scope_defined ${SET_VAR_SCOPE})
if(NOT scope_defined)
message(FATAL_ERROR "zephyr_set(... SCOPE ${SET_VAR_SCOPE}) doesn't exists.")
endif()
@@ -3350,8 +3395,8 @@ function(zephyr_set variable)
set(property_args APPEND)
endif()
set_property(TARGET ${SET_VAR_SCOPE}_scope ${property_args}
PROPERTY ${variable} ${SET_VAR_UNPARSED_ARGUMENTS}
set_property(GLOBAL ${property_args} PROPERTY
${SET_VAR_SCOPE}_scope:${variable} ${SET_VAR_UNPARSED_ARGUMENTS}
)
endfunction()
@@ -5871,16 +5916,11 @@ if(CMAKE_SCRIPT_MODE_FILE)
# This silence the error: 'set_target_properties command is not scriptable'
endfunction()
function(zephyr_set variable)
# This silence the error: zephyr_set(... SCOPE <scope>) doesn't exists.
endfunction()
# Build info creates a custom target for handling of build info.
# build_info is not needed in script mode but still called by Zephyr CMake
# modules. Therefore disable build_info(...) in when including
# extensions.cmake in script mode.
function(build_info)
# This silence the error: 'YAML context 'build_info' does not exist.'
# 'Remember to create a YAML context'
# This silence the error: 'Unknown CMake command "yaml_context"'
endfunction()
endif()

View File

@@ -93,7 +93,8 @@ function(yaml_context)
)
endif()
if(TARGET ${ARG_YAML_NAME}_scope)
zephyr_scope_exists(scope_defined ${ARG_YAML_NAME})
if(scope_defined)
list(POP_FRONT ARG_YAML_UNPARSED_ARGUMENTS out-var)
set(${out-var} TRUE PARENT_SCOPE)
else()
@@ -183,7 +184,7 @@ function(yaml_get out_var)
zephyr_check_arguments_required_all(${CMAKE_CURRENT_FUNCTION} ARG_YAML NAME KEY)
internal_yaml_context_required(NAME ${ARG_YAML_NAME})
get_property(json_content TARGET ${ARG_YAML_NAME}_scope PROPERTY JSON)
zephyr_get_scoped(json_content ${ARG_YAML_NAME} JSON)
# We specify error variable to avoid a fatal error.
# If key is not found, then type becomes '-NOTFOUND' and value handling is done below.
@@ -224,7 +225,7 @@ function(yaml_length out_var)
zephyr_check_arguments_required_all(${CMAKE_CURRENT_FUNCTION} ARG_YAML NAME KEY)
internal_yaml_context_required(NAME ${ARG_YAML_NAME})
get_property(json_content TARGET ${ARG_YAML_NAME}_scope PROPERTY JSON)
zephyr_get_scoped(json_content ${ARG_YAML_NAME} JSON)
string(JSON type ERROR_VARIABLE error TYPE "${json_content}" ${ARG_YAML_KEY})
if(type STREQUAL ARRAY)
@@ -262,7 +263,7 @@ function(yaml_set)
zephyr_check_arguments_exclusive(${CMAKE_CURRENT_FUNCTION} ARG_YAML VALUE LIST)
internal_yaml_context_required(NAME ${ARG_YAML_NAME})
get_property(json_content TARGET ${ARG_YAML_NAME}_scope PROPERTY JSON)
zephyr_get_scoped(json_content ${ARG_YAML_NAME} JSON)
set(yaml_key_undefined ${ARG_YAML_KEY})
foreach(k ${yaml_key_undefined})
@@ -335,7 +336,7 @@ function(yaml_remove)
zephyr_check_arguments_required_all(${CMAKE_CURRENT_FUNCTION} ARG_YAML NAME KEY)
internal_yaml_context_required(NAME ${ARG_YAML_NAME})
get_property(json_content TARGET ${ARG_YAML_NAME}_scope PROPERTY JSON)
zephyr_get_scoped(json_content ${ARG_YAML_NAME} JSON)
string(JSON json_content REMOVE "${json_content}" ${ARG_YAML_KEY})
zephyr_set(JSON "${json_content}" SCOPE ${ARG_YAML_NAME})
@@ -359,18 +360,18 @@ function(yaml_save)
zephyr_check_arguments_required(${CMAKE_CURRENT_FUNCTION} ARG_YAML NAME)
internal_yaml_context_required(NAME ${ARG_YAML_NAME})
get_target_property(yaml_file ${ARG_YAML_NAME}_scope FILE)
zephyr_get_scoped(yaml_file ${ARG_YAML_NAME} FILE)
if(NOT yaml_file)
zephyr_check_arguments_required(${CMAKE_CURRENT_FUNCTION} ARG_YAML FILE)
endif()
get_property(json_content TARGET ${ARG_YAML_NAME}_scope PROPERTY JSON)
zephyr_get_scoped(json_content ${ARG_YAML_NAME} JSON)
to_yaml("${json_content}" 0 yaml_out)
if(DEFINED ARG_YAML_FILE)
set(yaml_file ${ARG_YAML_FILE})
else()
get_property(yaml_file TARGET ${ARG_YAML_NAME}_scope PROPERTY FILE)
zephyr_get_scoped(yaml_file ${ARG_YAML_NAME} FILE)
endif()
if(EXISTS ${yaml_file})
FILE(RENAME ${yaml_file} ${yaml_file}.bak)

View File

@@ -921,6 +921,10 @@ dark-mode-toggle::part(toggleLabel){
font-size: unset;
}
div.graphviz > object {
filter: var(--graphviz-filter);
}
/* Home page grid display */
.grid {
list-style-type: none !important;

View File

@@ -93,4 +93,6 @@
--btn-neutral-background-color: #404040;
--btn-neutral-hover-background-color: #505050;
--footer-color: #aaa;
--graphviz-filter: invert(0.9) brightness(1.2);
}

View File

@@ -91,4 +91,6 @@
--btn-neutral-background-color: #f3f6f6;
--btn-neutral-hover-background-color: #e5ebeb;
--footer-color: #808080;
--graphviz-filter: none;
}

View File

@@ -2,7 +2,7 @@
<div class="rst-versions" data-toggle="rst-versions" role="note" aria-label="versions">
<span class="rst-current-version" data-toggle="rst-current-version">
<span class="fa fa-book"> Zephyr Project</span>
v: latest
v: {{ current_version if is_release else "latest" }}
<span class="fa fa-caret-down"></span>
</span>
<div class="rst-other-versions">

View File

@@ -325,6 +325,9 @@ graphviz_dot_args = [
"-Ncolor=gray60",
"-Nfontcolor=gray25",
"-Ecolor=gray60",
"-Gfontname=system-ui,-apple-system,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif",
"-Nfontname=system-ui,-apple-system,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif",
"-Efontname=SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,Courier,monospace",
]
# -- Options for sphinx_copybutton ----------------------------------------

View File

@@ -2,6 +2,48 @@
.. _zephyr_4.0:
.. _zephyr_4.0.1:
Zephyr 4.0.1
############
This is an LTS maintenance release with fixes.
Security Vulnerability Related
******************************
The following CVEs are addressed by this release:
* :cve:`2025-27809` `TLS clients may unwittingly skip server authentication
<https://mbed-tls.readthedocs.io/en/latest/security-advisories/mbedtls-security-advisory-2025-03-1/>`_
* :cve:`2025-27810` `Potential authentication bypass in TLS handshake
<https://mbed-tls.readthedocs.io/en/latest/security-advisories/mbedtls-security-advisory-2025-03-2/>`_
More detailed information can be found in:
https://docs.zephyrproject.org/latest/security/vulnerabilities.html
Issues fixed
************
These GitHub issues were addressed since the previous 4.0.0 tagged release:
Mbed TLS
********
Mbed TLS was updated to version 3.6.3 (from 3.6.2). The release notes can be found at:
https://github.com/Mbed-TLS/mbedtls/releases/tag/mbedtls-3.6.3
Mbed TLS 3.6 is an LTS release that will be supported
with security and bug fixes until at least March 2027.
Trusted Firmware-M (TF-M)
*************************
TF-M was updated to version 2.1.2 (from 2.1.1). The release notes can be found at:
https://trustedfirmware-m.readthedocs.io/en/tf-mv2.1.2/releases/2.1.2.html
.. _zephyr_4.0.0:
Zephyr 4.0.0
############

View File

@@ -279,7 +279,7 @@ TAB_SIZE = 8
# with the commands \{ and \} for these it is advised to use the version @{ and
# @} or use a double escape (\\{ and \\})
ALIASES = "kconfig{1}=\verbatim \1 \endverbatim" \
ALIASES = "kconfig{1}=\c \1" \
"req{1}=\ref ZEPH_\1 \"ZEPH-\1\"" \
"satisfy{1}=\xrefitem satisfy \"Satisfies requirement\" \"Requirement Implementation\" \1" \
"verify{1}=\xrefitem verify \"Verifies requirement\" \"Requirement Verification\" \1" \

View File

@@ -205,7 +205,7 @@ static int auxdisplay_jhd1313_backlight_set(const struct device *dev, uint8_t co
const struct auxdisplay_jhd1313_config *config = dev->config;
struct auxdisplay_jhd1313_data *data = dev->data;
if (colour > ARRAY_SIZE(colour_define)) {
if (colour >= ARRAY_SIZE(colour_define)) {
LOG_WRN("Selected colour is too high a value");
return -EINVAL;
}

View File

@@ -508,8 +508,10 @@ static int tcan4x5x_wake(const struct device *dev)
static int tcan4x5x_reset(const struct device *dev)
{
#if TCAN4X5X_RST_GPIO_SUPPORT
const struct can_mcan_config *mcan_config = dev->config;
const struct tcan4x5x_config *tcan_config = mcan_config->custom;
#endif /* TCAN4X5X_RST_GPIO_SUPPORT */
int err;
err = tcan4x5x_wake(dev);

View File

@@ -42,7 +42,10 @@ static int entropy_native_posix_get_entropy(const struct device *dev,
*/
long value = nsi_host_random();
size_t to_copy = MIN(length, sizeof(long int));
/* The host random() provides a number between 0 and 2**31-1. Bit 32 is always 0.
* So let's just use the lower 3 bytes discarding the upper 7 bits
*/
size_t to_copy = MIN(length, 3);
memcpy(buffer, &value, to_copy);
buffer += to_copy;

View File

@@ -56,7 +56,7 @@ LOG_MODULE_REGISTER(LOG_MODULE_NAME);
#define PHY_ADDR CONFIG_ETH_STM32_HAL_PHY_ADDRESS
#if defined(CONFIG_MDIO)
#if DT_HAS_COMPAT_STATUS_OKAY(st_stm32_mdio)
#define DEVICE_PHY_BY_NAME(n) \
DEVICE_DT_GET(DT_CHILD(DT_INST_CHILD(n, mdio), _CONCAT(ethernet_phy_, PHY_ADDR)))
@@ -239,7 +239,7 @@ static HAL_StatusTypeDef read_eth_phy_register(ETH_HandleTypeDef *heth,
uint32_t PHYReg,
uint32_t *RegVal)
{
#if defined(CONFIG_MDIO)
#if DT_HAS_COMPAT_STATUS_OKAY(st_stm32_mdio)
return phy_read(eth_stm32_phy_dev, PHYReg, RegVal);
#elif defined(CONFIG_ETH_STM32_HAL_API_V2)
return HAL_ETH_ReadPHYRegister(heth, PHYAddr, PHYReg, RegVal);

View File

@@ -31,7 +31,7 @@ static inline int z_vrfy_flash_write(const struct device *dev, off_t offset,
static inline int z_vrfy_flash_erase(const struct device *dev, off_t offset,
size_t size)
{
K_OOPS(K_SYSCALL_DRIVER_FLASH(dev, erase));
K_OOPS(K_SYSCALL_OBJ(dev, K_OBJ_DRIVER_FLASH));
return z_impl_flash_erase((const struct device *)dev, offset, size);
}
#include <zephyr/syscalls/flash_erase_mrsh.c>

View File

@@ -944,8 +944,10 @@ static int flash_flexspi_nor_check_jedec(struct flash_flexspi_nor_data *data,
}
/* Switch on manufacturer and vendor ID */
switch (vendor_id & 0xFFFF) {
case 0x609d: /* IS25LP flash, needs P[4:3] cleared with same method as IS25WP */
switch (vendor_id & 0xFFFFFF) {
case 0x16609d: /* IS25LP032 flash, needs P[4:3] cleared with same method as IS25WP */
case 0x17609d: /* IS25LP064 */
case 0x18609d: /* IS25LP128 */
read_params = 0xE0U;
ret = flash_flexspi_nor_is25_clear_read_param(data, flexspi_lut, &read_params);
if (ret < 0) {
@@ -959,7 +961,9 @@ static int flash_flexspi_nor_check_jedec(struct flash_flexspi_nor_data *data,
}
/* Still return an error- we want the JEDEC configuration to run */
return -ENOTSUP;
case 0x709d:
case 0x16709d: /* IS25WP032 */
case 0x17709d: /* IS25WP064 */
case 0x18709d: /* IS25WP128 */
/*
* IS25WP flash. We can support this flash with the JEDEC probe,
* but we need to insure P[6:3] are at the default value
@@ -977,15 +981,8 @@ static int flash_flexspi_nor_check_jedec(struct flash_flexspi_nor_data *data,
}
/* Still return an error- we want the JEDEC configuration to run */
return -ENOTSUP;
case 0x40ef:
if ((vendor_id & 0xFFFFFF) != 0x2040ef) {
/*
* This is not the correct flash chip, and will not
* support the LUT table. Return here
*/
return -ENOTSUP;
}
/* W25Q512JV flash, use 4 byte read/write */
case 0x2040ef:
/* W25Q512JV-IQ/IN flash, use 4 byte read/write */
flexspi_lut[READ][0] = FLEXSPI_LUT_SEQ(
kFLEXSPI_Command_SDR, kFLEXSPI_1PAD, SPI_NOR_CMD_4READ_4B,
kFLEXSPI_Command_RADDR_SDR, kFLEXSPI_4PAD, 32);
@@ -1015,14 +1012,7 @@ static int flash_flexspi_nor_check_jedec(struct flash_flexspi_nor_data *data,
/* Device uses bit 1 of status reg 2 for QE */
return flash_flexspi_nor_quad_enable(data, flexspi_lut,
JESD216_DW15_QER_VAL_S2B1v5);
case 0x60ef:
if ((vendor_id & 0xFFFFFF) != 0x2060ef) {
/*
* This is not the correct flash chip, and will not
* support the LUT table. Return here
*/
return -ENOTSUP;
}
case 0x2060ef:
/* W25Q512NW-IQ/IN flash, use 4 byte read/write */
flexspi_lut[READ][0] = FLEXSPI_LUT_SEQ(
kFLEXSPI_Command_SDR, kFLEXSPI_1PAD, SPI_NOR_CMD_4READ_4B,
@@ -1053,8 +1043,8 @@ static int flash_flexspi_nor_check_jedec(struct flash_flexspi_nor_data *data,
/* Device uses bit 1 of status reg 2 for QE */
return flash_flexspi_nor_quad_enable(data, flexspi_lut,
JESD216_DW15_QER_VAL_S2B1v5);
case 0x25C2:
/* MX25 flash, use 4 byte read/write */
case 0x3A25C2:
/* MX25U51245G flash, use 4 byte read/write */
flexspi_lut[READ][0] = FLEXSPI_LUT_SEQ(
kFLEXSPI_Command_SDR, kFLEXSPI_1PAD, SPI_NOR_CMD_4READ_4B,
kFLEXSPI_Command_RADDR_SDR, kFLEXSPI_4PAD, 32);

View File

@@ -93,7 +93,7 @@ static uint32_t get_cmd_status(uint32_t cmd, uint32_t addr, size_t len)
}
/* This function prevents erroneous reading. Some ECC enabled devices will
* crash when reading an erased or wrongly programmed area.
* crash when reading an erased area.
*/
static status_t is_area_readable(uint32_t addr, size_t len)
{
@@ -102,21 +102,13 @@ static status_t is_area_readable(uint32_t addr, size_t len)
key = irq_lock();
/* Check if the are is correctly programmed and can be read. */
status = get_cmd_status(FMC_CMD_MARGIN_CHECK, addr, len);
if (status & FMC_STATUS_FAILURES) {
/* If the area was erased, ECC errors are triggered on read. */
status = get_cmd_status(FMC_CMD_BLANK_CHECK, addr, len);
if (!(status & FMC_STATUS_FAIL)) {
LOG_DBG("read request on erased addr:0x%08x size:%d",
addr, len);
irq_unlock(key);
return -ENODATA;
}
LOG_DBG("read request error for addr:0x%08x size:%d",
/* If the area was erased, ECC errors are triggered on read. */
status = get_cmd_status(FMC_CMD_BLANK_CHECK, addr, len);
if (!(status & FMC_STATUS_FAIL)) {
LOG_DBG("read request on erased addr:0x%08x size:%d",
addr, len);
irq_unlock(key);
return -EIO;
return -ENODATA;
}
irq_unlock(key);

View File

@@ -143,14 +143,14 @@ static int gpio_adp5585_config(const struct device *dev, gpio_pin_t pin, gpio_fl
data->output |= BIT(pin);
}
if (bank == 0) {
/* reg_value for ADP5585_GPO_OUT_MODE */
/* reg_value for ADP5585_GPO_DATA_OUT */
reg_value = (uint8_t)data->output;
} else {
/* reg_value for ADP5585_GPO_OUT_MODE */
/* reg_value for ADP5585_GPO_DATA_OUT */
reg_value = (uint8_t)(data->output >> 8);
}
ret = i2c_reg_write_byte_dt(&parent_cfg->i2c_bus,
ADP5585_GPO_OUT_MODE_A + bank,
ADP5585_GPO_DATA_OUT_A + bank,
reg_value);
if (ret != 0) {
goto out;

View File

@@ -179,9 +179,19 @@ static void eeprom_target_buf_write_received(struct i2c_target_config *config,
struct i2c_eeprom_target_data *data = CONTAINER_OF(config,
struct i2c_eeprom_target_data,
config);
/* The first byte is offset */
data->buffer_idx = *ptr;
memcpy(&data->buffer[data->buffer_idx], ptr + 1, len - 1);
/* The first byte(s) is offset */
uint32_t idx_write_cnt = 0;
data->buffer_idx = 0;
while (idx_write_cnt < (data->address_width >> 3)) {
data->buffer_idx = (data->buffer_idx << 8) | *ptr++;
len--;
idx_write_cnt++;
}
if (len > 0) {
memcpy(&data->buffer[data->buffer_idx], ptr, len);
}
}
static int eeprom_target_buf_read_requested(struct i2c_target_config *config,

View File

@@ -153,7 +153,8 @@ static int lp50xx_set_color(const struct device *dev, uint32_t led,
{
const struct lp50xx_config *config = dev->config;
const struct led_info *led_info = lp50xx_led_to_info(config, led);
uint8_t buf[4];
uint8_t buf[LP50XX_COLORS_PER_LED + 1];
uint8_t i;
if (!led_info) {
return -ENODEV;
@@ -170,11 +171,11 @@ static int lp50xx_set_color(const struct device *dev, uint32_t led,
buf[0] = LP50XX_OUT0_COLOR(config->num_modules);
buf[0] += LP50XX_COLORS_PER_LED * led_info->index;
buf[1] = color[0];
buf[2] = color[1];
buf[3] = color[2];
for (i = 0; i < led_info->num_colors; i++) {
buf[1 + i] = color[i];
}
return i2c_write_dt(&config->bus, buf, sizeof(buf));
return i2c_write_dt(&config->bus, buf, led_info->num_colors + 1);
}
static int lp50xx_write_channels(const struct device *dev,
@@ -266,6 +267,7 @@ static int lp50xx_enable(const struct device *dev, bool enable)
static int lp50xx_init(const struct device *dev)
{
const struct lp50xx_config *config = dev->config;
uint8_t led;
int err;
if (!i2c_is_ready_dt(&config->bus)) {
@@ -273,6 +275,7 @@ static int lp50xx_init(const struct device *dev)
return -ENODEV;
}
/* Check LED configuration found in DT */
if (config->num_leds > config->max_leds) {
LOG_ERR("%s: invalid number of LEDs %d (max %d)",
dev->name,
@@ -280,6 +283,16 @@ static int lp50xx_init(const struct device *dev)
config->max_leds);
return -EINVAL;
}
for (led = 0; led < config->num_leds; led++) {
const struct led_info *led_info =
lp50xx_led_to_info(config, led);
if (led_info->num_colors > LP50XX_COLORS_PER_LED) {
LOG_ERR("%s: LED %d: invalid number of colors (max %d)",
dev->name, led, LP50XX_COLORS_PER_LED);
return -EINVAL;
}
}
/* Configure GPIO if present */
if (config->gpio_enable.port != NULL) {

View File

@@ -11,7 +11,7 @@
#define _BUILD_MEM_REGION(node_id) \
{.dt_addr = DT_REG_ADDR(DT_PARENT(node_id)),\
.dt_size = DT_REG_SIZE(DT_PARENT(node_id))}
.dt_size = DT_REG_SIZE(DT_PARENT(node_id))},
struct ret_mem_region {
uintptr_t dt_addr;

View File

@@ -37,7 +37,6 @@ endchoice
config ADXL345_STREAM
bool "Use FIFO to stream data"
select ADXL345_TRIGGER
default y
depends on SPI_RTIO
depends on SENSOR_ASYNC_API
help

View File

@@ -229,7 +229,7 @@ static int adxl345_attr_set_odr(const struct device *dev,
const struct sensor_value *val)
{
enum adxl345_odr odr;
struct adxl345_dev_config *cfg = (struct adxl345_dev_config *)dev->config;
struct adxl345_dev_data *data = dev->data;
switch (val->val1) {
case 12:
@@ -257,7 +257,7 @@ static int adxl345_attr_set_odr(const struct device *dev,
int ret = adxl345_set_odr(dev, odr);
if (ret == 0) {
cfg->odr = odr;
data->odr = odr;
}
return ret;
@@ -281,6 +281,7 @@ int adxl345_read_sample(const struct device *dev,
{
int16_t raw_x, raw_y, raw_z;
uint8_t axis_data[6], status1;
struct adxl345_dev_data *data = dev->data;
if (!IS_ENABLED(CONFIG_ADXL345_TRIGGER)) {
do {
@@ -303,6 +304,9 @@ int adxl345_read_sample(const struct device *dev,
sample->y = raw_y;
sample->z = raw_z;
sample->selected_range = data->selected_range;
sample->is_full_res = data->is_full_res;
return 0;
}
@@ -453,11 +457,13 @@ static int adxl345_init(const struct device *dev)
return -ENODEV;
}
#if CONFIG_ADXL345_STREAM
rc = adxl345_reg_write_byte(dev, ADXL345_FIFO_CTL_REG, ADXL345_FIFO_STREAM_MODE);
if (rc < 0) {
LOG_ERR("FIFO enable failed\n");
return -EIO;
}
#endif
rc = adxl345_reg_write_byte(dev, ADXL345_DATA_FORMAT_REG, ADXL345_RANGE_8G);
if (rc < 0) {

View File

@@ -153,6 +153,7 @@ struct adxl345_dev_data {
struct adxl345_fifo_config fifo_config;
uint8_t is_full_res;
uint8_t selected_range;
enum adxl345_odr odr;
#ifdef CONFIG_ADXL345_TRIGGER
struct gpio_callback gpio_cb;
@@ -201,6 +202,7 @@ struct adxl345_sample {
uint8_t res: 7;
#endif /* CONFIG_ADXL345_STREAM */
uint8_t selected_range;
bool is_full_res;
int16_t x;
int16_t y;
int16_t z;

View File

@@ -6,17 +6,42 @@
#include "adxl345.h"
#ifdef CONFIG_ADXL345_STREAM
/** The q-scale factor will always be the same, as the nominal LSB/g
* changes at the same rate the selected shift parameter per range:
*
* - At 2G: 256 LSB/g, 10-bits resolution.
* - At 4g: 128 LSB/g, 10-bits resolution.
* - At 8g: 64 LSB/g, 10-bits resolution.
* - At 16g 32 LSB/g, 10-bits resolution.
*/
static const uint32_t qscale_factor_no_full_res[] = {
/* (1.0 / Resolution-LSB-per-g * (2^31 / 2^5) * SENSOR_G / 1000000 */
[ADXL345_RANGE_2G] = UINT32_C(2570754),
/* (1.0 / Resolution-LSB-per-g) * (2^31 / 2^6) * SENSOR_G / 1000000 */
[ADXL345_RANGE_4G] = UINT32_C(2570754),
/* (1.0 / Resolution-LSB-per-g) * (2^31 / 2^7) ) * SENSOR_G / 1000000 */
[ADXL345_RANGE_8G] = UINT32_C(2570754),
/* (1.0 / Resolution-LSB-per-g) * (2^31 / 2^8) ) * SENSOR_G / 1000000 */
[ADXL345_RANGE_16G] = UINT32_C(2570754),
};
#define SENSOR_SCALING_FACTOR (SENSOR_G / (16 * 1000 / 100))
static const uint32_t accel_period_ns[] = {
[ADXL345_ODR_12HZ] = UINT32_C(1000000000) / 12,
[ADXL345_ODR_25HZ] = UINT32_C(1000000000) / 25,
[ADXL345_ODR_50HZ] = UINT32_C(1000000000) / 50,
[ADXL345_ODR_100HZ] = UINT32_C(1000000000) / 100,
[ADXL345_ODR_200HZ] = UINT32_C(1000000000) / 200,
[ADXL345_ODR_400HZ] = UINT32_C(1000000000) / 400,
/** Sensitivities based on Range:
*
* - At 2G: 256 LSB/g, 10-bits resolution.
* - At 4g: 256 LSB/g, 11-bits resolution.
* - At 8g: 256 LSB/g, 12-bits resolution.
* - At 16g 256 LSB/g, 13-bits resolution.
*/
static const uint32_t qscale_factor_full_res[] = {
/* (1.0 / Resolution-LSB-per-g) * (2^31 / 2^5) * SENSOR_G / 1000000 */
[ADXL345_RANGE_2G] = UINT32_C(2570754),
/* (1.0 / Resolution-LSB-per-g) * (2^31 / 2^6) * SENSOR_G / 1000000 */
[ADXL345_RANGE_4G] = UINT32_C(1285377),
/* (1.0 / Resolution-LSB-per-g) * (2^31 / 2^7) ) * SENSOR_G / 1000000 */
[ADXL345_RANGE_8G] = UINT32_C(642688),
/* (1.0 / Resolution-LSB-per-g) * (2^31 / 2^8) ) * SENSOR_G / 1000000 */
[ADXL345_RANGE_16G] = UINT32_C(321344),
};
static const uint32_t range_to_shift[] = {
@@ -26,30 +51,6 @@ static const uint32_t range_to_shift[] = {
[ADXL345_RANGE_16G] = 8,
};
/* (1 / sensitivity) * (pow(2,31) / pow(2,shift)) * (unit_scaler) */
static const uint32_t qscale_factor_no_full_res[] = {
/* (1.0 / ADXL362_ACCEL_2G_LSB_PER_G) * (2^31 / 2^5) * SENSOR_G / 1000000 */
[ADXL345_RANGE_2G] = UINT32_C(2569011),
/* (1.0 / ADXL362_ACCEL_4G_LSB_PER_G) * (2^31 / 2^6) * SENSOR_G / 1000000 */
[ADXL345_RANGE_4G] = UINT32_C(642253),
/* (1.0 / ADXL362_ACCEL_8G_LSB_PER_G) * (2^31 / 2^7) ) * SENSOR_G / 1000000 */
[ADXL345_RANGE_8G] = UINT32_C(160563),
/* (1.0 / ADXL362_ACCEL_8G_LSB_PER_G) * (2^31 / 2^8) ) * SENSOR_G / 1000000 */
[ADXL345_RANGE_16G] = UINT32_C(40141),
};
/* (1 / sensitivity) * (pow(2,31) / pow(2,shift)) * (unit_scaler) */
static const uint32_t qscale_factor_full_res[] = {
/* (1.0 / ADXL362_ACCEL_2G_LSB_PER_G) * (2^31 / 2^5) * SENSOR_G / 1000000 */
[ADXL345_RANGE_2G] = UINT32_C(2569011),
/* (1.0 / ADXL362_ACCEL_4G_LSB_PER_G) * (2^31 / 2^6) * SENSOR_G / 1000000 */
[ADXL345_RANGE_4G] = UINT32_C(1284506),
/* (1.0 / ADXL362_ACCEL_8G_LSB_PER_G) * (2^31 / 2^7) ) * SENSOR_G / 1000000 */
[ADXL345_RANGE_8G] = UINT32_C(642253),
/* (1.0 / ADXL362_ACCEL_8G_LSB_PER_G) * (2^31 / 2^8) ) * SENSOR_G / 1000000 */
[ADXL345_RANGE_16G] = UINT32_C(321126),
};
static inline void adxl345_accel_convert_q31(q31_t *out, int16_t sample, int32_t range,
uint8_t is_full_res)
{
@@ -76,15 +77,28 @@ static inline void adxl345_accel_convert_q31(q31_t *out, int16_t sample, int32_t
}
break;
}
*out = sample * qscale_factor_full_res[range];
} else {
if (sample & BIT(9)) {
sample |= ADXL345_COMPLEMENT;
}
*out = sample * qscale_factor_no_full_res[range];
}
*out = sample * qscale_factor_no_full_res[range];
}
#ifdef CONFIG_ADXL345_STREAM
#define SENSOR_SCALING_FACTOR (SENSOR_G / (16 * 1000 / 100))
static const uint32_t accel_period_ns[] = {
[ADXL345_ODR_12HZ] = UINT32_C(1000000000) / 12,
[ADXL345_ODR_25HZ] = UINT32_C(1000000000) / 25,
[ADXL345_ODR_50HZ] = UINT32_C(1000000000) / 50,
[ADXL345_ODR_100HZ] = UINT32_C(1000000000) / 100,
[ADXL345_ODR_200HZ] = UINT32_C(1000000000) / 200,
[ADXL345_ODR_400HZ] = UINT32_C(1000000000) / 400,
};
static int adxl345_decode_stream(const uint8_t *buffer, struct sensor_chan_spec chan_spec,
uint32_t *fit, uint16_t max_count, void *data_out)
{
@@ -208,7 +222,12 @@ static int adxl345_decode_sample(const struct adxl345_sample *data,
struct sensor_chan_spec chan_spec, uint32_t *fit,
uint16_t max_count, void *data_out)
{
struct sensor_value *out = (struct sensor_value *)data_out;
struct sensor_three_axis_data *out = (struct sensor_three_axis_data *)data_out;
memset(out, 0, sizeof(struct sensor_three_axis_data));
out->header.base_timestamp_ns = k_ticks_to_ns_floor64(k_uptime_ticks());
out->header.reading_count = 1;
out->shift = range_to_shift[data->selected_range];
if (*fit > 0) {
return -ENOTSUP;
@@ -216,9 +235,12 @@ static int adxl345_decode_sample(const struct adxl345_sample *data,
switch (chan_spec.chan_type) {
case SENSOR_CHAN_ACCEL_XYZ:
adxl345_accel_convert(out++, data->x);
adxl345_accel_convert(out++, data->y);
adxl345_accel_convert(out, data->z);
adxl345_accel_convert_q31(&out->readings->x, data->x, data->selected_range,
data->is_full_res);
adxl345_accel_convert_q31(&out->readings->y, data->y, data->selected_range,
data->is_full_res);
adxl345_accel_convert_q31(&out->readings->z, data->z, data->selected_range,
data->is_full_res);
break;
default:
return -ENOTSUP;
@@ -226,7 +248,7 @@ static int adxl345_decode_sample(const struct adxl345_sample *data,
*fit = 1;
return 0;
return 1;
}
static int adxl345_decoder_decode(const uint8_t *buffer, struct sensor_chan_spec chan_spec,
@@ -259,10 +281,33 @@ static bool adxl345_decoder_has_trigger(const uint8_t *buffer, enum sensor_trigg
}
}
static int adxl345_get_size_info(struct sensor_chan_spec channel, size_t *base_size,
size_t *frame_size)
{
__ASSERT_NO_MSG(base_size != NULL);
__ASSERT_NO_MSG(frame_size != NULL);
if (channel.chan_type >= SENSOR_CHAN_ALL) {
return -ENOTSUP;
}
switch (channel.chan_type) {
case SENSOR_CHAN_ACCEL_XYZ:
*base_size = sizeof(struct sensor_three_axis_data);
*frame_size = sizeof(struct sensor_three_axis_sample_data);
return 0;
default:
break;
}
return -ENOTSUP;
}
SENSOR_DECODER_API_DT_DEFINE() = {
.get_frame_count = adxl345_decoder_get_frame_count,
.decode = adxl345_decoder_decode,
.has_trigger = adxl345_decoder_has_trigger,
.get_size_info = adxl345_get_size_info,
};
int adxl345_get_decoder(const struct device *dev, const struct sensor_decoder_api **decoder)

View File

@@ -159,7 +159,7 @@ static void adxl345_process_fifo_samples_cb(struct rtio *r, const struct rtio_sq
hdr->int_status = data->status1;
hdr->is_full_res = data->is_full_res;
hdr->selected_range = data->selected_range;
hdr->accel_odr = cfg->odr;
hdr->accel_odr = data->odr;
hdr->sample_set_size = sample_set_size;
uint32_t buf_avail = buf_len;

View File

@@ -550,7 +550,7 @@ static int adxl372_attr_set_odr(const struct device *dev,
const struct sensor_value *val)
{
enum adxl372_odr odr;
struct adxl372_dev_config *cfg = (struct adxl372_dev_config *)dev->config;
struct adxl372_data *data = dev->data;
switch (val->val1) {
case 400:
@@ -575,7 +575,7 @@ static int adxl372_attr_set_odr(const struct device *dev,
int ret = adxl372_set_odr(dev, odr);
if (ret == 0) {
cfg->odr = odr;
data->odr = odr;
}
return ret;

View File

@@ -312,6 +312,7 @@ struct adxl372_data {
const struct adxl372_transfer_function *hw_tf;
struct adxl372_fifo_config fifo_config;
enum adxl372_act_proc_mode act_proc_mode;
enum adxl372_odr odr;
#ifdef CONFIG_ADXL372_TRIGGER
struct gpio_callback gpio_cb;

View File

@@ -213,7 +213,7 @@ static void adxl372_process_fifo_samples_cb(struct rtio *r, const struct rtio_sq
hdr->is_fifo = 1;
hdr->timestamp = data->timestamp;
hdr->int_status = data->status1;
hdr->accel_odr = cfg->odr;
hdr->accel_odr = data->odr;
hdr->sample_set_size = sample_set_size;
if ((cfg->fifo_config.fifo_format == ADXL372_X_FIFO) ||

View File

@@ -318,25 +318,44 @@ static int get_frame_count(const uint8_t *buffer, struct sensor_chan_spec channe
switch (channel.chan_type) {
case SENSOR_CHAN_ACCEL_XYZ:
channel.chan_type = SENSOR_CHAN_ACCEL_X;
break;
case SENSOR_CHAN_GYRO_XYZ:
channel.chan_type = SENSOR_CHAN_GYRO_X;
break;
case SENSOR_CHAN_MAGN_XYZ:
channel.chan_type = SENSOR_CHAN_MAGN_X;
break;
case SENSOR_CHAN_POS_DXYZ:
channel.chan_type = SENSOR_CHAN_POS_DX;
for (size_t i = 0 ; i < header->num_channels; ++i) {
/* For 3-axis channels, we need to verify we have each individual axis */
struct sensor_chan_spec channel_x = {
.chan_type = channel.chan_type - 3,
.chan_idx = channel.chan_idx,
};
struct sensor_chan_spec channel_y = {
.chan_type = channel.chan_type - 2,
.chan_idx = channel.chan_idx,
};
struct sensor_chan_spec channel_z = {
.chan_type = channel.chan_type - 1,
.chan_idx = channel.chan_idx,
};
/** The three axes don't need to be at the beginning of the header, but
* they should be consecutive.
*/
if (((header->num_channels - i) >= 3) &&
sensor_chan_spec_eq(header->channels[i], channel_x) &&
sensor_chan_spec_eq(header->channels[i + 1], channel_y) &&
sensor_chan_spec_eq(header->channels[i + 2], channel_z)) {
*frame_count = 1;
return 0;
}
}
break;
default:
break;
}
for (size_t i = 0; i < header->num_channels; ++i) {
if (sensor_chan_spec_eq(header->channels[i], channel)) {
*frame_count = 1;
return 0;
for (size_t i = 0; i < header->num_channels; ++i) {
if (sensor_chan_spec_eq(header->channels[i], channel)) {
*frame_count = 1;
return 0;
}
}
break;
}
return -ENOTSUP;
@@ -353,21 +372,9 @@ int sensor_natively_supported_channel_size_info(struct sensor_chan_spec channel,
}
switch (channel.chan_type) {
case SENSOR_CHAN_ACCEL_X:
case SENSOR_CHAN_ACCEL_Y:
case SENSOR_CHAN_ACCEL_Z:
case SENSOR_CHAN_ACCEL_XYZ:
case SENSOR_CHAN_GYRO_X:
case SENSOR_CHAN_GYRO_Y:
case SENSOR_CHAN_GYRO_Z:
case SENSOR_CHAN_GYRO_XYZ:
case SENSOR_CHAN_MAGN_X:
case SENSOR_CHAN_MAGN_Y:
case SENSOR_CHAN_MAGN_Z:
case SENSOR_CHAN_MAGN_XYZ:
case SENSOR_CHAN_POS_DX:
case SENSOR_CHAN_POS_DY:
case SENSOR_CHAN_POS_DZ:
case SENSOR_CHAN_POS_DXYZ:
*base_size = sizeof(struct sensor_three_axis_data);
*frame_size = sizeof(struct sensor_three_axis_sample_data);
@@ -480,33 +487,21 @@ static int decode(const uint8_t *buffer, struct sensor_chan_spec chan_spec,
/* Check for 3d channel mappings */
switch (chan_spec.chan_type) {
case SENSOR_CHAN_ACCEL_X:
case SENSOR_CHAN_ACCEL_Y:
case SENSOR_CHAN_ACCEL_Z:
case SENSOR_CHAN_ACCEL_XYZ:
count = decode_three_axis(header, q, data_out, SENSOR_CHAN_ACCEL_X,
SENSOR_CHAN_ACCEL_Y, SENSOR_CHAN_ACCEL_Z,
chan_spec.chan_idx);
break;
case SENSOR_CHAN_GYRO_X:
case SENSOR_CHAN_GYRO_Y:
case SENSOR_CHAN_GYRO_Z:
case SENSOR_CHAN_GYRO_XYZ:
count = decode_three_axis(header, q, data_out, SENSOR_CHAN_GYRO_X,
SENSOR_CHAN_GYRO_Y, SENSOR_CHAN_GYRO_Z,
chan_spec.chan_idx);
break;
case SENSOR_CHAN_MAGN_X:
case SENSOR_CHAN_MAGN_Y:
case SENSOR_CHAN_MAGN_Z:
case SENSOR_CHAN_MAGN_XYZ:
count = decode_three_axis(header, q, data_out, SENSOR_CHAN_MAGN_X,
SENSOR_CHAN_MAGN_Y, SENSOR_CHAN_MAGN_Z,
chan_spec.chan_idx);
break;
case SENSOR_CHAN_POS_DX:
case SENSOR_CHAN_POS_DY:
case SENSOR_CHAN_POS_DZ:
case SENSOR_CHAN_POS_DXYZ:
count = decode_three_axis(header, q, data_out, SENSOR_CHAN_POS_DX,
SENSOR_CHAN_POS_DY, SENSOR_CHAN_POS_DZ,

View File

@@ -354,23 +354,6 @@ void sensor_shell_processing_callback(int result, uint8_t *buf, uint32_t buf_len
size_t frame_size;
uint16_t frame_count;
/* Channels with multi-axis equivalents are skipped */
switch (ch.chan_type) {
case SENSOR_CHAN_ACCEL_X:
case SENSOR_CHAN_ACCEL_Y:
case SENSOR_CHAN_ACCEL_Z:
case SENSOR_CHAN_GYRO_X:
case SENSOR_CHAN_GYRO_Y:
case SENSOR_CHAN_GYRO_Z:
case SENSOR_CHAN_MAGN_X:
case SENSOR_CHAN_MAGN_Y:
case SENSOR_CHAN_MAGN_Z:
case SENSOR_CHAN_POS_DX:
case SENSOR_CHAN_POS_DY:
case SENSOR_CHAN_POS_DZ:
continue;
}
rc = decoder->get_size_info(ch, &base_size, &frame_size);
if (rc != 0) {
LOG_DBG("skipping unsupported channel %s:%d",

View File

@@ -435,7 +435,7 @@ static int lis2de12_init(const struct device *dev)
#define LIS2DE12_CONFIG_SPI(inst) \
{ \
STMEMSC_CTX_SPI(&lis2de12_config_##inst.stmemsc_cfg), \
STMEMSC_CTX_SPI_INCR(&lis2de12_config_##inst.stmemsc_cfg), \
.stmemsc_cfg = { \
.spi = SPI_DT_SPEC_INST_GET(inst, LIS2DE12_SPI_OP, 0), \
}, \

View File

@@ -63,13 +63,19 @@ int stmemsc_spi_write(const struct spi_dt_spec *stmemsc,
int stmemsc_spi_read_incr(const struct spi_dt_spec *stmemsc,
uint8_t reg_addr, uint8_t *value, uint8_t len)
{
reg_addr |= STMEMSC_SPI_ADDR_AUTO_INCR;
if (len > 1) {
reg_addr |= STMEMSC_SPI_ADDR_AUTO_INCR;
}
return stmemsc_spi_read(stmemsc, reg_addr, value, len);
}
int stmemsc_spi_write_incr(const struct spi_dt_spec *stmemsc,
uint8_t reg_addr, uint8_t *value, uint8_t len)
{
reg_addr |= STMEMSC_SPI_ADDR_AUTO_INCR;
if (len > 1) {
reg_addr |= STMEMSC_SPI_ADDR_AUTO_INCR;
}
return stmemsc_spi_write(stmemsc, reg_addr, value, len);
}

View File

@@ -276,6 +276,7 @@ static int uart_esp32_configure(const struct device *dev, const struct uart_conf
uart_hal_set_rxfifo_full_thr(&data->hal, UART_RX_FIFO_THRESH);
uart_hal_set_txfifo_empty_thr(&data->hal, UART_TX_FIFO_THRESH);
uart_hal_rxfifo_rst(&data->hal);
uart_hal_txfifo_rst(&data->hal);
switch (cfg->parity) {
case UART_CFG_PARITY_NONE:

View File

@@ -2339,6 +2339,18 @@ static int uarte_instance_init(const struct device *dev,
: UART_CFG_FLOW_CTRL_NONE, \
}
/* Macro determines if PM actions are interrupt safe. They are in case of
* asynchronous API (except for instance in fast power domain) and non-asynchronous
* API if RX is disabled. Macro must resolve to a literal 1 or 0.
*/
#define UARTE_PM_ISR_SAFE(idx) \
COND_CODE_1(INSTANCE_IS_FAST_PD(_, /*empty*/, idx, _), \
(0), \
(COND_CODE_1(CONFIG_UART_##idx##_ASYNC, \
(PM_DEVICE_ISR_SAFE), \
(COND_CODE_1(UARTE_PROP(idx, disable_rx), \
(PM_DEVICE_ISR_SAFE), (0)))))) \
#define UART_NRF_UARTE_DEVICE(idx) \
NRF_DT_CHECK_NODE_HAS_PINCTRL_SLEEP(UARTE(idx)); \
UARTE_INT_DRIVEN(idx); \
@@ -2405,7 +2417,7 @@ static int uarte_instance_init(const struct device *dev,
} \
\
PM_DEVICE_DT_DEFINE(UARTE(idx), uarte_nrfx_pm_action, \
PM_DEVICE_ISR_SAFE); \
UARTE_PM_ISR_SAFE(idx)); \
\
DEVICE_DT_DEFINE(UARTE(idx), \
uarte_##idx##_init, \

View File

@@ -37,6 +37,24 @@ config SPI_RTIO
This option enables the RTIO API calls. RTIO support is
experimental as the API itself is unstable.
if SPI_RTIO
config SPI_RTIO_FALLBACK_MSGS
int "Number of available spi_buf structs for the default handler to use"
default 4
help
When RTIO is used with a driver that does not yet implement the submit API
natively the submissions are converted back to struct spi_buf values that
are given to spi_transfer. This requires some number of msgs be available to convert
the submissions into on the stack. MISRA rules dictate we must know this in
advance.
In all likelihood 4 is going to work for everyone, but in case you do end up with
an issue where you are using RTIO, your driver does not implement submit natively,
and get an error relating to not enough spi msgs this is the Kconfig to manipulate.
endif # SPI_RTIO
config SPI_SLAVE
bool "Slave support [EXPERIMENTAL]"
select EXPERIMENTAL

View File

@@ -93,7 +93,8 @@ static void spi_mcux_transfer_next_packet(const struct device *dev)
transfer.txData = NULL;
}
transfer.dataSize = data->dfs;
/* Burst length is set in the configure step */
transfer.dataSize = 1;
status = ECSPI_MasterTransferNonBlocking(base, &data->handle, &transfer);
if (status != kStatus_Success) {
@@ -163,7 +164,7 @@ static int spi_mcux_configure(const struct device *dev,
return -ENOTSUP;
}
if (spi_cfg->slave > kECSPI_Channel3) {
if (!spi_cs_is_gpio(spi_cfg) && spi_cfg->slave > kECSPI_Channel3) {
LOG_ERR("Slave %d is greater than %d", spi_cfg->slave, kECSPI_Channel3);
return -EINVAL;
}
@@ -181,7 +182,8 @@ static int spi_mcux_configure(const struct device *dev,
ECSPI_MasterGetDefaultConfig(&master_config);
master_config.channel = (ecspi_channel_source_t)spi_cfg->slave;
master_config.channel =
spi_cs_is_gpio(spi_cfg) ? kECSPI_Channel0 : (ecspi_channel_source_t)spi_cfg->slave;
master_config.channelConfig.polarity =
(SPI_MODE_GET(spi_cfg->operation) & SPI_MODE_CPOL)
? kECSPI_PolarityActiveLow

View File

@@ -22,6 +22,7 @@ static void spi_rtio_iodev_default_submit_sync(struct rtio_iodev_sqe *iodev_sqe)
{
struct spi_dt_spec *dt_spec = iodev_sqe->sqe.iodev->data;
const struct device *dev = dt_spec->bus;
uint8_t num_msgs = 0;
int err = 0;
LOG_DBG("Sync RTIO work item for: %p", (void *)dev);
@@ -33,67 +34,103 @@ static void spi_rtio_iodev_default_submit_sync(struct rtio_iodev_sqe *iodev_sqe)
struct rtio_iodev_sqe *txn_head = iodev_sqe;
struct rtio_iodev_sqe *txn_curr = iodev_sqe;
/* We allocate the spi_buf's on the stack, to do so
* the count of messages needs to be determined to
* ensure we don't go over the statically sized array.
*/
do {
switch (txn_curr->sqe.op) {
case RTIO_OP_RX:
case RTIO_OP_TX:
case RTIO_OP_TINY_TX:
case RTIO_OP_TXRX:
num_msgs++;
break;
default:
LOG_ERR("Invalid op code %d for submission %p", txn_curr->sqe.op,
(void *)&txn_curr->sqe);
err = -EIO;
break;
}
txn_curr = rtio_txn_next(txn_curr);
} while (err == 0 && txn_curr != NULL);
if (err != 0) {
rtio_iodev_sqe_err(txn_head, err);
return;
}
/* Allocate msgs on the stack, MISRA doesn't like VLAs so we need a statically
* sized array here. It's pretty unlikely we have more than 4 spi messages
* in a transaction as we typically would only have 2, one to write a
* register address, and another to read/write the register into an array
*/
if (num_msgs > CONFIG_SPI_RTIO_FALLBACK_MSGS) {
LOG_ERR("At most CONFIG_SPI_RTIO_FALLBACK_MSGS"
" submissions in a transaction are"
" allowed in the default handler");
rtio_iodev_sqe_err(txn_head, -ENOMEM);
return;
}
struct spi_buf tx_bufs[CONFIG_SPI_RTIO_FALLBACK_MSGS];
struct spi_buf rx_bufs[CONFIG_SPI_RTIO_FALLBACK_MSGS];
struct spi_buf_set tx_buf_set = {
.buffers = tx_bufs,
.count = num_msgs,
};
struct spi_buf_set rx_buf_set = {
.buffers = rx_bufs,
.count = num_msgs,
};
txn_curr = txn_head;
for (size_t i = 0 ; i < num_msgs ; i++) {
struct rtio_sqe *sqe = &txn_curr->sqe;
struct spi_buf tx_buf = {0};
struct spi_buf_set tx_buf_set = {
.buffers = &tx_buf,
};
struct spi_buf rx_buf = {0};
struct spi_buf_set rx_buf_set = {
.buffers = &rx_buf,
};
LOG_DBG("Preparing transfer: %p", txn_curr);
switch (sqe->op) {
case RTIO_OP_RX:
rx_buf.buf = sqe->rx.buf;
rx_buf.len = sqe->rx.buf_len;
rx_buf_set.count = 1;
rx_bufs[i].buf = sqe->rx.buf;
rx_bufs[i].len = sqe->rx.buf_len;
tx_bufs[i].buf = NULL;
tx_bufs[i].len = sqe->rx.buf_len;
break;
case RTIO_OP_TX:
tx_buf.buf = (uint8_t *)sqe->tx.buf;
tx_buf.len = sqe->tx.buf_len;
tx_buf_set.count = 1;
rx_bufs[i].buf = NULL;
rx_bufs[i].len = sqe->tx.buf_len;
tx_bufs[i].buf = (uint8_t *)sqe->tx.buf;
tx_bufs[i].len = sqe->tx.buf_len;
break;
case RTIO_OP_TINY_TX:
tx_buf.buf = (uint8_t *)sqe->tiny_tx.buf;
tx_buf.len = sqe->tiny_tx.buf_len;
tx_buf_set.count = 1;
rx_bufs[i].buf = NULL;
rx_bufs[i].len = sqe->tiny_tx.buf_len;
tx_bufs[i].buf = (uint8_t *)sqe->tiny_tx.buf;
tx_bufs[i].len = sqe->tiny_tx.buf_len;
break;
case RTIO_OP_TXRX:
rx_buf.buf = sqe->txrx.rx_buf;
rx_buf.len = sqe->txrx.buf_len;
tx_buf.buf = (uint8_t *)sqe->txrx.tx_buf;
tx_buf.len = sqe->txrx.buf_len;
rx_buf_set.count = 1;
tx_buf_set.count = 1;
rx_bufs[i].buf = sqe->txrx.rx_buf;
rx_bufs[i].len = sqe->txrx.buf_len;
tx_bufs[i].buf = (uint8_t *)sqe->txrx.tx_buf;
tx_bufs[i].len = sqe->txrx.buf_len;
break;
default:
LOG_ERR("Invalid op code %d for submission %p\n", sqe->op, (void *)sqe);
err = -EIO;
break;
}
if (!err) {
struct spi_buf_set *tx_buf_ptr = tx_buf_set.count > 0 ? &tx_buf_set : NULL;
struct spi_buf_set *rx_buf_ptr = rx_buf_set.count > 0 ? &rx_buf_set : NULL;
txn_curr = rtio_txn_next(txn_curr);
}
err = spi_transceive_dt(dt_spec, tx_buf_ptr, rx_buf_ptr);
if (err == 0) {
__ASSERT_NO_MSG(num_msgs > 0);
err = spi_transceive_dt(dt_spec, &tx_buf_set, &rx_buf_set);
}
/* NULL if this submission is not a transaction */
txn_curr = rtio_txn_next(txn_curr);
}
} while (err >= 0 && txn_curr != NULL);
if (err < 0) {
LOG_ERR("Transfer failed: %d", err);
if (err != 0) {
rtio_iodev_sqe_err(txn_head, err);
} else {
LOG_DBG("Transfer OK: %d", err);
rtio_iodev_sqe_ok(txn_head, err);
rtio_iodev_sqe_ok(txn_head, 0);
}
}

View File

@@ -305,13 +305,20 @@ zephyr_compile_definitions_ifdef(CONFIG_WIFI_MGMT_RAW_SCAN_RESULTS
-DWIFI_MGMT_RAW_SCAN_RESULTS=${CONFIG_WIFI_MGMT_RAW_SCAN_RESULTS}
)
zephyr_compile_definitions_ifdef(CONFIG_NRF70_OFFLOADED_RAW_TX
-DNRF_NRF70_OFFLOADED_RAW_TX
)
zephyr_compile_definitions_ifdef(CONFIG_NRF70_PASSIVE_SCAN_ONLY
-DNRF70_PASSIVE_SCAN_ONLY
)
zephyr_compile_definitions(
-DNRF70_RX_NUM_BUFS=${CONFIG_NRF70_RX_NUM_BUFS}
-DNRF70_MAX_TX_TOKENS=${CONFIG_NRF70_MAX_TX_TOKENS}
-DNRF70_RX_MAX_DATA_SIZE=${CONFIG_NRF70_RX_MAX_DATA_SIZE}
-DNRF70_MAX_TX_PENDING_QLEN=${CONFIG_NRF70_MAX_TX_PENDING_QLEN}
-DNRF70_RPU_PS_IDLE_TIMEOUT_MS=${CONFIG_NRF70_RPU_PS_IDLE_TIMEOUT_MS}
-DNRF70_REG_DOMAIN=${CONFIG_NRF70_REG_DOMAIN}
-DNRF70_BAND_2G_LOWER_EDGE_BACKOFF_DSSS=${CONFIG_NRF70_BAND_2G_LOWER_EDGE_BACKOFF_DSSS}
-DNRF70_BAND_2G_LOWER_EDGE_BACKOFF_HT=${CONFIG_NRF70_BAND_2G_LOWER_EDGE_BACKOFF_HT}
-DNRF70_BAND_2G_LOWER_EDGE_BACKOFF_HE=${CONFIG_NRF70_BAND_2G_LOWER_EDGE_BACKOFF_HE}

View File

@@ -55,7 +55,7 @@
status = "okay";
};
sram0: memory@20100000 {
sram0: memory@20000000 {
compatible = "mmio-sram";
};

View File

@@ -16,8 +16,8 @@
};
};
sram0: memory@20100000 {
reg = <0x20100000 DT_SIZE_K(128)>;
sram0: memory@20000000 {
reg = <0x20000000 DT_SIZE_K(128)>;
};
};
};

View File

@@ -16,8 +16,8 @@
};
};
sram0: memory@20100000 {
reg = <0x20100000 DT_SIZE_K(128)>;
sram0: memory@20000000 {
reg = <0x20000000 DT_SIZE_K(128)>;
};
};
};

View File

@@ -16,8 +16,8 @@
};
};
sram0: memory@20100000 {
reg = <0x20100000 DT_SIZE_K(64)>;
sram0: memory@20000000 {
reg = <0x20000000 DT_SIZE_K(64)>;
};
};
};

View File

@@ -16,8 +16,8 @@
};
};
sram0: memory@20100000 {
reg = <0x20100000 DT_SIZE_K(64)>;
sram0: memory@20000000 {
reg = <0x20000000 DT_SIZE_K(64)>;
};
};
};

View File

@@ -16,8 +16,8 @@
};
};
sram0: memory@20100000 {
reg = <0x20100000 DT_SIZE_K(64)>;
sram0: memory@20000000 {
reg = <0x20000000 DT_SIZE_K(64)>;
};
};
};

View File

@@ -16,8 +16,8 @@
};
};
sram0: memory@20100000 {
reg = <0x20100000 DT_SIZE_K(64)>;
sram0: memory@20000000 {
reg = <0x20000000 DT_SIZE_K(64)>;
};
};
};

View File

@@ -16,8 +16,8 @@
};
};
sram0: memory@20100000 {
reg = <0x20100000 DT_SIZE_K(64)>;
sram0: memory@20000000 {
reg = <0x20000000 DT_SIZE_K(64)>;
};
};
};

View File

@@ -16,8 +16,8 @@
};
};
sram0: memory@20100000 {
reg = <0x20100000 DT_SIZE_K(64)>;
sram0: memory@20000000 {
reg = <0x20000000 DT_SIZE_K(64)>;
};
};
};

View File

@@ -16,8 +16,8 @@
};
};
sram0: memory@20100000 {
reg = <0x20100000 DT_SIZE_K(128)>;
sram0: memory@20000000 {
reg = <0x20000000 DT_SIZE_K(128)>;
};
};
};

View File

@@ -16,8 +16,8 @@
};
};
sram0: memory@20100000 {
reg = <0x20100000 DT_SIZE_K(128)>;
sram0: memory@20000000 {
reg = <0x20000000 DT_SIZE_K(128)>;
};
};
};

View File

@@ -16,8 +16,8 @@
};
};
sram0: memory@20100000 {
reg = <0x20100000 DT_SIZE_K(160)>;
sram0: memory@20000000 {
reg = <0x20000000 DT_SIZE_K(160)>;
};
};
};

View File

@@ -8,6 +8,8 @@
/ {
aliases {
adc-1 = &adc1;
sercom-4 = &sercom4;
sercom-5 = &sercom5;
};
@@ -15,15 +17,17 @@
soc {
adc1: adc@42004800 {
compatible = "atmel,sam0-adc";
status = "disabled";
reg = <0x42004800 0x30>;
interrupts = <26 0>;
interrupt-names = "resrdy";
clocks = <&gclk 34>, <&mclk 0x1c 18>;
clock-names = "GCLK", "MCLK";
status = "disabled";
#io-channel-cells = <1>;
gclk = <0>;
prescaler = <4>;
#io-channel-cells = <1>;
};
sercom4: sercom@42001400 {
@@ -51,9 +55,10 @@
interrupt-names = "int0";
clocks = <&gclk 26>, <&mclk 0x10 8>;
clock-names = "GCLK", "MCLK";
status = "disabled";
bosch,mram-cfg = <0x0 28 8 3 3 0 1 1>;
divider = <12>;
status = "disabled";
};
can1: can@42002000 {
@@ -63,9 +68,10 @@
interrupt-names = "int0";
clocks = <&gclk 27>, <&mclk 0x10 9>;
clock-names = "GCLK", "MCLK";
status = "disabled";
bosch,mram-cfg = <0x0 28 8 3 3 0 1 1>;
divider = <12>;
status = "disabled";
};
};
};

View File

@@ -13,6 +13,21 @@
/ {
aliases {
adc-0 = &adc0;
port-a = &porta;
port-b = &portb;
port-c = &portc;
sercom-0 = &sercom0;
sercom-1 = &sercom1;
sercom-2 = &sercom2;
sercom-3 = &sercom3;
tcc-0 = &tcc0;
tcc-1 = &tcc1;
tcc-2 = &tcc2;
watchdog0 = &wdog;
};
@@ -25,9 +40,10 @@
#size-cells = <0>;
cpu0: cpu@0 {
device_type = "cpu";
compatible = "arm,cortex-m0+";
reg = <0>;
device_type = "cpu";
};
};
@@ -43,33 +59,20 @@
<0x0080A048 0x4>;
};
aliases {
port-a = &porta;
port-b = &portb;
port-c = &portc;
sercom-0 = &sercom0;
sercom-1 = &sercom1;
sercom-2 = &sercom2;
sercom-3 = &sercom3;
tcc-0 = &tcc0;
tcc-1 = &tcc1;
tcc-2 = &tcc2;
};
soc {
nvmctrl: nvmctrl@41004000 {
compatible = "atmel,sam0-nvmctrl";
reg = <0x41004000 0x22>;
interrupts = <6 0>;
lock-regions = <16>;
#address-cells = <1>;
#size-cells = <1>;
lock-regions = <16>;
flash0: flash@0 {
compatible = "soc-nv-flash";
write-block-size = <4>;
};
};
@@ -77,12 +80,14 @@
mclk: mclk@40000800 {
compatible = "atmel,samc2x-mclk";
reg = <0x40000800 0x400>;
#clock-cells = <2>;
};
gclk: gclk@40001c00 {
compatible = "atmel,samc2x-gclk";
reg = <0x40001c00 0x400>;
#clock-cells = <1>;
};
@@ -107,20 +112,24 @@
compatible = "atmel,sam0-dmac";
reg = <0x41006000 0x50>;
interrupts = <7 0>;
status = "disabled";
#dma-cells = <2>;
};
adc0: adc@42004400 {
compatible = "atmel,sam0-adc";
status = "disabled";
reg = <0x42004400 0x30>;
interrupts = <25 0>;
interrupt-names = "resrdy";
clocks = <&gclk 33>, <&mclk 0x1c 17>;
clock-names = "GCLK", "MCLK";
status = "disabled";
#io-channel-cells = <1>;
gclk = <0>;
prescaler = <4>;
#io-channel-cells = <1>;
};
sercom0: sercom@42000400 {
@@ -165,6 +174,7 @@
interrupts = <17 0>;
clocks = <&gclk 28>, <&mclk 0x1c 9>;
clock-names = "GCLK", "MCLK";
status = "disabled";
channels = <4>;
counter-size = <24>;
@@ -176,6 +186,7 @@
interrupts = <18 0>;
clocks = <&gclk 28>, <&mclk 0x1c 10>;
clock-names = "GCLK", "MCLK";
status = "disabled";
channels = <4>;
counter-size = <24>;
@@ -187,6 +198,7 @@
interrupts = <19 0>;
clocks = <&gclk 29>, <&mclk 0x1c 11>;
clock-names = "GCLK", "MCLK";
status = "disabled";
channels = <2>;
counter-size = <16>;
@@ -194,32 +206,39 @@
pinctrl: pinctrl@41000000 {
compatible = "atmel,sam0-pinctrl";
ranges = <0x41000000 0x41000000 0x180>;
#address-cells = <1>;
#size-cells = <1>;
ranges = <0x41000000 0x41000000 0x180>;
porta: gpio@41000000 {
compatible = "atmel,sam0-gpio";
reg = <0x41000000 0x80>;
gpio-controller;
#gpio-cells = <2>;
#atmel,pin-cells = <2>;
#gpio-cells = <2>;
gpio-controller;
};
portb: gpio@41000080 {
compatible = "atmel,sam0-gpio";
reg = <0x41000080 0x80>;
gpio-controller;
#gpio-cells = <2>;
#atmel,pin-cells = <2>;
#gpio-cells = <2>;
gpio-controller;
};
portc: gpio@41000100 {
compatible = "atmel,sam0-gpio";
reg = <0x41000100 0x80>;
gpio-controller;
#gpio-cells = <2>;
#atmel,pin-cells = <2>;
#gpio-cells = <2>;
gpio-controller;
};
};
@@ -227,8 +246,9 @@
compatible = "atmel,sam0-rtc";
reg = <0x40002400 0x1C>;
interrupts = <3 0>;
clock-generator = <0>;
status = "disabled";
clock-generator = <0>;
};
};
};

View File

@@ -20,6 +20,7 @@
interrupts = <13 0>;
clocks = <&gclk 0x13>, <&pm 0x20 8>;
clock-names = "GCLK", "PM";
status = "disabled";
};
tc2: tc@42002800 {
@@ -28,6 +29,7 @@
interrupts = <15 0>;
clocks = <&gclk 0x14>, <&pm 0x20 10>;
clock-names = "GCLK", "PM";
status = "disabled";
};
tc6: tc@42003800 {
@@ -36,6 +38,7 @@
interrupts = <19 0>;
clocks = <&gclk 0x16>, <&pm 0x20 14>;
clock-names = "GCLK", "PM";
status = "disabled";
};
};
};

View File

@@ -9,14 +9,19 @@
/ {
aliases {
tc-6 = &tc6;
tcc-0 = &tcc0;
tcc-1 = &tcc1;
tcc-2 = &tcc2;
};
soc {
usb0: usb@41005000 {
compatible = "atmel,sam0-usb";
status = "disabled";
reg = <0x41005000 0x1000>;
interrupts = <7 0>;
status = "disabled";
num-bidir-endpoints = <8>;
};
@@ -24,6 +29,8 @@
compatible = "atmel,sam0-dmac";
reg = <0x41004800 0x50>;
interrupts = <6 0>;
status = "disabled";
#dma-cells = <2>;
};
@@ -33,6 +40,7 @@
interrupts = <21 0>;
clocks = <&gclk 0x1d>, <&pm 0x20 14>;
clock-names = "GCLK", "PM";
status = "disabled";
};
tcc0: tcc@42002000 {
@@ -41,6 +49,7 @@
interrupts = <15 0>;
clocks = <&gclk 26>, <&pm 0x20 8>;
clock-names = "GCLK", "PM";
status = "disabled";
channels = <4>;
counter-size = <24>;
@@ -52,6 +61,7 @@
interrupts = <16 0>;
clocks = <&gclk 26>, <&pm 0x20 9>;
clock-names = "GCLK", "PM";
status = "disabled";
channels = <2>;
counter-size = <24>;
@@ -63,6 +73,7 @@
interrupts = <17 0>;
clocks = <&gclk 27>, <&pm 0x20 10>;
clock-names = "GCLK", "PM";
status = "disabled";
channels = <2>;
counter-size = <16>;

View File

@@ -13,6 +13,20 @@
/ {
aliases {
adc-0 = &adc;
port-a = &porta;
port-b = &portb;
sercom-0 = &sercom0;
sercom-1 = &sercom1;
sercom-2 = &sercom2;
sercom-3 = &sercom3;
sercom-4 = &sercom4;
sercom-5 = &sercom5;
tc-4 = &tc4;
watchdog0 = &wdog;
};
@@ -25,9 +39,10 @@
#size-cells = <0>;
cpu0: cpu@0 {
device_type = "cpu";
compatible = "arm,cortex-m0+";
reg = <0>;
device_type = "cpu";
};
};
@@ -43,33 +58,20 @@
<0x0080A048 0x4>;
};
aliases {
port-a = &porta;
port-b = &portb;
adc-0 = &adc;
sercom-0 = &sercom0;
sercom-1 = &sercom1;
sercom-2 = &sercom2;
sercom-3 = &sercom3;
sercom-4 = &sercom4;
sercom-5 = &sercom5;
tc-4 = &tc4;
};
soc {
nvmctrl: nvmctrl@41004000 {
compatible = "atmel,sam0-nvmctrl";
reg = <0x41004000 0x22>;
interrupts = <5 0>;
lock-regions = <16>;
#address-cells = <1>;
#size-cells = <1>;
lock-regions = <16>;
flash0: flash@0 {
compatible = "soc-nv-flash";
write-block-size = <4>;
};
};
@@ -78,12 +80,14 @@
compatible = "atmel,samd2x-pm";
reg = <0x40000400 0x400>;
interrupts = <0 0>;
#clock-cells = <2>;
};
gclk: gclk@40000c00 {
compatible = "atmel,samd2x-gclk";
reg = <0x40000c00 0x400>;
#clock-cells = <1>;
};
@@ -148,29 +152,34 @@
tc4: tc@42003000 {
compatible = "atmel,sam0-tc32";
reg = <0x42003000 0x20>;
status = "disabled";
};
pinctrl: pinctrl@41004400 {
compatible = "atmel,sam0-pinctrl";
ranges = <0x41004400 0x41004400 0x100>;
#address-cells = <1>;
#size-cells = <1>;
ranges = <0x41004400 0x41004400 0x100>;
porta: gpio@41004400 {
compatible = "atmel,sam0-gpio";
reg = <0x41004400 0x80>;
gpio-controller;
#gpio-cells = <2>;
#atmel,pin-cells = <2>;
#atmel,pin-cells = <2>;
#gpio-cells = <2>;
gpio-controller;
};
portb: gpio@41004480 {
compatible = "atmel,sam0-gpio";
reg = <0x41004480 0x80>;
gpio-controller;
#gpio-cells = <2>;
#atmel,pin-cells = <2>;
#gpio-cells = <2>;
gpio-controller;
};
};
@@ -178,13 +187,17 @@
compatible = "atmel,sam0-rtc";
reg = <0x40001400 0x1C>;
interrupts = <3 0>;
clock-generator = <0>;
status = "disabled";
clock-generator = <0>;
};
adc: adc@42004000 {
compatible = "atmel,sam0-adc";
reg = <0x42004000 0x2B>;
status = "disabled";
#io-channel-cells = <1>;
/*
* 2.1 MHz max, so clock it with the
@@ -192,13 +205,13 @@
*/
gclk = <3>;
prescaler = <4>;
#io-channel-cells = <1>;
};
dac0: dac@42004800 {
compatible = "atmel,sam0-dac";
status = "disabled";
reg = <0x42004800 0x10>;
status = "disabled";
#io-channel-cells = <0>;
};
};

View File

@@ -11,28 +11,6 @@
#include <zephyr/dt-bindings/pwm/pwm.h>
/ {
chosen {
zephyr,flash-controller = &nvmctrl;
};
cpus {
#address-cells = <1>;
#size-cells = <0>;
cpu0: cpu@0 {
device_type = "cpu";
compatible = "arm,cortex-m4f";
reg = <0>;
#address-cells = <1>;
#size-cells = <1>;
mpu: mpu@e000ed90 {
compatible = "arm,armv7m-mpu";
reg = <0xe000ed90 0x40>;
};
};
};
aliases {
adc-0 = &adc0;
adc-1 = &adc1;
@@ -67,6 +45,27 @@
chosen {
zephyr,entropy = &trng;
zephyr,flash-controller = &nvmctrl;
};
cpus {
#address-cells = <1>;
#size-cells = <0>;
cpu0: cpu@0 {
compatible = "arm,cortex-m4f";
reg = <0>;
#address-cells = <1>;
#size-cells = <1>;
device_type = "cpu";
mpu: mpu@e000ed90 {
compatible = "arm,armv7m-mpu";
reg = <0xe000ed90 0x40>;
};
};
};
soc {
@@ -91,12 +90,14 @@
mclk: mclk@40000800 {
compatible = "atmel,samd5x-mclk";
reg = <0x40000800 0x400>;
#clock-cells = <2>;
};
gclk: gclk@40001c00 {
compatible = "atmel,samd5x-gclk";
reg = <0x40001c00 0x400>;
#clock-cells = <1>;
};
@@ -104,13 +105,15 @@
compatible = "atmel,sam0-nvmctrl";
reg = <0x41004000 0x22>;
interrupts = <29 0>, <30 0>;
lock-regions = <32>;
#address-cells = <1>;
#size-cells = <1>;
lock-regions = <32>;
flash0: flash@0 {
compatible = "soc-nv-flash";
write-block-size = <8>;
};
};
@@ -119,6 +122,8 @@
compatible = "atmel,sam0-dmac";
reg = <0x4100A000 0x50>;
interrupts = <31 0>, <32 0>, <33 0>, <34 0>, <35 0>;
status = "disabled";
#dma-cells = <2>;
};
@@ -161,118 +166,128 @@
compatible = "atmel,sam0-sercom";
reg = <0x40003000 0x40>;
interrupts = <46 0>, <47 0>, <48 0>, <49 0>;
status = "disabled";
clocks = <&gclk 7>, <&mclk 0x14 12>;
clock-names = "GCLK", "MCLK";
status = "disabled";
};
sercom1: sercom@40003400 {
compatible = "atmel,sam0-sercom";
reg = <0x40003400 0x40>;
interrupts = <50 0>, <51 0>, <52 0>, <53 0>;
status = "disabled";
clocks = <&gclk 8>, <&mclk 0x14 13>;
clock-names = "GCLK", "MCLK";
status = "disabled";
};
sercom2: sercom@41012000 {
compatible = "atmel,sam0-sercom";
reg = <0x41012000 0x40>;
interrupts = <54 0>, <55 0>, <56 0>, <57 0>;
status = "disabled";
clocks = <&gclk 23>, <&mclk 0x18 9>;
clock-names = "GCLK", "MCLK";
status = "disabled";
};
sercom3: sercom@41014000 {
compatible = "atmel,sam0-sercom";
reg = <0x41014000 0x40>;
interrupts = <58 0>, <59 0>, <60 0>, <61 0>;
status = "disabled";
clocks = <&gclk 24>, <&mclk 0x18 10>;
clock-names = "GCLK", "MCLK";
status = "disabled";
};
sercom4: sercom@43000000 {
compatible = "atmel,sam0-sercom";
reg = <0x43000000 0x40>;
interrupts = <62 0>, <63 0>, <64 0>, <65 0>;
status = "disabled";
clocks = <&gclk 34>, <&mclk 0x20 0>;
clock-names = "GCLK", "MCLK";
status = "disabled";
};
sercom5: sercom@43000400 {
compatible = "atmel,sam0-sercom";
reg = <0x43000400 0x40>;
interrupts = <66 0>, <67 0>, <68 0>, <69 0>;
status = "disabled";
clocks = <&gclk 35>, <&mclk 0x20 1>;
clock-names = "GCLK", "MCLK";
status = "disabled";
};
sercom6: sercom@43000800 {
compatible = "atmel,sam0-sercom";
reg = <0x43000800 0x40>;
interrupts = <70 0>, <71 0>, <72 0>, <73 0>;
status = "disabled";
clocks = <&gclk 36>, <&mclk 0x20 2>;
clock-names = "GCLK", "MCLK";
status = "disabled";
};
sercom7: sercom@43000c00 {
compatible = "atmel,sam0-sercom";
reg = <0x43000C00 0x40>;
interrupts = <74 0>, <75 0>, <76 0>, <77 0>;
status = "disabled";
clocks = <&gclk 37>, <&mclk 0x20 3>;
clock-names = "GCLK", "MCLK";
status = "disabled";
};
pinctrl: pinctrl@41008000 {
compatible = "atmel,sam0-pinctrl";
ranges = <0x41008000 0x41008000 0x200>;
#address-cells = <1>;
#size-cells = <1>;
ranges = <0x41008000 0x41008000 0x200>;
porta: gpio@41008000 {
compatible = "atmel,sam0-gpio";
reg = <0x41008000 0x80>;
gpio-controller;
#gpio-cells = <2>;
#atmel,pin-cells = <2>;
#gpio-cells = <2>;
gpio-controller;
};
portb: gpio@41008080 {
compatible = "atmel,sam0-gpio";
reg = <0x41008080 0x80>;
gpio-controller;
#gpio-cells = <2>;
#atmel,pin-cells = <2>;
#gpio-cells = <2>;
gpio-controller;
};
portc: gpio@41008100 {
compatible = "atmel,sam0-gpio";
reg = <0x41008100 0x80>;
gpio-controller;
#gpio-cells = <2>;
#atmel,pin-cells = <2>;
#gpio-cells = <2>;
gpio-controller;
};
portd: gpio@41008180 {
compatible = "atmel,sam0-gpio";
reg = <0x41008180 0x80>;
gpio-controller;
#gpio-cells = <2>;
#atmel,pin-cells = <2>;
#gpio-cells = <2>;
gpio-controller;
};
};
usb0: usb@41000000 {
compatible = "atmel,sam0-usb";
status = "disabled";
reg = <0x41000000 0x1000>;
interrupts = <80 0>, <81 0>, <82 0>, <83 0>;
status = "disabled";
num-bidir-endpoints = <8>;
};
@@ -286,8 +301,9 @@
compatible = "atmel,sam0-rtc";
reg = <0x40002400 0x1C>;
interrupts = <11 0>;
clock-generator = <0>;
status = "disabled";
clock-generator = <0>;
};
adc0: adc@43001c00 {
@@ -295,6 +311,11 @@
reg = <0x43001C00 0x4A>;
interrupts = <118 0>, <119 0>;
interrupt-names = "overrun", "resrdy";
clocks = <&gclk 40>, <&mclk 0x20 7>;
clock-names = "GCLK", "MCLK";
status = "disabled";
#io-channel-cells = <1>;
/*
* 16 MHz max, source clock must not exceed 100 MHz.
@@ -304,9 +325,6 @@
*/
gclk = <2>;
prescaler = <4>;
#io-channel-cells = <1>;
clocks = <&gclk 40>, <&mclk 0x20 7>;
clock-names = "GCLK", "MCLK";
calib-offset = <0>;
};
@@ -315,6 +333,11 @@
reg = <0x43002000 0x4A>;
interrupts = <120 0>, <121 0>;
interrupt-names = "overrun", "resrdy";
clocks = <&gclk 41>, <&mclk 0x20 8>;
clock-names = "GCLK", "MCLK";
status = "disabled";
#io-channel-cells = <1>;
/*
* 16 MHz max, source clock must not exceed 100 MHz.
@@ -324,9 +347,6 @@
*/
gclk = <2>;
prescaler = <4>;
#io-channel-cells = <1>;
clocks = <&gclk 41>, <&mclk 0x20 8>;
clock-names = "GCLK", "MCLK";
calib-offset = <14>;
};
@@ -336,6 +356,7 @@
interrupts = <107 0>;
clocks = <&gclk 9>, <&mclk 0x14 14>;
clock-names = "GCLK", "MCLK";
status = "disabled";
};
tc2: tc@4101a000 {
@@ -344,6 +365,7 @@
interrupts = <109 0>;
clocks = <&gclk 26>, <&mclk 0x18 13>;
clock-names = "GCLK", "MCLK";
status = "disabled";
};
tc4: tc@42001400 {
@@ -352,6 +374,7 @@
interrupts = <111 0>;
clocks = <&gclk 30>, <&mclk 0x1c 5>;
clock-names = "GCLK", "MCLK";
status = "disabled";
};
tc6: tc@43001400 {
@@ -360,6 +383,7 @@
interrupts = <113 0>;
clocks = <&gclk 39>, <&mclk 0x20 5>;
clock-names = "GCLK", "MCLK";
status = "disabled";
};
tcc0: tcc@41016000 {
@@ -369,6 +393,8 @@
<90 0>, <91 0>;
clocks = <&gclk 25>, <&mclk 0x18 11>;
clock-names = "GCLK", "MCLK";
status = "disabled";
channels = <6>;
counter-size = <24>;
};
@@ -379,6 +405,8 @@
interrupts = <92 0>, <93 0>, <94 0>, <95 0>, <96 0>;
clocks = <&gclk 25>, <&mclk 0x18 12>;
clock-names = "GCLK", "MCLK";
status = "disabled";
channels = <4>;
counter-size = <24>;
};
@@ -389,6 +417,8 @@
interrupts = <97 0>, <98 0>, <99 0>, <100 0>;
clocks = <&gclk 29>, <&mclk 0x1c 3>;
clock-names = "GCLK", "MCLK";
status = "disabled";
channels = <3>;
counter-size = <16>;
};
@@ -399,6 +429,8 @@
interrupts = <101 0>, <102 0>, <103 0>;
clocks = <&gclk 29>, <&mclk 0x1c 4>;
clock-names = "GCLK", "MCLK";
status = "disabled";
channels = <2>;
counter-size = <16>;
};
@@ -409,6 +441,8 @@
interrupts = <104 0>, <105 0>, <106 0>;
clocks = <&gclk 38>, <&mclk 0x20 4>;
clock-names = "GCLK", "MCLK";
status = "disabled";
channels = <2>;
counter-size = <16>;
};

View File

@@ -14,15 +14,17 @@
reg = <0x42000800 0x400>;
interrupts = <84 0>;
interrupt-names = "gmac";
status = "disabled";
num-queues = <1>;
local-mac-address = [00 00 00 00 00 00];
status = "disabled";
};
mdio: mdio@42000800 {
compatible = "atmel,sam-mdio";
reg = <0x42000800 0x400>;
status = "disabled";
#address-cells = <1>;
#size-cells = <0>;
};
@@ -34,9 +36,10 @@
interrupt-names = "int0", "int1";
clocks = <&gclk 27>, <&mclk 0x10 17>;
clock-names = "GCLK", "MCLK";
status = "disabled";
bosch,mram-cfg = <0x0 128 64 64 64 64 32 32>;
divider = <12>;
status = "disabled";
};
can1: can@42000400 {
@@ -46,9 +49,10 @@
interrupt-names = "int0", "int1";
clocks = <&gclk 28>, <&mclk 0x10 18>;
clock-names = "GCLK", "MCLK";
status = "disabled";
bosch,mram-cfg = <0x0 128 64 64 64 64 32 32>;
divider = <12>;
status = "disabled";
};
};
};

View File

@@ -1,5 +1,6 @@
/*
* Copyright (c) 2021 Argentum Systems Ltd.
* Copyright (c) 2024 Gerson Fernando Budke <nandojve@gmail.com>
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -7,28 +8,20 @@
#include <atmel/saml2x.dtsi>
/ {
aliases {
tcc-0 = &tcc0;
tcc-1 = &tcc1;
tcc-2 = &tcc2;
};
soc {
usb0: usb@41000000 {
compatible = "atmel,sam0-usb";
status = "disabled";
reg = <0x41000000 0x1000>;
interrupts = <6 0>;
num-bidir-endpoints = <8>;
};
dmac: dmac@44000400 {
compatible = "atmel,sam0-dmac";
reg = <0x44000400 0x50>;
interrupts = <5 0>;
#dma-cells = <2>;
};
tcc0: tcc@42001400 {
compatible = "atmel,sam0-tcc";
reg = <0x42001400 0x80>;
interrupts = <14 0>;
clocks = <&gclk 25>, <&mclk 0x1c 5>;
clock-names = "GCLK", "MCLK";
status = "disabled";
channels = <4>;
counter-size = <24>;
@@ -40,6 +33,7 @@
interrupts = <15 0>;
clocks = <&gclk 25>, <&mclk 0x1c 6>;
clock-names = "GCLK", "MCLK";
status = "disabled";
channels = <4>;
counter-size = <24>;
@@ -51,6 +45,7 @@
interrupts = <16 0>;
clocks = <&gclk 26>, <&mclk 0x1c 7>;
clock-names = "GCLK", "MCLK";
status = "disabled";
channels = <2>;
counter-size = <16>;

View File

@@ -1,5 +1,6 @@
/*
* Copyright (c) 2021 Argentum Systems Ltd.
* Copyright (c) 2024 Gerson Fernando Budke <nandojve@gmail.com>
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -13,6 +14,20 @@
/ {
aliases {
adc-0 = &adc;
port-a = &porta;
port-b = &portb;
sercom-0 = &sercom0;
sercom-1 = &sercom1;
sercom-2 = &sercom2;
sercom-3 = &sercom3;
sercom-4 = &sercom4;
sercom-5 = &sercom5;
tc-4 = &tc4;
watchdog0 = &wdog;
};
@@ -26,9 +41,10 @@
#size-cells = <0>;
cpu0: cpu@0 {
device_type = "cpu";
compatible = "arm,cortex-m0+";
reg = <0>;
device_type = "cpu";
};
};
@@ -50,14 +66,16 @@
compatible = "atmel,sam0-nvmctrl";
reg = <0x41004000 0x22>;
interrupts = <4 0>;
lock-regions = <16>;
#address-cells = <1>;
#size-cells = <1>;
lock-regions = <16>;
flash0: flash@0 {
compatible = "soc-nv-flash";
reg = <0 0x40000>;
write-block-size = <4>;
};
};
@@ -66,18 +84,21 @@
compatible = "atmel,saml2x-pm";
reg = <0x40000400 0x400>;
interrupts = <0 0>;
#clock-cells = <2>;
};
mclk: mclk@40000400 {
compatible = "atmel,saml2x-mclk";
reg = <0x40000400 0x400>;
#clock-cells = <2>;
};
gclk: gclk@40001800 {
compatible = "atmel,saml2x-gclk";
reg = <0x40001800 0x400>;
#clock-cells = <1>;
};
@@ -85,6 +106,8 @@
compatible = "atmel,sam0-dmac";
reg = <0x44000400 0x400>;
interrupts = <5 0>;
status = "disabled";
#dma-cells = <2>;
};
@@ -139,29 +162,34 @@
tc4: tc@43000800 {
compatible = "atmel,sam0-tc32";
reg = <0x43000800 0x34>;
status = "disabled";
};
pinctrl: pinctrl@40002800 {
compatible = "atmel,sam0-pinctrl";
ranges = <0x40002800 0x40002800 0x100>;
#address-cells = <1>;
#size-cells = <1>;
ranges = <0x40002800 0x40002800 0x100>;
porta: gpio@40002800 {
compatible = "atmel,sam0-gpio";
reg = <0x40002800 0x80>;
gpio-controller;
#gpio-cells = <2>;
#atmel,pin-cells = <2>;
#atmel,pin-cells = <2>;
#gpio-cells = <2>;
gpio-controller;
};
portb: gpio@40002880 {
compatible = "atmel,sam0-gpio";
reg = <0x40002880 0x80>;
gpio-controller;
#gpio-cells = <2>;
#atmel,pin-cells = <2>;
#gpio-cells = <2>;
gpio-controller;
};
};
@@ -169,13 +197,17 @@
compatible = "atmel,sam0-rtc";
reg = <0x40002000 0x1c>;
interrupts = <2 0>;
clock-generator = <0>;
status = "disabled";
clock-generator = <0>;
};
adc: adc@43000c00 {
compatible = "atmel,sam0-adc";
reg = <0x43000c00 0x30>;
status = "disabled";
#io-channel-cells = <1>;
/*
* 16 MHz max, so clock it with the
@@ -183,13 +215,13 @@
*/
gclk = <3>;
prescaler = <2>;
#io-channel-cells = <1>;
};
dac: dac@42003000 {
compatible = "atmel,sam0-dac";
status = "disabled";
reg = <0x42003000 0x1a>;
status = "disabled";
#io-channel-cells = <0>;
};
@@ -198,6 +230,15 @@
reg = <0x42003800 0x24>;
interrupts = <27 0>;
};
usb0: usb@41000000 {
compatible = "atmel,sam0-usb";
reg = <0x41000000 0x1000>;
interrupts = <6 0>;
status = "disabled";
num-bidir-endpoints = <8>;
};
};
};

View File

@@ -1,10 +1,11 @@
/*
* Copyright (c) 2019 Benjamin Valentin
* Copyright (c) 2024 Gerson Fernando Budke <nandojve@gmail.com>
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <atmel/samd2x.dtsi>
#include <atmel/samd21.dtsi>
/ {
aliases {
@@ -12,30 +13,17 @@
};
soc {
usb0: usb@41005000 {
compatible = "atmel,sam0-usb";
status = "disabled";
reg = <0x41005000 0x1000>;
interrupts = <7 0>;
num-bidir-endpoints = <8>;
};
dmac: dmac@41004800 {
compatible = "atmel,sam0-dmac";
reg = <0x41004800 0x50>;
interrupts = <6 0>;
#dma-cells = <2>;
};
pinctrl: pinctrl@41004400 {
ranges = <0x41004400 0x41004400 0x180>;
portc: gpio@41004500 {
compatible = "atmel,sam0-gpio";
reg = <0x41004500 0x80>;
gpio-controller;
#gpio-cells = <2>;
#atmel,pin-cells = <2>;
#gpio-cells = <2>;
gpio-controller;
};
};
@@ -43,87 +31,5 @@
compatible = "atmel,sam0-pinmux";
reg = <0x41004500 0x80>;
};
tcc0: tcc@42002000 {
compatible = "atmel,sam0-tcc";
reg = <0x42002000 0x80>;
interrupts = <15 0>;
clocks = <&gclk 26>, <&pm 0x20 8>;
clock-names = "GCLK", "PM";
channels = <4>;
counter-size = <24>;
};
tcc1: tcc@42002400 {
compatible = "atmel,sam0-tcc";
reg = <0x42002400 0x80>;
interrupts = <16 0>;
clocks = <&gclk 26>, <&pm 0x20 9>;
clock-names = "GCLK", "PM";
channels = <2>;
counter-size = <24>;
};
tcc2: tcc@42002800 {
compatible = "atmel,sam0-tcc";
reg = <0x42002800 0x80>;
interrupts = <17 0>;
clocks = <&gclk 27>, <&pm 0x20 10>;
clock-names = "GCLK", "PM";
channels = <2>;
counter-size = <16>;
};
};
};
&sercom0 {
interrupts = <9 0>;
clocks = <&gclk 0x14>, <&pm 0x20 2>;
clock-names = "GCLK", "PM";
};
&sercom1 {
interrupts = <10 0>;
clocks = <&gclk 0x15>, <&pm 0x20 3>;
clock-names = "GCLK", "PM";
};
&sercom2 {
interrupts = <11 0>;
clocks = <&gclk 0x16>, <&pm 0x20 4>;
clock-names = "GCLK", "PM";
};
&sercom3 {
interrupts = <12 0>;
clocks = <&gclk 0x17>, <&pm 0x20 5>;
clock-names = "GCLK", "PM";
};
&sercom4 {
interrupts = <13 0>;
clocks = <&gclk 0x18>, <&pm 0x20 6>;
clock-names = "GCLK", "PM";
};
&sercom5 {
interrupts = <14 0>;
clocks = <&gclk 0x19>, <&pm 0x20 7>;
clock-names = "GCLK", "PM";
};
&tc4 {
interrupts = <19 0>;
clocks = <&gclk 0x1c>, <&pm 0x20 12>;
clock-names = "GCLK", "PM";
};
&adc {
clocks = <&gclk 0x1e>, <&pm 0x20 16>;
clock-names = "GCLK", "PM";
interrupts = <23 0>;
interrupt-names = "resrdy";
};

View File

@@ -13,6 +13,8 @@
/ {
aliases {
port-c = &portc;
lora0 = &lora;
};
@@ -23,9 +25,10 @@
portc: gpio@40002900 {
compatible = "atmel,sam0-gpio";
reg = <0x40002900 0x80>;
gpio-controller;
#gpio-cells = <2>;
#atmel,pin-cells = <2>;
#gpio-cells = <2>;
gpio-controller;
};
};
};
@@ -37,19 +40,22 @@
/* SERCOM4 is used to interface with the internal LoRa radio */
compatible = "atmel,sam0-spi";
status = "disabled";
#address-cells = <1>;
#size-cells = <0>;
dipo = <0>;
dopo = <1>;
cs-gpios = <&portb 31 GPIO_ACTIVE_LOW>;
#address-cells = <1>;
#size-cells = <0>;
pinctrl-0 = <&sercom4_default>;
pinctrl-names = "default";
lora: sx1276@0 {
compatible = "semtech,sx1276";
status = "disabled";
reg = <0>;
status = "disabled";
reset-gpios = <&portb 15 GPIO_ACTIVE_LOW>; /* nRST */
dio-gpios =
<&portb 16 (GPIO_PULL_DOWN | GPIO_ACTIVE_HIGH)>, /* DIO0 */

View File

@@ -49,7 +49,7 @@
interrupts = <63 0>, <64 0>, <65 0>, <66 0>;
interrupt-names = "TX", "RX0", "RX1", "SCE";
/* also enabling clock for can1 (master instance) */
clocks = <&rcc STM32_CLOCK(APB1, 26U)>;
clocks = <&rcc STM32_CLOCK_BUS_APB1 0x06000000>;
status = "disabled";
};

View File

@@ -220,7 +220,7 @@
interrupts = <63 0>, <64 0>, <65 0>, <66 0>;
interrupt-names = "TX", "RX0", "RX1", "SCE";
/* also enabling clock for can1 (master instance) */
clocks = <&rcc STM32_CLOCK(APB1, 26U)>;
clocks = <&rcc STM32_CLOCK_BUS_APB1 0x06000000>;
master-can-reg = <0x40006400>;
status = "disabled";
};

View File

@@ -230,7 +230,7 @@
interrupts = <63 0>, <64 0>, <65 0>, <66 0>;
interrupt-names = "TX", "RX0", "RX1", "SCE";
/* also enabling clock for can1 (master instance) */
clocks = <&rcc STM32_CLOCK(APB1, 26U)>;
clocks = <&rcc STM32_CLOCK_BUS_APB1 0x06000000>;
master-can-reg = <0x40006400>;
status = "disabled";
};

View File

@@ -73,7 +73,7 @@
interrupts = <63 0>, <64 0>, <65 0>, <66 0>;
interrupt-names = "TX", "RX0", "RX1", "SCE";
/* also enabling clock for can1 (master instance) */
clocks = <&rcc STM32_CLOCK(APB1, 26U)>;
clocks = <&rcc STM32_CLOCK_BUS_APB1 0x06000000>;
master-can-reg = <0x40006400>;
status = "disabled";
};

View File

@@ -88,7 +88,7 @@
interrupts = <88 0>, <89 0>;
interrupt-names = "ltdc", "ltdc_er";
clocks = <&rcc STM32_CLOCK(APB3, 3U)>;
resets = <&rctl STM32_RESET(APB3, 4U)>;
resets = <&rctl STM32_RESET(APB3, 3U)>;
status = "disabled";
};

View File

@@ -49,7 +49,7 @@
interrupts = <88 0>, <89 0>;
interrupt-names = "ltdc", "ltdc_er";
clocks = <&rcc STM32_CLOCK(APB3, 3U)>;
resets = <&rctl STM32_RESET(APB3, 4U)>;
resets = <&rctl STM32_RESET(APB3, 3U)>;
status = "disabled";
};

View File

@@ -42,7 +42,7 @@
interrupts = <88 0>, <89 0>;
interrupt-names = "ltdc", "ltdc_er";
clocks = <&rcc STM32_CLOCK(APB3, 3U)>;
resets = <&rctl STM32_RESET(APB3, 4U)>;
resets = <&rctl STM32_RESET(APB3, 3U)>;
status = "disabled";
};

View File

@@ -52,7 +52,7 @@
interrupts = <88 0>, <89 0>;
interrupt-names = "ltdc", "ltdc_er";
clocks = <&rcc STM32_CLOCK(APB3, 3U)>;
resets = <&rctl STM32_RESET(APB3, 4U)>;
resets = <&rctl STM32_RESET(APB3, 3U)>;
status = "disabled";
};

View File

@@ -304,7 +304,7 @@
compatible = "zephyr,memory-region", "st,stm32-backup-sram";
reg = <0x40036400 DT_SIZE_K(2)>;
/* BKPSRAMEN and RAMCFGEN clock enable */
clocks = <&rcc STM32_CLOCK(AHB1, 28U)>;
clocks = <&rcc STM32_CLOCK_BUS_AHB1 ((1 << 28) | (1 << 17))>;
zephyr,memory-region = "BACKUP_SRAM";
status = "disabled";
};

View File

@@ -106,7 +106,8 @@
num-bidir-endpoints = <9>;
ram-size = <4096>;
maximum-speed = "high-speed";
clocks = <&rcc STM32_CLOCK(AHB2, 15U)>,
/* Enable OTG_HS PHY and peripheral clocks (OTGHSPHYEN | OTGEN) */
clocks = <&rcc STM32_CLOCK_BUS_AHB2 ((1 << 15) | (1 << 14))>,
<&rcc STM32_SRC_HSI48 ICKLK_SEL(0)>;
phys = <&otghs_phy>;
status = "disabled";

View File

@@ -0,0 +1,54 @@
/*
* Copyright (c) 2024 Espressif Systems (Shanghai) Co., Ltd.
*
* SPDX-License-Identifier: Apache-2.0
*/
/* 16MB flash partition table */
&flash0 {
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
boot_partition: partition@0 {
label = "mcuboot";
reg = <0x0 DT_SIZE_K(64)>;
};
slot0_partition: partition@20000 {
label = "image-0";
reg = <0x20000 DT_SIZE_K(6080)>;
};
slot0_appcpu_partition: partition@610000 {
label = "image-0-appcpu";
reg = <0x610000 DT_SIZE_K(1920)>;
};
slot1_partition: partition@7F0000 {
label = "image-1";
reg = <0x7F0000 DT_SIZE_K(6080)>;
};
slot1_appcpu_partition: partition@DE0000 {
label = "image-1-appcpu";
reg = <0xDE0000 DT_SIZE_K(1920)>;
};
storage_partition: partition@FC0000 {
label = "storage";
reg = <0xFC0000 DT_SIZE_K(128)>;
};
scratch_partition: partition@FE0000 {
label = "image-scratch";
reg = <0xFE0000 DT_SIZE_K(64)>;
};
coredump_partition: partition@FF0000 {
label = "coredump-partition";
reg = <0xFF0000 DT_SIZE_K(4)>;
};
};
};

View File

@@ -0,0 +1,54 @@
/*
* Copyright (c) 2024 Espressif Systems (Shanghai) Co., Ltd.
*
* SPDX-License-Identifier: Apache-2.0
*/
/* 32MB flash partition table */
&flash0 {
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
boot_partition: partition@0 {
label = "mcuboot";
reg = <0x0 DT_SIZE_K(64)>;
};
slot0_partition: partition@20000 {
label = "image-0";
reg = <0x20000 DT_SIZE_K(12352)>;
};
slot0_appcpu_partition: partition@C30000 {
label = "image-0-appcpu";
reg = <0xC30000 DT_SIZE_K(3840)>;
};
slot1_partition: partition@FF0000 {
label = "image-1";
reg = <0xFF0000 DT_SIZE_K(12352)>;
};
slot1_appcpu_partition: partition@1C00000 {
label = "image-1-appcpu";
reg = <0x1C00000 DT_SIZE_K(3840)>;
};
storage_partition: partition@1FC0000 {
label = "storage";
reg = <0x1FC0000 DT_SIZE_K(128)>;
};
scratch_partition: partition@1FE0000 {
label = "image-scratch";
reg = <0x1FE0000 DT_SIZE_K(64)>;
};
coredump_partition: partition@1FF0000 {
label = "coredump-partition";
reg = <0x1FF0000 DT_SIZE_K(4)>;
};
};
};

View File

@@ -0,0 +1,44 @@
/*
* Copyright (c) 2024 Espressif Systems (Shanghai) Co., Ltd.
*
* SPDX-License-Identifier: Apache-2.0
*/
/* 16MB flash partition table */
&flash0 {
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
boot_partition: partition@0 {
label = "mcuboot";
reg = <0x0 DT_SIZE_K(64)>;
};
slot0_partition: partition@20000 {
label = "image-0";
reg = <0x20000 DT_SIZE_K(8000)>;
};
slot1_partition: partition@7F0000 {
label = "image-1";
reg = <0x7F0000 DT_SIZE_K(8000)>;
};
storage_partition: partition@FC0000 {
label = "storage";
reg = <0xFC0000 DT_SIZE_K(128)>;
};
scratch_partition: partition@FE0000 {
label = "image-scratch";
reg = <0xFE0000 DT_SIZE_K(64)>;
};
coredump_partition: partition@FF0000 {
label = "coredump-partition";
reg = <0xFF0000 DT_SIZE_K(4)>;
};
};
};

View File

@@ -0,0 +1,44 @@
/*
* Copyright (c) 2024 Espressif Systems (Shanghai) Co., Ltd.
*
* SPDX-License-Identifier: Apache-2.0
*/
/* 32MB flash partition table */
&flash0 {
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
boot_partition: partition@0 {
label = "mcuboot";
reg = <0x0 DT_SIZE_K(64)>;
};
slot0_partition: partition@20000 {
label = "image-0";
reg = <0x20000 DT_SIZE_K(16192)>;
};
slot1_partition: partition@FF0000 {
label = "image-1";
reg = <0xFF0000 DT_SIZE_K(16192)>;
};
storage_partition: partition@1FC0000 {
label = "storage";
reg = <0x1FC0000 DT_SIZE_K(128)>;
};
scratch_partition: partition@1FE0000 {
label = "image-scratch";
reg = <0x1FE0000 DT_SIZE_K(64)>;
};
coredump_partition: partition@1FF0000 {
label = "coredump-partition";
reg = <0x1FF0000 DT_SIZE_K(4)>;
};
};
};

View File

@@ -0,0 +1,54 @@
/*
* Copyright (c) 2024 Espressif Systems (Shanghai) Co., Ltd.
*
* SPDX-License-Identifier: Apache-2.0
*/
/* 16MB flash partition table */
&flash0 {
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
boot_partition: partition@1000 {
label = "mcuboot";
reg = <0x1000 DT_SIZE_K(60)>;
};
slot0_partition: partition@20000 {
label = "image-0";
reg = <0x20000 DT_SIZE_K(6080)>;
};
slot0_appcpu_partition: partition@610000 {
label = "image-0-appcpu";
reg = <0x610000 DT_SIZE_K(1920)>;
};
slot1_partition: partition@7F0000 {
label = "image-1";
reg = <0x7F0000 DT_SIZE_K(6080)>;
};
slot1_appcpu_partition: partition@DE0000 {
label = "image-1-appcpu";
reg = <0xDE0000 DT_SIZE_K(1920)>;
};
storage_partition: partition@FC0000 {
label = "storage";
reg = <0xFC0000 DT_SIZE_K(128)>;
};
scratch_partition: partition@FE0000 {
label = "image-scratch";
reg = <0xFE0000 DT_SIZE_K(64)>;
};
coredump_partition: partition@FF0000 {
label = "coredump-partition";
reg = <0xFF0000 DT_SIZE_K(4)>;
};
};
};

View File

@@ -0,0 +1,54 @@
/*
* Copyright (c) 2024 Espressif Systems (Shanghai) Co., Ltd.
*
* SPDX-License-Identifier: Apache-2.0
*/
/* 32MB flash partition table */
&flash0 {
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
boot_partition: partition@1000 {
label = "mcuboot";
reg = <0x1000 DT_SIZE_K(60)>;
};
slot0_partition: partition@20000 {
label = "image-0";
reg = <0x20000 DT_SIZE_K(12352)>;
};
slot0_appcpu_partition: partition@C30000 {
label = "image-0-appcpu";
reg = <0xC24000 DT_SIZE_K(3840)>;
};
slot1_partition: partition@FF0000 {
label = "image-1";
reg = <0xFF0000 DT_SIZE_K(12352)>;
};
slot1_appcpu_partition: partition@1C00000 {
label = "image-1-appcpu";
reg = <0x1C00000 DT_SIZE_K(3840)>;
};
storage_partition: partition@1FC0000 {
label = "storage";
reg = <0x1FC0000 DT_SIZE_K(128)>;
};
scratch_partition: partition@1FE0000 {
label = "image-scratch";
reg = <0x1FE0000 DT_SIZE_K(64)>;
};
coredump_partition: partition@1FF0000 {
label = "coredump-partition";
reg = <0x1FF0000 DT_SIZE_K(4)>;
};
};
};

View File

@@ -0,0 +1,44 @@
/*
* Copyright (c) 2024 Espressif Systems (Shanghai) Co., Ltd.
*
* SPDX-License-Identifier: Apache-2.0
*/
/* 16MB flash partition table */
&flash0 {
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
boot_partition: partition@1000 {
label = "mcuboot";
reg = <0x1000 DT_SIZE_K(60)>;
};
slot0_partition: partition@20000 {
label = "image-0";
reg = <0x20000 DT_SIZE_K(8000)>;
};
slot1_partition: partition@7F0000 {
label = "image-1";
reg = <0x7F0000 DT_SIZE_K(8000)>;
};
storage_partition: partition@FC0000 {
label = "storage";
reg = <0xFC0000 DT_SIZE_K(128)>;
};
scratch_partition: partition@FE0000 {
label = "image-scratch";
reg = <0xFE0000 DT_SIZE_K(64)>;
};
coredump_partition: partition@FF0000 {
label = "coredump-partition";
reg = <0xFF0000 DT_SIZE_K(4)>;
};
};
};

View File

@@ -0,0 +1,44 @@
/*
* Copyright (c) 2024 Espressif Systems (Shanghai) Co., Ltd.
*
* SPDX-License-Identifier: Apache-2.0
*/
/* 32MB flash partition table */
&flash0 {
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
boot_partition: partition@1000 {
label = "mcuboot";
reg = <0x1000 DT_SIZE_K(60)>;
};
slot0_partition: partition@20000 {
label = "image-0";
reg = <0x20000 DT_SIZE_K(16192)>;
};
slot1_partition: partition@FF0000 {
label = "image-1";
reg = <0xFF0000 DT_SIZE_K(16192)>;
};
storage_partition: partition@1FC0000 {
label = "storage";
reg = <0x1FC0000 DT_SIZE_K(128)>;
};
scratch_partition: partition@1FE0000 {
label = "image-scratch";
reg = <0x1FE0000 DT_SIZE_K(64)>;
};
coredump_partition: partition@1FF0000 {
label = "coredump-partition";
reg = <0x1FF0000 DT_SIZE_K(4)>;
};
};
};

View File

@@ -7,6 +7,8 @@
#ifndef ZEPHYR_INCLUDE_ZEPHYR_ARCH_RISCV_REG_H_
#define ZEPHYR_INCLUDE_ZEPHYR_ARCH_RISCV_REG_H_
#include <zephyr/sys/util.h>
#define reg_read(reg) \
({ \
register unsigned long __rv; \

View File

@@ -16,7 +16,6 @@
*/
#include <stdint.h>
#include <zephyr/posix/time.h>
#ifdef __cplusplus
extern "C" {

Some files were not shown because too many files have changed in this diff Show More