Commit Graph

71516 Commits

Author SHA1 Message Date
Carles Cufi 8e4d499fa0 treewide: Use CONFIG_*_ENDIAN instead of __BYTE_ORDER__
In order to avoid using multiple sources of truth for the platfom's
endianness, convert the in-tree code to use the (BIG|LITTLE)_ENDIAN
Kconfig variables exclusively, instead of the compiler's
__BYTE_ORDER__.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2022-10-28 19:23:46 +09:00
Carles Cufi f38c283c42 modules: littlefs: Fix the endianness conversion functions
See full description in the upstream PR:
https://github.com/littlefs-project/littlefs/pull/742

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2022-10-28 19:23:46 +09:00
Carles Cufi ae123c9bd1 toolchain: Ensure that Kconfig endianness matches the compiler's
In preparation for using CONFIG_(BIG|LITTLE)_ENDIAN exclusively for
endianness-based conditional compilation in the tree, ensure that the
Kconfig CONFIG_(BIG|LITTLE)_ENDIAN options match the compiler's
__BYTE_ORDER__ macro.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2022-10-28 19:23:46 +09:00
Carles Cufi ab05448307 arch: Add a CONFIG_LITTLE_ENDIAN hidden Kconfig option
In preparation for using CONFIG_*_ENDIAN instead of __BYTE_ORDER__, add
a reflection of CONFIG_BIG_ENDIAN that will allow users to conditionally
compile with #ifdef instead of #ifndef while keeping the default case
(little endian) as the first block in the conditional compilation.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2022-10-28 19:23:46 +09:00
Jordan Yates c3eeae80ec debug: thread_info: store arch mode_exc_return offset
Store the offset of mode_exc_return in the arch struct. This is required
to restore the link register to the original value, as `swap_helper.S`
saves the LSB to this field when `CONFIG_ARM_STORE_EXC_RETURN=y`.

Failing to account for this results in broken debugging when
`FPU_SHARING` or `ARM_NONSECURE_PREEMPTIBLE_SECURE_CALLS`.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-10-28 11:51:15 +02:00
Ayan Kumar Halder 2174501a10 Arm: GICv3: Enable reading GICR_TYPER via two sys_read32() on AArch32
GICR_TYPER is a 64 bit register. On AArch32 when one uses sys_read64(),
this results in ldrd instruction. When Zephyr runs as a VM, 'LDRD'
instruction on an emulated MMIO region gets trapped to the hypervisor as
data abort.

Refer the following paragraph from ARM DDI 0487G.b ID072021 :-

Section - "ISS encoding for an exception from a Data Abort",
"For other faults reported in ESR_EL2, ISV is 0 except for the following
stage 2 aborts:

AArch32 instructions where the instruction:
— Is an LDR, LDA, LDRT, LDRSH, LDRSHT, LDRH, LDAH, LDRHT, LDRSB, LDRSBT,
LDRB, LDAB, LDRBT, STR, STL, STRT, STRH, STLH, STRHT, STRB, STLB, or STRBT
instruction."

As 'LDRD' is not in the list, so ISV==0. This implies that Arm could not
decode the instruction for the hypervisor (in EL2) to execute it.

Thus, we have abstracted this read into arm_gic_get_typer().
For AArch64, we use sys_read64() as before.
For AArch32, we use sys_read32() twice to read the lower and upper 32 bits
of GICR_TYPER.

Thus, we ensure that when the access is trapped for AArch32, Arm generates
a valid ISS so that hypervisor can execute it.

