Commit Graph

75735 Commits

Author SHA1 Message Date
Jamie McCrae 802668b259 samples: mgmt: updatehub: Select required Kconfigs
These Kconfig options are changing from select to depends on,
therefore make sure the needed options are used in the sample
project.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-03-03 10:49:32 +01:00
Jamie McCrae 1724504efb samples: mgmt: hawkbit: Select required Kconfigs
These Kconfig options are changing from select to depends on,
therefore make sure the needed options are used in the sample
project.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-03-03 10:49:32 +01:00
Jamie McCrae 0241de3969 samples: canopennode: Select STREAM_FLASH for sysbuild build
For mcuboot support, this Kconfig option needs to be selected, this
is done by having a separate project configuration file when
building the version that supports mcuboot.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-03-03 10:49:32 +01:00
Jamie McCrae 13c8f1dc97 samples: mgmt: mcumgr: smp_svr: Select FLASH_MAP and STREAM_FLASH
Selects the FLASH_MAP Kconfig as this is changing from an automatic
selection to a depends on due to a dependency loop.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-03-03 10:49:32 +01:00
Jamie McCrae 0bad35de45 samples and tests: Use non-environmental zephyr base variable
This drops using the environmental part when referencing ZEPHYR_BASE
as the environment value does not have to be set and, in most cases,
is no longer set at all.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-03-03 10:49:10 +01:00
Robert Lubos 46e93f67a6 samples: net: sockets: echo_server: Fix userspace crash
k_work_* API cannot not be used from the user threads as the APIs are
not syscalls. Doing so leads to a crash when userspace is enabled.

As the current use of delayed work API from user threads is merely
scheduling of the initial work execution, it can be moved into the main
thread context. The time difference from the former and current approach
should be marginal, as the start_tcp/udp_proto() calls are not blocking
calls.

Another issue was usage of k_mem_domain_add_thread() on uninitialized
TCP threads. This lead to another crash, as assigning thread to a memory
domain also involves removing it from the previous domain, which lead to
NULL pointer dereference if thread was not initialized yet. As, by
default, newly spawned threads inherit memory domain assignment from
their parent, it's not really needed to assign the same domain
explicitly, hence, it can be safely removed.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2023-03-03 10:48:21 +01:00
Emil Gydesen 977329e08b Samples: Bluetooth: Unicast Audio Client support no sink/source ASE
Allow the Unicast Audio Client sample to work if there are no
sink or no source ASEs on the remove device (e.g. if the remote
device only has sink ASEs).

If the remote have neither, it will abort.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-03-03 10:47:51 +01:00
Erwan Gouriou c9b57cdfde boards: stm32f7/stm32h7: Configure external SDRAM region with RAM attribute
On M7 based STM32 boards, external SDRAM may be present and mapped in the
area 0xC0000000-0xDFFFFFFF.
According to ARMv7-M Architecture Reference Manual chapter B3.1
(table B3-1), this area is specified as Device Memory Type, with the
consequence that all accesses should be naturally aligned, otherwise
a hard fault will be triggered whatever UNALIGN_TRP status in the CCR reg.

To avoid this issue, when available, configure external SDRAM memory
regions as a MPU with RAM attribute.

Fixes #54670

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2023-03-03 10:46:40 +01:00
Chris Friedt 5e9d3c7522 posix: fnmatch: correct (many) compliance issues
* add opening and closing braces around several blocks
* convert dos line endings to unix
* move assignments out of conditionals
* ensure adequate spacing after control blocks

Signed-off-by: Chris Friedt <cfriedt@meta.com>
2023-03-03 17:40:14 +09:00
Chris Friedt 93e67fb73f tests: posix: add coverage for fnmatch
Previously, the `fnmatch()` function was available in `lib/util`
but it did not have any test coverage.

After moving it to `lib/posix`, add test coverage to the POSIX
testsuite.

