Commit graph

840 commits

Author SHA1 Message Date
Ryan McClelland ed96eb6e63 samples: fix double promotion warnings
With -Wdouble-promotion added to the warning base, fix warnings given
by the compiler.

Signed-off-by: Ryan McClelland <ryanmcclelland@fb.com>
2021-11-24 17:14:25 -05:00
Jordan Yates 8e99db5801 Kconfig: net: deprecate NET_BUF_USER_DATA_LEN
As user data sizes are now set on a per pool basis, this Kconfig option
has no purpose.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-11-24 16:04:50 +02:00
Johann Fischer cf8d7764da usb: fix bulk endpoint configuration for high-speed capable device
In the current USB device support, the sizes of bulk endpoint
are mostly configure through Kconfig and do not care if a device
is high-speed capable. The information if a USB device controller
supports high-speed comes from devicetree. Add a Kconfig option to
map this information and configure bulk endpoint sizes
accordingly.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-11-24 12:28:02 +01:00
Johann Fischer 67a265b0df samples: cdc_acm: check return value of uart_fifo_read()
uart_fifo_read() can return negative values in case
it is not implemented or CONFIG_UART_INTERRUPT_DRIVEN
is not enabled. Both cases can not actually happen in the
case of CDC ACM UART, check it anyway in case behavior
of the UART API changes unnoticed.

Align the code in RX path code of both camples and
enable TX interrupt only if data was received successfully.

Fixes: #39835
Fixes: #39824
Fixes: #39809
Coverity-CID: 240667
Coverity-CID: 240679
Coverity-CID: 240697

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-11-24 10:50:11 +01:00
Carlo Caione 2e9c57ec28 sample: ipc_service: Add ipc_rpmsg_static_vrings sample
Add a new sample to show and test the usage of the newly introduced
backend.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2021-11-22 23:03:23 -05:00
Daniel Leung fb91ce2e21 kernel: mem_domain: init function to return error values
This changes k_mem_domain_init() to return error values
instead of asserting when errors are encountered.
This gives applications a chance to recover if needed.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-11-22 12:45:22 -05:00
Gerard Marull-Paretas 16d1e80cbe samples: pm: use new PM macros
Use recently introduced PM macros to define device PM resources.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-11-19 10:11:32 +01:00
Johann Fischer 5315c285cc sampes: shell: remove usage of CONFIG_USB_UART_CONSOLE
Remove option CONFIG_USB_UART_CONSOLE where it has no influence
or enable CONFIG_SHELL_BACKEND_SERIAL_CHECK_DTR without taking
a detour through CONFIG_USB_UART_CONSOLE.

Check the compatibility of chosen property instead
of usage of CONFIG_USB_UART_CONSOLE option.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-11-18 14:29:18 +01:00
Johann Fischer 0908a52d0d samples: usb: console: fix configuration
This sample uses console driver and therefore
Kconfig option CONFIG_CONSOLE and CONFIG_UART_CONSOLE
are required.

Kconfig option CONFIG_USB_UART_CONSOLE no longer has
any influence here and should be removed.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-11-18 14:29:18 +01:00
Carlo Caione 2e3481b59c samples: ipc_service: Make space for new backends
Move the backend-specific samples to a new subdirectory to make space
for new samples.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2021-11-12 14:51:29 +01:00
Carlo Caione b64666bcc7 samples: Move IPM samples in a different directory
Currently the IPM samples are hosted in the IPC sample location. Clean
this situation up by moving the IPM samples to a new location.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2021-11-12 14:51:29 +01:00
Sylvio Alves 9d159ba86f samples: shell_module: fix missing qsort reference
PR #39980 added qsort to minimal libc but caused
shell_modules sample to fail building.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2021-11-11 18:12:09 -05:00
Christopher Friedt bd83df1552 libc: minimal: add qsort to the minimal libc
This change implements qsort() for the minimal libc via Heapsort.

Heapsort time complexity is O(n log(n)) in the best, average,
and worst cases. It is O(1) in space complexity (i.e. sorts
in-place) and is iterative rather than recursive. Heapsort is
not stable (i.e. does not preserve order of identical elements).

On cortex-m0, this implementation occupies ~240 bytes.

Fixes #28896

Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>
2021-11-10 07:00:36 -05:00
Henrik Brix Andersen 5bc0451f72 drivers: can: remove DT_CHOSEN_ZEPHYR_CANBUS_LABEL macro
Remove the DT_CHOSEN_ZEPHYR_CANBUS_LABEL macro and replace it with
DEVICE_DT_GET(DT_CHOSEN(zephyr_canbus)) were possible.

Where both devicetree CAN controllers and Kconfig specified CAN loopback
controllers are supported, the macro is replaced with
DT_LABEL(DT_CHOSEN(zephyr_canbus)) for now.