Signed-off-by: Ayan Kumar Halder <ayankuma@amd.com>
2022-10-28 10:36:36 +02:00
Emil Gydesen 460ac477c1 tests: Bluetooth: Update broadcast_iso test to support PA sync term cb
The callback is now called whenever the PA sync is terminated,
even if it was locally terminated. The test case has been
updated to handle that.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-10-28 07:56:41 +00:00
Emil Gydesen affd8da9a0 Bluetooth: Host: Fix wrong addr for PA term when using adv list
If using the advertiser list when syncing to a PA, then the
address address needs to be updated for the PA sync object.
This is a small optimization to avoid doing a copy when
the address and SID is already set.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-10-28 07:56:41 +00:00
Emil Gydesen cba4b1828d Bluetooth: Host: Fix missing term callback for PA syncs
When deleting a PA sync with bt_le_per_adv_sync_delete
Zephyr should call the `term` callback for the PA sync
as per the documentation for the callback.

This was not done in the case that the PA sync was
terminated by local request.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-10-28 07:56:41 +00:00
Martin Tverdal 0cf6cac77e Bluetooth: extended adv reports with legacy content discardable
To avoid legacy extended adv repots blocking important
events or work, mark them as discaradble.

Signed-off-by: Martin Tverdal <martin.tverdal@nordicsemi.no>
2022-10-28 07:55:44 +00:00
Tim Lin fc45aed16d ITE: drivers/i2c: Print the error messages when I2C transfers fail
Print the error messages about the state of the host register
when the I2C transfers fail. This is useful for debugging.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2022-10-28 07:55:31 +00:00
Damian Nikodem bedc2e7ab4 drivers: dmic: remove soft_reset from dmic init flow
DMIC does not need to use SOFT_RESET bit to start collecting data if
periodic_start bit is enabled.

Signed-off-by: Damian Nikodem <damian.nikodem@intel.com>
2022-10-28 09:51:35 +02:00
Damian Nikodem 39c2007b04 drivers: dmic: update dmic flow initialization
DMIC configuration should allow the use of periodic start.

Signed-off-by: Damian Nikodem <damian.nikodem@intel.com>
2022-10-28 09:51:35 +02:00
Kumar Gala cea495fb45 tests: arch: common: timing: Convert CONFIG_MP_NUM_CPUS handling
Move runtime checks to use arch_num_cpus() and build checks
to use CONFIG_MP_MAX_NUM_CPUS.  This is to allow runtime
determination of the number of CPUs in the future.

Signed-off-by: Kumar Gala <kumar.gala@intel.com>
2022-10-27 14:43:55 -04:00
Kumar Gala 8eb0cdfcfb ztest: Convert CONFIG_MP_NUM_CPUS handling
For test_1cpu_start/test_1cpu_stop make the code only build if
CONFIG_SMP and move to using arch_num_cpus() for runtime loops
and CONFIG_MP_MAX_NUM_CPUS for array decleration.

Signed-off-by: Kumar Gala <kumar.gala@intel.com>
2022-10-27 14:02:05 -04:00
Kumar Gala 7fff3de993 samples: synchronization: Convert CONFIG_MP_NUM_CPUS handling
Move runtime checks to use arch_num_cpus() and build checks
to use CONFIG_MP_MAX_NUM_CPUS.  This is to allow runtime
determination of the number of CPUs in the future.

Signed-off-by: Kumar Gala <kumar.gala@intel.com>
2022-10-27 13:59:57 -04:00
Kumar Gala 6aa67666c4 samples: smp: pktqueue: Convert CONFIG_MP_NUM_CPUS handling
Move runtime checks to use arch_num_cpus() and build checks
to use CONFIG_MP_MAX_NUM_CPUS.  This is to allow runtime
determination of the number of CPUs in the future.

Signed-off-by: Kumar Gala <kumar.gala@intel.com>
2022-10-27 13:59:57 -04:00
Kumar Gala 9092b83d03 samples: smp: pi: Convert CONFIG_MP_NUM_CPUS handling
Move runtime checks to use arch_num_cpus() and build checks
to use CONFIG_MP_MAX_NUM_CPUS.  This is to allow runtime
determination of the number of CPUs in the future.