Signed-off-by: Chris Friedt <cfriedt@meta.com>
2023-03-03 17:40:14 +09:00
Chris Friedt e79e203a6c posix: fnmatch: add extern C decls when using C++
All public API headers should have ifdef extern C declarations
symbols defined in the global namespace.

Signed-off-by: Chris Friedt <cfriedt@meta.com>
2023-03-03 17:40:14 +09:00
Chris Friedt f923441146 lib: posix: move fnmatch from lib/util to lib/posix
The `fnmatch()` function is specified by POSIX and should be
a part of `lib/posix`.

Signed-off-by: Chris Friedt <cfriedt@meta.com>
2023-03-03 17:40:14 +09:00
Vinayak Kariappa Chettimada afd4346965 Bluetooth: ISO: Fix BT_ISO_TX_MTU range
In the Bluetooth Core Specification, the minimum
ISO_Data_Packet_Length is 0x0001, hence fix the
BT_ISO_TX_MTU range to allow a minimum value of 1.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2023-03-03 09:19:19 +01:00
Alberto Escolar Piedras 4c37545c26 samples: bluetooth: PAST: Disable for nrf52_bsim
The Zephyr controller does not support PAST, and there
is no other controller we can build upstream with these samples.

Disable these 2 samples for the nrf52_bsim until PAST
is supported by the controller.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-03-03 09:19:00 +01:00
Daniel DeGrasse 01b9a9cdbb drivers: sdhc: add support for configurable power on delay to SPI SDHC
Add support for configuring power on delay when using SPI SDHC. This
allows cards that reliably initialize with a shorter (1ms) delay to
avoid the long initialize delay otherwise imposed.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2023-03-03 09:18:47 +01:00
Maxmillion McLaughlin 2f9335d20a drivers: i2c: stm32: add bus recovery support
Add I2C bus recovery support to the STM32 v1 and v2 driver. The STM32 i2c
peripheral does not natively support I2C bus recovery so recovery is
performed using GPIO bitbanging. This mirrors the bus recovery
implementation for NXP MCUX LPI2C driver.

Fixes: zephyrproject-rtos#54917

Signed-off-by: Maxmillion McLaughlin <github@maxmclau.com>
2023-03-03 09:18:29 +01:00
Tom Burdick e6596d7afc rtio: Drop stray printks in API test
Noticed the tests were a bit verbose, saw a few stray printks. Drop those
as they aren't really needed and potentially cause testing issues, printk
is a potential synchronization point.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2023-03-03 09:18:09 +01:00
Tom Burdick 2f9945f587 rtio: Exclude failing renode platform
Renode platform fails the test despite it working well on qemu riscv.
Ignore this particular platform for now.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2023-03-03 09:18:09 +01:00
Tom Burdick 3998f9f898 rtio: Shareable lock-free iodevs
By using an mpsc queue for each iodev, the iodev itself is shareable across
contexts. Since its lock free, submits may occur even from an ISR context.

Rather than a fixed size queue, and with it the possibility of running
out of pre-allocated spots, each iodev now holds a wait-free mpsc
queue head.

This changes the parameter of iodev submit to be a struct containing 4
pointers for the rtio context, the submission queue entry, and the mpsc
node for the iodevs submission queue.

This solves the problem involving busy iodevs working with real
devices. For example a busy SPI bus driver could enqueue, without locking,
a request to start once the current request is done.

The queue entries are expected to be owned and allocated by the
executor rather than the iodev. This helps simplify potential
tuning knobs to one place, the RTIO context and its executor an
application directly uses.

As the test case shows iodevs can operate effectively lock free
with the mpsc queue and a single atomic denoting the current task.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2023-03-03 09:18:09 +01:00
Tom Burdick e9f6eef791 rtio: Add lock free MPSC queue for iodevs and more
Adds a lock free/wait free MPSC queue to the rtio subsystem.