This is the first pass for removing the requirement for devicetree
labels for CAN controllers.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2021-11-09 11:19:50 +01:00
Johann Fischer 02c32d4474 usb: move USB_DEVICE_REMOTE_WAKEUP option to drivers
Kconfig USB_DEVICE_REMOTE_WAKEUP option depends only on
USB device controller capability, but is not controlled
by the USB device controller drivers configuration.
Move USB_DEVICE_REMOTE_WAKEUP option to drivers and
make it promptless.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-11-08 17:01:32 +01:00
Henrik Brix Andersen c817a09b0a canbus: rename zephyr,can-primary chosen property to zephyr,canbus
Rename the Zephyr chosen property for specifying the default CAN bus
controller from "zephyr,can-primary" to "zephyr,canbus".

The "zephyr,can-primary" property name was selected in antipation of
adding support for redundant CAN networks, which we have yet to
add. Meanwhile, the "primary" term causes confusion for non-redundant
CAN bus configurations (and the "can" term doesn't match the name of the
Zephyr CAN bus subsystem).

The CAN in Automation (CiA) 302-6, which deals with CANopen network
redundancy, uses the terms "default interface" and "redundant
interface". If/when we add support for redundant CAN networks, the
"zephyr,canbus" chosen property can be supplemented with a
"zephyr,canbus-redundant" chosen property.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2021-11-07 09:05:39 -05:00
Dominik Ermel a333ffce1d storage/flash_map: Add FLASH_AREA_DEVICE macro
The macro returns pointer to a device object the flash area
exists on.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2021-11-06 21:37:47 -04:00
Carlo Caione 2c08114c27 ipc_service: mi: Convert to device driver
As part of the work to support multiple IPC instances / backends using
IPC service, the static vrings mi code must be reworked to resemble a
classic device driver.

Fix also the sample using it.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2021-11-04 18:03:16 +01:00
Gerard Marull-Paretas a8fc8ef17f samples: use common PM action callback naming
The PM callback is no longer referenced as "pm_control" but
"pm_action_cb", so reflect this new naming on the callbacks.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-11-03 20:27:18 -04:00
Gerard Marull-Paretas 1cee284a46 pm: device: runtime: use pm_device_runtime* namespace
Move all PM device runtime API calls from pm_device* to the
pm_device_runtime* namespace.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-11-03 16:37:33 -04:00
Gerard Marull-Paretas e3fece5241 pm: device: runtime: remove pm_device_wait
After the removal of pm_device_get_async, the pm_device_wait API has
become redundant. Its usage after pm_device_put_async should not be
considered a valid usecase, since after that call what will happen is a
pm_device_get (which is blocking).

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-11-03 16:37:33 -04:00
Gerard Marull-Paretas 30d217aa28 pm: device: runtime: remove pm_device_get_async
As of today there is no clear usage of asynchronous gets, since in
general, a resume operation should be synchronous (we are about to use
the device immediately after resuming it). Removing this API simplifies
the runtime implementation in a significant way (refer to future
commits).

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-11-03 16:37:33 -04:00
Bartosz Bilas 865ff22b3f samples: subsys: dfu: update URL of the MCUboot zephyr readme
Switch to the new MCUboot zephyr documentation URL
since the old one returns error 404.

Signed-off-by: Bartosz Bilas <b.bilas@grinn-global.com>
2021-11-02 13:25:43 +01:00
Henrik Brix Andersen 265cdf8dc6 cmake: use find_package() instead of literal include in tests and samples
Convert remaining tests and samples to using find_package() instead of
literally including the CMake boilerplate code.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2021-11-01 10:33:09 -04:00
Glauber Maroto Ferreira bcf78f29d6 soc: riscv: esp32c3: nvs: add NVS support using fixed partitions
add NVS support to esp32c3 using fixed partitions defined on DT

Signed-off-by: Glauber Maroto Ferreira <glauber.ferreira@espressif.com>
2021-10-28 06:47:21 -04:00
Iuliana Prodan dd1c96d123 samples/subsys/audio/sof: add configuration for imx8m board
Add support for SOF with Zephyr on i.MX8MP board.

Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com>
2021-10-20 19:08:50 -04:00
Evgeniy Paltsev efc9cee834 samples: shell_module: fix build on 64bit platforms
After the __printf_like validation was added to the shell_fprintf
functions we got warnings while building the
'samples/subsys/shell/shell_module' due to incorrect specifiers
while printing size_t variables. Fix that.