Signed-off-by: Kumar Gala <kumar.gala@intel.com>
2022-10-27 13:59:57 -04:00
Kumar Gala dd03af653d pm: Rework usage of CONFIG_MP_NUM_CPUS to CONFIG_MP_MAX_NUM_CPUS
Replace usage of CONFIG_MP_NUM_CPUS with CONFIG_MP_MAX_NUM_CPUS for
init and declaration as we phase out CONFIG_MP_NUM_CPUS usage.

Signed-off-by: Kumar Gala <kumar.gala@intel.com>
2022-10-27 13:51:55 -04:00
Fabio Baltieri 781ece7673 doc: release: note that zephyr- tags won't be used anymore
Add a note about the project not using zephyr- tags anymore.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2022-10-27 16:26:08 +00:00
Jonathan Rico 4b1585c23f Bluetooth: shell: fix compiler warning
Compiler thinks `err` is not initialized when
`CONFIG_DEBUG_OPTIMIZATIONS=y`.

Fixes #51521 .

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2022-10-27 17:23:36 +02:00
Mahesh Mahadevan 47877f7e8a boards: nxp: Enable RTC on RT595 EVK
Enable RTC on RT595 EVK

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2022-10-27 10:17:07 -05:00
Jaska Uimonen 2389e446ab dma: gpdma: fix cfg_hi and cfg_lo initialization
If cfg_hi and cfg_lo are not set to zero in config setting, different
dma slot value is bitwise ORred to the previous set value. Thus fix it.

Signed-off-by: Jaska Uimonen <jaska.uimonen@linux.intel.com>
2022-10-27 17:09:27 +02:00
Andries Kruithof 5e360b81c2 Bluetooth: controller: llcp: update rx parameters upon receipt of PDU
According to specification, when executing a remote procedure the
rx parameters used need to be updated when the REQ from the peer
is received. Currently this is done only when an ACK is
received on the RSP PDU send out.
This commit updates the RX parameters upon receipt of the REQ PDU

Signed-off-by: Andries Kruithof <andries.kruithof@nordicsemi.no>
2022-10-27 16:57:27 +02:00
Neil Armstrong 62dc712a50 test: drivers: rand32: add overlay for PSA Crypto Random entropy
This adds an overlay DT & config to enable the PSA Crypto Random entropy
driver to get random bytes from TFM.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2022-10-27 16:32:05 +02:00
Neil Armstrong 7266f82141 test: drivers: entropy: add overlay for PSA Crypto Random entropy
This adds an overlay DT & config to enable the PSA Crypto Random entropy
driver to get random bytes from TFM.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2022-10-27 16:32:05 +02:00
Neil Armstrong 3b407a1987 drivers: entropy: Add the PSA Crypto Random entropy driver
This adds an entropy driver calling the PSA Crypto psa_generate_random()
API to get random bytes.

Currently this only uses the TFM provided psa_generate_random().

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2022-10-27 16:32:05 +02:00
Neil Armstrong e1429d7897 dts: bindings: rng: add binding for the PSA Crypto RNG
Add devicetree binding for the PSA Crypto Random source.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2022-10-27 16:32:05 +02:00
Kumar Gala ba0617417a tests: intel_adsp: smoke: Convert CONFIG_MP_NUM_CPUS handling
Move runtime checks to use arch_num_cpus().  This is to allow runtime
determination of the number of CPUs in the future.

Signed-off-by: Kumar Gala <kumar.gala@intel.com>
2022-10-27 09:54:22 -04:00
Balaji Kulkarni 7f1a5cce12 drivers: gpio: expose gpio_utils.h to external GPIO drivers
Expose "gpio_utils.h" header for external GPIO drivers.

Fixes #48609.

Signed-off-by: Balaji Kulkarni <balaji.kulkarni92@gmail.com>
2022-10-27 15:38:51 +02:00
Keith Packard 57bb7d86a8 cmake/target_arm: Use NO_SPLIT for TOOLCHAIN_LD_FLAGS
The whole set of architecture flags must be specified together as
they might not make sense in isolation, e.g. -mfloat-abi=hard requires
a -mcpu value that might have an FPU. Use the NO_SPLIT feature to
bind all of the linker options together so that the linker can
compute the correct linker paths for toolchain-provided libraries like
libc and libgcc.