While the SPSC ring queue is fast and cache friendly it doesn't
work for all scenarios. Particularly the case where multiple rtio contexts
are attempting to work with a single iodev. An MPSC queue works perfectly
in this scenario.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2023-03-03 09:18:09 +01:00
Tom Burdick 22ff4d6102 rtio: Remove unused spsc initializer params
SPSC initializer macro had unused parameters defined and documented. Remove
those as they are unused.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2023-03-03 09:18:09 +01:00
Jordan Yates 30dbaa83f7 logging: backend_uart: handle PM on panic
Handling panicking while in an ISR. Instead of attempting to call
`pm_device_get` for each character, ensure that the hardware is enabled
when `log_panic` is called.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2023-03-03 09:17:49 +01:00
Jordan Yates 997dce97bf logging: backend_uart: handle runtime PM
Allow the log_backend_uart char_out implementation to integrate with
'Device Runtime Power Management'.

Without using runtime PM, it is impossible for the application to manage
the power state of a UART instance, given that any module in the
application could theoretically LOG_* or printk at any point in time.

This removes the need to manually call `pm_device_state_set` when the
lowest power states must be reached, while still allowing log messages
to be output.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2023-03-03 09:17:49 +01:00
Jordan Yates 0561d0dd59 console: uart_console: handle runtime PM
Allow the uart_console console_out implementation to integrate with
'Device Runtime Power Management'.

Without using runtime PM, it is impossible for the application to manage
the power state of a UART instance, given that any module in the
application could theoretically LOG_* or printk at any point in time.

This removes the need to manually call `pm_device_state_set` when the
lowest power states must be reached, while still allowing console and
printk messages to be output.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2023-03-03 09:17:49 +01:00
Michał Barnaś e0fbd35fc0 usbc: explicitly declare sizes of state machines arrays
The asserts in the USB-C stack functions were causing compilation
errors when asserts were enabled in Kconfig.
This was caused because the asserts checked if the functions
parameters were within limits specified by the state machine arrays.
At the position of these asserts, these arrays were only declared
without specifying the size of them, what prohibited the asserts from
knowing the size of arrays and checking if specified value is within
limit of it.

Signed-off-by: Michał Barnaś <mb@semihalf.com>
2023-03-03 09:17:11 +01:00
Jeroen van Dooren 1be74ac6d7 net: dns: prevent crash on nullptr as callback
When a query is done, the query isn't set to NULL.
This can cause a nullptr exception in invoke_query_callback().

Signed-off-by: Jeroen van Dooren <jeroen.van.dooren@nobleo.nl>
2023-03-02 21:58:07 -05:00
Maciej Perkowski 85dd4975a4 twister: cmake: Add prefiltration based on cmake package helper script
Twister allows filtering based on kconfigs and dts, however the
filtration is a part of the cmake stage, i.e. the stage has to pass
first and then twister checks if required properties are available.
This causes problems, when the full cmake stage is unable to pass.
If so, other filtration methods had to be used, e.g. platform_allow.
The commit modifies the twister workflow:
if a test defines filters based on kconfig/dts first a cmake package
helper script is used to extract dt and/or kconfigs and if the
conditions are fulfilled  it proceeds to a regular cmake stage.
If not, test is skipped.

Co-authored-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
Signed-off-by: Maciej Perkowski <Maciej.Perkowski@nordicsemi.no>
2023-03-02 15:38:08 -05:00
Nicolas Pitre 0fc9c9f46a drivers/timer/arm_arch_timer: driver revamp
Couple issues:

- `sys_clock_set_timeout()` should not base its `mtime` on the current
  time either. Tracking the `last_tick` and `last_elapsed` values avoids
  the need for all the tick rounding computation.

- The MIN_DELAY thing is pointless. The hardware performs a signed
  comparison. If the delay gets close or even behind current time then
  the IRQ will be triggered right away. This is unlikely to happen very
  often anyway so the constant overhead is uncalled for.

- Runtime 64-bits divisions on 32-bits hardware are very expensive.

- The timer must be enabled before the count can return a sensible
  value during driver init (at least on qemu_cortex_a9).