Fixes: #39386
Fixes: fe2075d140 "shell: Add __printf_like to shell_fprintf"

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Evgeniy Paltsev <PaltsevEvgeniy@gmail.com>
2021-10-19 06:44:20 -04:00
Tom Burdick f523c336ef pm: Use stats subsys for tracking system states
Uses the stats subsys to provide simple but useful debugging stats for
power management state changes and timing.

Removes the no longer needed PM_DEBUG config option

Replaces the use of PM_DEBUG for a test clock output pin for mec1501 and
adds in its place an SoC Kconfig option to enable it.

Adds a STATS_SET macro for assigning a value to a stat group field

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2021-10-17 10:56:21 -04:00
Filip Kokosinski 3fff2550d0 samples/subsys/shell/shell_module: add board name command
This commit adds a new subcommand to the `demo` command that prints out
the name of the used board.

Signed-off-by: Filip Kokosinski <fkokosinski@antmicro.com>
2021-10-14 16:33:42 -04:00
Tom Burdick fc34338d77 stats: Add a stats shell command
Adds the stats shell command to list all stats and enable the command in
the shell sample app.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2021-10-14 06:32:57 -04:00
Guennadi Liakhovetski 5ec9738c9b boards: xtensa: intel_adsp_cavs15: force COMP_SRC_TINY
cAVS 1.5 has little RAM, force COMP_SRC_TINY to fix SOF build
failures under Zephyr with XCC.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2021-10-13 08:34:51 -04:00
Evgeniy Paltsev eacabaf5ae tests: tracing.osawareness.openocd cleanup
Move all config options to prj.conf. No functional
changes intended.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Evgeniy Paltsev <PaltsevEvgeniy@gmail.com>
2021-10-13 06:22:44 -04:00
Evgeniy Paltsev 8077907827 tests: fix tracing.osawareness.openocd when thread names disabled
tracing.osawareness.openocd relies on the CONFIG_THREAD_NAME is
enabled, however we don't enable it in test config.

Fix that.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Evgeniy Paltsev <PaltsevEvgeniy@gmail.com>
2021-10-13 06:22:44 -04:00
Evgeniy Paltsev 2677e55b92 tests: fix tracing.osawareness.openocd for SMP platforms
The tracing.osawareness.openocd doesn't support executing
on multicore Zephyr. However we disable multiple CPUs
usage in two different ways for this test:
 - by setting CONFIG_MP_NUM_CPUS to 1
 - by setting CONFIG_SMP to n

It's not correct for all SMP platforms to disable SMP. As
it is also excessive (we can guarantee the execution on
single core by setting CONFIG_MP_NUM_CPUS=1) let's drop
SMP disabling.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Evgeniy Paltsev <PaltsevEvgeniy@gmail.com>
2021-10-13 06:22:44 -04:00
Carlo Caione 6c00e980b2 ipc: ipc_service: Rework multi-instance backend.
Only one single IPC service backend is currently present: multi_instance
backend. This backend is heavily relying on the RPMsg multi_instance
code to instanciate and manage instances and endpoints. Samples exist
for both in the samples/subsys/ipc/ directory.

With this patch we are "unpacking" the RPMsg multi_service code to make
it more modular and reusable by different backends.

In particular we are re-organizing the code into two helper libraries:
an RPMsg library and a VRING / virtqueues static allocation library. At
the same time we rewrite the multi_instance backend to make fully use of
those new libraries and remove the old multi_instance sample.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2021-10-11 20:58:09 -04:00
Kumar Gala bfcb32b755 samples/subsys/mgmt/osdp: Fix build issues
The samples/subsys/mgmt/osdp utilize GPIO so having it set in the
prj.conf is needed since not all platforms enable GPIO by default.

To address the 'No SOURCES given to Zephyr library: drivers__gpio'
add a 'depends on gpio' to the sample.yaml to only build this on
platforms that have GPIO driver support.

Fixes #39180

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-10-06 10:32:10 -04:00
Johann Fischer fb454d09bb doc: usb: refactor USB device support documentation structure
Move related areas to their own files and order
documentation logically from lower to upper layer.
Fix gross errors and inconsistencies.

Co-authored-by: Carles Cufí <carles.cufi@nordicsemi.no>
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-10-06 11:51:07 +02:00
Nick Ward e0f18128bf task_wdt: fix silent init failures
The task_wdt_init() API can fail to install a timeout for the fallback
hardware WDT (hw_wdt) without returning an error code.  This patch
enables task_wdt_init() to return the hw_wdt install timeout error code
if the hw_wdt install timeout fails.

Signed-off-by: Nick Ward <nick.ward@setec.com.au>
2021-10-01 15:21:32 +02:00
Håkon Øye Amundsen ede29d849d samples/mgmt/smp_svr: Increase main stack size
Some build variants will fail runtime for certain boards (e.g. nRF52832)
due to stack overflow. Avoid this by increasing the stack size.