Signed-off-by: Keith Packard <keithp@keithp.com>
2022-10-27 15:38:41 +02:00
Krishna T 1852e33213 net: lib: zperf: Disable prints during ongoing traffic
Prints when traffic is ongoing cost a few Mbps due to writing to UART as
observed by the profiler, so, disable them by default.

Signed-off-by: Krishna T <krishna.t@nordicsemi.no>
2022-10-27 15:37:41 +02:00
Christoph Schnetzler a75f3e7871 net: if: fix type qualifiers ignored on function return type
if compiler option -Wextra and -Werror is enabled the compilation
fails due to ignored-qualifiers warning.

The 'const' qualifier on return type has no effect.

Signed-off-by: Christoph Schnetzler <christoph.schnetzler@husqvarnagroup.com>
2022-10-27 15:37:32 +02:00
Aleksander Wasaznik fd5fe6ca8e Bluetooth: Host: Add `CONFIG_BT_ID_UNPAIR_MATCHING_BONDS`
This commit prevents the assertion error added in the previous commit,
by introducing the following behavior.

When the Host detects that a pairing procedue would result in more than
one local identity having a bond with the same remote address, it will
try to abort the pairing. If the pairing procedure cannot be properly
aborted, it will remove the pairing locally and disconnect.

This commit also introduces a new kconfig `BT_ID_UNPAIR_MATCHING_BONDS`.
This config changes the above-described behavior to instead un-pair the
old bond and continue with the pairing (if the new bond has the same or
better security.)

The new kconfig is not enabled by default. See the help text of the new
kconfig option for more details.

Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
2022-10-27 13:16:59 +02:00
Aleksander Wasaznik 6e926dcd83 Bluetooth: Prevent bonding to the same device more than once
This change prevents two local identities from having bonds to the same
device.

The Core specification is not well suited for Zephyr's multiple-local-
identities feature. The HCI specification seems written with intent that
a controller is used for only one GAP device. A GAP device has at most
one public address, and at most one random static address.

The Zephyr Bluetooth API, on the other hand, has a concept of local
identities. This feature allows the Zephyr Bluetooth stack to
simulatainously assume multiple local addresses. This does not mesh well
with the above intent in the specification.

In particular, the HCI specification for the resolve list does not allow
more than one entry for a remote address. The controller will deny any
attempts at doing this.

The current implementation of the Zephyr host will try the above and be
denied. But there is no handling for this situation and the host ends up
in a confused state. Some parts of the system are ok with the two bonds,
but other parts assume this situation never occurs behave badly.

The result is that the host confuses the multiple bonds to the same
device. Symtoms include:

- Directed advertisements have a different source address than what the
  host intended, in which case the two sides are confused about the
  address of the Zephyr advertiser, and as a result LTKs will not match.

- Errors in the log.

This commit simply asserts. This is not a solution, just a placeholder
for a fix. The next commit will implement a strategy for handling this
situation instead of failing this assert.

Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
2022-10-27 13:16:59 +02:00
Aleksander Wasaznik dfe03c1268 Bluetooth: Host: Define `bt_irk_eq`
This gives a well-defined method for determining if two IRKs are equal.

Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
2022-10-27 13:16:59 +02:00
Aleksander Wasaznik 339ac358cd Bluetooth: Host: BS tests: bsim_test_bond_overwrite_allowed/denied
These tests prove the existence of a bug in the local identity feature.

Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
2022-10-27 13:16:59 +02:00
Maureen Helm a9b223b26b drivers: sensor: Refactor drivers to use SENSOR_DEVICE_DT_INST_DEFINE
Refactors all sensor drivers to use SENSOR_DEVICE_DT_INST_DEFINE, which
is a sensor-specific variant of DEVICE_DT_INST_DEFINE that provides a
common place to instantiate additional data structures for the future
sensor subsystem and/or sensor driver stats.