Discussion in PR #54919 applies here too.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2023-03-02 15:37:35 -05:00
Marc Herbert a8c0123d3c intel_adsp: cmake: add_custom_command(.mod) to fix incremental build
Now building twice back to back does not build anything the second time
when CONFIG_CLEANUP_INTERMEDIATE_FILES (which obviously breaks
incremental builds) is also turned off.

Fixes commit 2906d1aa51 ("soc/intel_adsp: Build bootloader with Zephyr")

Properly implementing custom commands requires BOTH
`add_custom_command()` and an `add_custom_target()` wrapper with some
careful DEPENDS wizardry between them.

https://cmake.org/cmake/help/latest/command/add_custom_target.html
> Use the add_custom_command() command to generate a file with
> dependencies.

The documentation of add_custom_command() also similarly refers to
add_custom_target()

When this is not done properly, the build is cursed in various, very
time-consuming ways which are not officially documented but here
instead:
https://samthursfield.wordpress.com/2015/11/21/cmake-dependencies-between-targets-and-files-and-custom-commands

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2023-03-02 15:34:55 -05:00
Aleksander Wasaznik 5233fe5fb9 Bluetooth: Host: Log incomplete adv reports
This gives our users some indication of why they are not receiving
long advertisements.

Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
2023-03-02 21:19:16 +01:00
Nicolas Pitre 4cc21e2f4a tests: timer_behavior: accuracy improvements
Don't sample the first entry outside the timer as this is a different
code path which produces a different offset from the clock tick.

Use sys_clock_hw_cycles_per_sec() to be compatible with systems that
read their hardware clock frequency at run time.

Perform cycle difference computations with uint64_t. If ever the
magnitude of the absolute clock cycle values is greater than 52 bits
then the cast to a double will actually lose accuracy.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2023-03-02 21:14:52 +01:00
Aaron Massey 8156830ad5 test: sbs_gauge_new_api replace redundant overlays
The fuel gauge API sbs_gauge test uses conf/overlay pairs for each
board. This was getting unnecessary and redundant.

Combine the overlay/conf files into a single generic overlay/conf pair for
emulated boards and apply them via the testcase.yaml rules.

Signed-off-by: Aaron Massey <aaronmassey@google.com>
2023-03-02 21:14:44 +01:00
Aaron Massey 1657860320 emul: Fix endianness fault in sbs gauge emulator
The sbs gauge emulator intercepts SMBus messages for an sbs gauge
compatible IC. However, it was incorrectly interpreting the byte order of
received register write values based on the endianness of the SoC
architecture instead of SMBus' defined little-endianness. This fault was
not caught earlier because native posix and the majority of qemu
architectures use little-endian.

Explicitly interpret the write values as little-endian.

Signed-off-by: Aaron Massey <aaronmassey@google.com>
2023-03-02 21:14:44 +01:00
TOKITA Hiroshi 875b0c70b0 tests: drivers: regulator: voltage: add an overlay for rpi_pico
Add overlay for RaspberryPi Pico's core-supply regulator test.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@fujitsu.com>
2023-03-02 21:14:34 +01:00
TOKITA Hiroshi 8cafcbac61 tests: drivers: regulator: voltage: add min/max voltage config
Add min-microvolt/max-microvolt to set the range for voltages for testing.
It filter out ranges that cannot test correctly in the configuration.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@fujitsu.com>
2023-03-02 21:14:34 +01:00
TOKITA Hiroshi 746dddd698 boards: arm: sparkfun_pro_micro_rp2040: add regulator definition on dts
Add a regulator node to keep it always on.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@fujitsu.com>
2023-03-02 21:14:34 +01:00
TOKITA Hiroshi 652808da0d boards: arm: adafruit_kb20240: add regulator definition on dts
Add a regulator node to keep it always on.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@fujitsu.com>
2023-03-02 21:14:34 +01:00
TOKITA Hiroshi 36d35ef3d0 boards: arm: rpi_pico: add regulator definition on dts
Add a regulator node to keep it always on.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@fujitsu.com>
2023-03-02 21:14:34 +01:00
TOKITA Hiroshi 47f52bba42 drivers: regulator: add support for RaspberryPi Pico regulator.
Add support for rpi_pico regulator.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@fujitsu.com>
2023-03-02 21:14:34 +01:00
Mathis Raemy e75b72234c doc: services: device_mgmt: smp_groups: Correct smp img upload request
The specification of que CBOR request 'image upload request' field
'sha' was decalred as type (str) but is (byte str).
Just replaced the field type after verified with code here:
/subsys/mgmt/mcumgr/grp/img_mgmt/src/img_mgmt.c#L383