Signed-off-by: Håkon Øye Amundsen <haakon.amundsen@nordicsemi.no>
2021-09-28 20:15:25 -04:00
Marc Herbert 3e0bc8c231 samples/audio/sof: remove zephyr_interface_library_named(sof_lib)
As this makes no difference, it's misleading so let's remove it to stop
being misled. I don't know why initial commit efa794dbc5 added it but
the build directory is strictly identical with or without this line.

The SOF code is included in the build thanks to CONFIG_SOF in prj.conf,
not this.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-09-28 20:03:15 -04:00
Jakub Rzeszutko 2b5723d455 shell: add init backend configuration
Each backend can configure separately features like colors on/off, VT100
handling and so on. This can be very handy for planned MQTT backend.
Shell will not send VT100 commands when VT100 is not enabled globally or
for particular backend.

Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
2021-09-28 20:02:01 -04:00
Torsten Rasmussen d800b4a4d7 drivers: gpio: remove unused GPIO selection
Fixes: #38403

Removing unneeded `imply GPIO` and `CONFIG_GPIO=y` occurrences where no
files are added to the gpio zephyr library.

Also removed `CONFIG_GPIO=y` occurences where this is handled by
defconfigs for the soc or board.

Selection of GPIO without selecting any drivers results in the warning:

> No SOURCES given to Zephyr library: drivers__gpio
>
> Excluding target from build.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2021-09-28 12:13:23 +02:00
Torsten Rasmussen 8e64038559 drivers: net: adding NET_DRIVERS menuconfig
Fixes: #38403

Adding NET_DRIVERS menuconfig so that network drivers are grouped
together in its own menu entry under drivers, similar to most other
drivers.

This further has the advantages that `CONFIG_NET_DRIVERS` can be used
for testing to determine if network drivers has been selected.

This changed revealed a dependency loop where both `select` (for SLIP)
and `depends` (for PPP) which both depends on NET_DRIVERS` where in use
in the dependency tree for Qemu networking, especially NET_SLIP_TAP.

This is handled by defaulting `NET_DRIVERS` to `y` when building for a
Qemu target.
`SLIP` had a dependency to `!QEMU_TARGET || NET_QEMU_SLIP`. This is
changed so that SLIP prompt depends on `!QEMU_TARGET` which provides
full user control in hardware but makes the symbol promptless on Qemu
targets.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2021-09-28 12:13:23 +02:00
Fabio Baltieri 89df245b0d samples: modbus: update/fix samples.yaml configs
Update the sample.yaml files for the modbus samples:
- depends_on entries should just be space separated, drop the comma
- add the platform referenced in the documentation to platform_allow
- replace the deprecated dt_compat_enabled_with_alias with
  dt_enabled_alias_with_parent_compat

Signed-off-by: Fabio Baltieri <fabio.baltieri@gmail.com>
2021-09-27 21:54:56 -04:00
Fabio Baltieri 64a2d97c03 samples: modbus: rtu_server: drop unused variable
This has been unreferenced since:

4ff616b647 modbus: rework interface configuration

This generates a compiler warning, but it went unnoticed because the
sample test is configured incorrectly and not running.

Signed-off-by: Fabio Baltieri <fabio.baltieri@gmail.com>
2021-09-27 21:54:56 -04:00
Iuliana Prodan 0b23984920 samples/subsys/audio/sof: add configuration for i.MX8QXP board
Add support for i.MX8X, which represents i.MX8QXP board.

Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com>
2021-09-27 21:52:31 -04:00
Jamie McCrae 2af4861014 samples: ipc: rpmsg_service: Add support for BL5340
Add support for BL5340 to rpmsg_service sample

Signed-off-by: Jamie McCrae <jamie.mccrae@lairdconnect.com>
2021-09-23 13:13:51 -04:00
Jamie McCrae d460536a1b samples: ipc: rpmsg_multi_instance: Add support for BL5340
Add support for BL5340 to rpmsg_multi_instance sample

Signed-off-by: Jamie McCrae <jamie.mccrae@lairdconnect.com>
2021-09-23 13:13:51 -04:00
Jamie McCrae e61009a2f5 samples: ipc: ipc_service: Add support for BL5340
Add support for BL5340 to ipc_service sample

Signed-off-by: Jamie McCrae <jamie.mccrae@lairdconnect.com>
2021-09-23 13:13:51 -04:00
Dominik Ermel 6272d303c4 samples/littlefs: Remove FIXME with PRIxPTR usage
With "Incompatible (u)intptr_t type and PRIxPTR definitions",
https://github.com/zephyrproject-rtos/zephyr/issues/37718,
issue resolved the FIXME code is no longer needed.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2021-09-21 06:21:59 -04:00