This approach was inspired by I2C_DEVICE_DT_INST_DEFINE to streamline
adding I2C stats support across all I2C drivers.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2022-10-27 09:27:14 +00:00
Aleksander Wasaznik 9124e310fd CODEOWNERS: Remove alwa-noric from bluetooth mesh
Removes alwa-nordic from the following paths:
/tests/bluetooth/bsim_bt/bsim_test_mesh/
/tests/bluetooth/mesh_shell/

This is done by adding new definitions for those paths, inheriting the
owners of the previously matching rule, but without alwa-nordic.

PavelVPV is added to both entries.

Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
2022-10-27 11:05:12 +02:00
Veijo Pesonen 59f53acd37 include: lwm2m: Brings API doc into line with the v1.1 spec
Section numbers do not match between v1.0 and v.1.1 so refer only to
those by their names which stay the same.

Signed-off-by: Veijo Pesonen <veijo.pesonen@nordicsemi.no>
2022-10-27 11:05:05 +02:00
Veijo Pesonen 8c68e01e55 doc: lwm2m: LwM2M Shell
Describes a possible scenario where to use the LwM2M shell
and how to enable it.

Signed-off-by: Veijo Pesonen <veijo.pesonen@nordicsemi.no>
2022-10-27 11:05:05 +02:00
Rob Barnes 0b2b221b36 toolchain: Check if __STDC_VERSION__ is defined
Check if __STDC_VERSION__ is defined before referencing it. This will
prevent a compilation failure when __STDC_VERSION__ is not defined for
any reason.

Signed-off-by: Rob Barnes <robbarnes@google.com>
2022-10-27 11:03:49 +02:00
Nikolay Agishev 5b6f2f4fb6 twister: Add fiters to SYS-T related tests
New filter "TOOLCHAIN_HAS_NEWLIB == 1" was applied
because of following chain of dependencies:
LOG_MIPI_SYST_ENABLE=y --> CONFIG_MIPI_SYST_LIB --> \
--> REQUIRES_FULL_LIBC --> NEWLIB_LIBC.

Not all compillers announced in Zephyr support NewLib.

Signed-off-by: Nikolay Agishev <agishev@synopsys.com>
2022-10-27 11:03:30 +02:00
Michał Barnaś 794313c5e0 bindings: add missing binding file for ite,it8xxx2-usbpd
This commit adds missing binding file for the ite,it8xxx2-usbpd.
Without this file, the DT_HAS_*_ENABLED macro wasn't defined and
couldn't be used in the Kconfigs.

Signed-off-by: Michał Barnaś <mb@semihalf.com>
2022-10-27 11:03:24 +02:00
Mahesh Mahadevan d9fcf0ca7a tests: power_mgmt_soc: Add overlay for MXRT595 EVK
Enable the OS Timer to be a wakeup source

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2022-10-27 11:03:13 +02:00
Mahesh Mahadevan d13ffceb62 timer: nxp: Update OS-Timer to use wakeup-source flag
Enable the OS Timer to be a wakeup source only if
configured through device tree property.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2022-10-27 11:03:13 +02:00
Henrik Brix Andersen 58afbc8f26 drivers: can: mcp2515: add support for multiple device instances
Add support for multiple MCP2515 CAN controller device instances.

Fixes: #51458

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2022-10-27 11:03:05 +02:00
Thomas Stranger 338f1b9488 samples: subsys: canbus: isotp: fix sample path in Readme.rst
The path in the readme did not match the sample's real path.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2022-10-27 11:02:57 +02:00
Thomas Stranger 95778c3227 boards: shields: mcp2515: doc: update sample path
The path of the sample has changed in the meantime, update this in
the docs of the board.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2022-10-27 11:02:57 +02:00
Adrian Bonislawski 30e4a4b71e west: sign: remove -i 3 parameter
in some builds there is need to pass different value for -i parameter
and current code will override it to 3
Also in rimage i parameter is by default set to 3

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@intel.com>
2022-10-27 11:02:35 +02:00