Signed-off-by: Mathis Raemy <mathis.raemy@gmail.com>
2023-03-02 21:14:11 +01:00
Dominik Ermel 0cbc488b1e west.yml: Reset MCUboot revision due to history overwrite
The commit resets MCUboot revision after zephyrproject-rtos/mcuboot
main branch has been overwritten with mcuboot/mcuboot main.

The reset has been done due to MCUboot fork history, in Zephyr,
has been broken and contained duplicate commits.

For details look at issue: #55303.

The reset of MCUboot also requires update to following repositories:
  trusted-firmware-m

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2023-03-02 18:23:38 +01:00
Joshua Lilly 69966dd452 lib: hashmap: Move hash table files lib/hashmap
Moves the hashmap related files into their own directory

Signed-off-by: Joshua Lilly <jgl@fb.com>
2023-03-02 12:03:07 -05:00
Emil Gydesen 8333b12da7 Bluetooth: Host: Add ACL NULL check for ISO conn info
If getting the conn info of an ISO channel, the ISO channel may
not yet have an ACL connection, so we cannot get the
ACL source and destination addresses from the ACL.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-03-02 17:57:17 +01:00
Benjamin Cabé b00c63e764 footprint: ci: Remove audio SOF samples
Removes audio SOF samples from footprint test plan as they no longer
live in-tree

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2023-03-02 11:46:54 -05:00
Dominik Ermel 94af3a88ee drivers: flashdisk: Change page info verification log message
Change message to make allow distinguishing between error while
getting page info for disk configuration and page layout
verification.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2023-03-02 17:08:39 +01:00
Tomasz Moń e776241fbb samples: usb: mass: Increase main stack size
Increase main stack size for next USB device stack config to prevent
stack overflow when FatFs is used. The new main stack size value matches
the value used in old stack mass storage sample config.

Fixes: #55210

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2023-03-02 15:05:58 +01:00
Jay Vasanth e56721b8f0 dts: gpio: Add Microchip XEC GPIO macros for use in device tree
Microchip XEC devices specify GPIO pin using octal numbering and
organize pins in banks of 32. Chip documentation does not use
bank naming rather naming each pin by its octal number. This has
led to the developer having to calculate the bit position of a pin
in its 32-bit bank when a specifying the pin for GPIO usage. We
created a set of defines for all possible GPIO pins that specify
the DT GPIO bank name used in the chip level DTSI files and the
bit position in that bank.

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2023-03-02 13:52:03 +01:00
Simon Frank 5d9db9dc65 fb: cfb: cfb_shell command to set font kerning
Using `struct shell *shell` would be more consistent but triggers CI
check on MISRA rule 5.7 "A Tag name shall be a unique identifier"

Signed-off-by: Simon Frank <simon.frank@lohmega.com>
2023-03-02 13:51:55 +01:00
Simon Frank b50838c66f fb: cfb: add API to set font kerning
Font kerning was used but it was not possible to change it.
Also, font_idx was set to zero twice in init.

Signed-off-by: Simon Frank <simon.frank@lohmega.com>
2023-03-02 13:51:55 +01:00
JP Sugarbroad 6d4266a451 usb: device: msc: support larger devices
Track LBA rather than byte offset in order to simplify the code and
support devices larger than 4GiB.

Signed-off-by: JP Sugarbroad <jpsugar@amazon.com>
2023-03-02 13:51:37 +01:00