Commit graph

50892 commits

Author SHA1 Message Date
Flavio Ceolin
10fc05ced6 toolchain: llvm: Find strip command
Some targets require *strip* command. This command was not
being set when selecting llvm toolchain.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-04-17 21:03:13 -04:00
Kumar Gala
c05ba3517b samples: civetweb: websocket_server: Fix build issue
The sample uses generate_inc_file_for_target for some "webpages" that
get included.  However, the directory that the generated files are
put into: ${ZEPHYR_BINARY_DIR}/include/generated/web_page isn't
created and thus the build fails.

Add a simple 'file(MAKE_DIRECTORY ..)' to create the dir.

Fixes #34345

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-04-17 07:47:42 -04:00
Nick Graves
56b9a422f7 tests/kernel: Add k_poll test for polling on message queues
Add tests for message queue polling functionality.

Fixes: #26728

Signed-off-by: Nick Graves <nicholas.graves@samsara.com>
2021-04-17 07:47:26 -04:00
Nick Graves
b445f13462 kernel: Allow k_poll on message queues
This commit adds the ability to use a message queue as a
k_poll object. It follows the same pattern as polling on
FIFOs.

This change has been proven in practice at Samsara.

Fixes: #26728

Signed-off-by: Nick Graves <nicholas.graves@samsara.com>
2021-04-17 07:47:26 -04:00
Sidhdharth Yadav
679df67940 boards: arm: enable PWM support for nucleo_f207zg in device tree
Enabling PWM for STM32 nucleo_f207zg in device tree.

Signed-off-by: Sidhdharth Yadav <sidhdharth.yadav@hcl.com>
2021-04-16 15:15:27 -05:00
Sidhdharth Yadav
c92775afbd dts: arm: stm32: Enable PWM support for STM32F2 in dtsi
Enabling PWM on timer1 for STM32F2 platform in dtsi.

Adding other timers nodes for PWM capability.

Signed-off-by: Sidhdharth Yadav <sidhdharth.yadav@hcl.com>
2021-04-16 15:15:27 -05:00
Jordan Yates
c6cc927506 scripts: gen_relocate_app.py: fix undefined _ADDR
With the addition of #34185, it is not longer gauranteed that for a
memory region `NAME` there exists a symbol `NAME_ADDR`. Use the linker
builtin function `ORIGIN` to instead directly get the start address of
the selected memory region.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-04-16 14:44:10 -05:00
Carles Cufi
f86e8a66d8 random: rand32_timer: Avoid alignment faults by using memcpy
The previous implementation assumed that the dst pointer was always
aligned to a 4-byte boundary in platforms that require alignment for
storage of 32-bit integers. Since this is required for certain platforms
(eg. Arm Cortex-M0), use memcpy() instead, which always takes
alignment into account.

Fixes #33969.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2021-04-16 15:34:59 -04:00
Trond Einar Snekvik
286d9c22cd Bluetooth: Mesh: Convert beacon timer to delayable work
Moves the beacon_enabled check in the beacon work handler to check the
beacon flag before sending anything, in case a cancel call fails.

Split out from #33782.

Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
2021-04-16 15:34:30 -04:00
Jonathan Rico
545938ea55 Bluetooth: host: Accept keypress notifications as responder
Ignore peer keypress notifications as a responder, allowing the pairing
procedure to continue instead of being aborted.

The Bluetooth LE specification does not specify a behavior, the
implementation has the choice of ignoring or aborting.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2021-04-16 15:34:06 -04:00
Trond Einar Snekvik
777718ea6e Bluetooth: Mesh: move lpn logic for msg_received inside lpn.c
The Transport layer implements some checks surrounding the
lpn_msg_received call, with an accompanying comment that explains the
logic. Move this inside the msg_received call instead.

Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
2021-04-16 15:33:09 -04:00
Trond Einar Snekvik
f54ca2fefd Bluetooth: Mesh: LPN: Rework poll timeout scheduling
Switch to the new delayed work API. Puts the scheduling for the next
poll in the response_received function instead of cancelling it, then
optionally scheduling it again later.

Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
2021-04-16 15:33:09 -04:00
Krzysztof Kopyściński
97f992c470 Bluetooth/tester: connect L2CAP using Enhanced Credit Flow Control
This change adds field to L2CAP connect command allowing to choose
ECFC in L2CAP connect() function and adds required logic to perform
such connection.

Signed-off-by: Krzysztof Kopyściński <krzysztof.kopyscinski@codecoup.pl>
2021-04-16 15:32:48 -04:00
Maik Vermeulen
4d85426688 net: lwm2m: Made pmin and pmax attributes optional
Made the LwM2M engine checks for pmin and pmax optional to adhere to
the LwM2M specificattion. We now first check that pmin and pmax are
actually set. Also changed the default CONFIG values for the attributes
pmin and pmax to 0 to indicate that they are not active by default.

Fixes #34329.

Signed-off-by: Maik Vermeulen <maik.vermeulen@innotractor.com>
2021-04-16 15:32:04 -04:00
Trond Einar Snekvik
bf942bdf9a Bluetooth: Mesh: Report configured LPNTimeout in cfg_srv
Changes lpn_timeout_get behavior in the config server to report the
configured LPN timeout, instead of the currently remaining timeout time.
According to the Bluetooth Mesh Profile specification, section 4.2.21,
the PollTimeout list is a list of the PollTimeout timer values, and
according to table 4.32 in this section, values 1-9 are prohibited.
Although this is not explicitly stated, this indicates that the
PollTimeout value is the configured poll timeout time - not the time
remaining until the timeout value expires. This patch changes the
implementation to reflect this.

Split out from #33782.

Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
2021-04-16 15:31:38 -04:00
Anas Nashif
bc747e7167 tracing: remove cpu_stats in favor of thread runtime stats
Removing CONFIG_TRACING_CPU_STATS in favor of
CONFIG_THREAD_RUNTIME_STATS which provides per thread stats. The same
functionality is also available when Thread analyzer is enabled with the
runtime stats enabled.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-04-16 15:31:24 -04:00
Jorgen Kvalvaag
36d96d2cd9 twister: Allow deep folder scan
Upon discovery of a sample/testcase.yaml file, twister will disregard
further subfolders. Given the folder structure below, the testcase.yaml
will currently not be discovered:

samples/sample1/
samples/sample1/sample.yaml
samples/sample1/tests/
samples/sample1/tests/testcase.yaml

This is desirable to allow placing test code closer to sample code.

Signed-off-by: Jorgen Kvalvaag <jorgen.kvalvaag@nordicsemi.no>
2021-04-16 15:46:09 +02:00
Ioannis Glaropoulos
88ae27fa16 samples: psa_level1: add nucleo_l552ze_q_ns to allowed platforms
Add nucleo_l552ze_q_ns boards to the list of platforms
that can build and run the psa_level1 tf-m integration
sample. We add a dts overlay as well.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2021-04-16 13:33:32 +02:00
Ioannis Glaropoulos
735f40b330 boards: do not force TF-M isolation level 2 for STM32L562/L552 boards
We do not need to force TFM Isolation Level 2 for the
STM32 board that can build with TM-M. We remove the
respective Kconfig setting. We also remove the Kconfig
overlay for STM32L562 board in the psa_level1 sample,
which was used for forcing Isolation Level 1; this is
not needed any more.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2021-04-16 13:33:32 +02:00
Ioannis Glaropoulos
e75ff8f7fb modules: trusted-firmware-m: fix dependencies for isolation level
Do not allow the TFM_ISOLATION_LEVEL to be non-hidden option,
if the TFM_IPC (PSA_API) option is not set, since, in that case,
only Isolation Level 1 is supported.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2021-04-16 13:33:32 +02:00
Jim Shu
81b0bdfa99 board: riscv: add qemu_riscv32_xip board to test XIP mode
Add a variant riscv build target that only is run for tests tagged
with "xip".

Signed-off-by: Jim Shu <cwshu@andestech.com>
2021-04-16 12:26:10 +02:00
Peter Bigot
67808279fb drivers: flash: spi_nor: support devices that default to protect blocks
Some SPI NOR devices, particularly Atmel and SST, power-up with block
protect bits set in the status register.  These bits must be cleared
before any erase or program operation can succeed.  However, blindly
clearing bits in SR is wrong as some of these are non-volatile and
control chip behavior, including quad-enable.

Add a devicetree flag to identify device-specific BP bits in the status
register that should be cleared on startup only for devices that need
them, and when set do the clear during initialization.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2021-04-16 12:23:06 +02:00
Peter Bigot
060204a6ae drivers: flash: spi_nor: document caller requirements
Add the standard note to two functions that require the caller to have
first acquired the device.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2021-04-16 12:23:06 +02:00
Peter Bigot
01fbe40fd4 drivers: flash: spi_nor: clean up ready detection
Reads would wait until the device was ready before issuing the first
command; writes and erases did not.  Fix this documenting and changing
so that wait-for-ready is invoked only where needed, i.e. to confirm
that a WRITE_STATUS, ERASE, or PROGRAM operation has completed before
proceeding to allow more commands to be submitted.  This matches Linux
spi_nor driver behavior.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2021-04-16 12:23:06 +02:00
Armando Visconti
2846283f84 drivers/sensor: iis2mdc: (FIX) Remove SPI Full Duplex mode
The IIS2MDC sensor does not support the SPI 4 wires. So, remove
it from the driver.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2021-04-16 12:21:11 +02:00
Armando Visconti
4df7af583a drivers/sensor: iis2mdc: Add multi-instance support
Make this driver multi-instance and use the new API.
This commit makes use of the new helpers introduced in #30536.

In particular:
    - get bus devices with DEVICE_DT_GET
    - get SPI information with SPI_CONFIG_DT_INST
    - get drdy gpios with GPIO_DT_SPEC_GET

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2021-04-16 12:21:11 +02:00
Arvin Farahmand
b8f5968a42 cmake: gcc/clang: enable colour diagnostics in terminal output
When compiler results are piped through a non-terminal (e.g. ninja)
the compiler disables colour diagnostics. Using `-fdiagnostics-color`
forces the compiler to enable colour output. This flag is set for
clang and gcc when `ZEPHYR_BUILD_COLOUR_DIAGNOSTIC` environment
variable is set when a clean build is started.

Signed-off-by: Arvin Farahmand <arvinf@ip-logix.com>
2021-04-16 12:20:53 +02:00
Johann Fischer
d8bbd2ad5c tests: regulator: add integration platform
Add nrf52840dk_nrf52840 as integration platform since
there is already devicetree overlay for that.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-04-16 09:45:35 +02:00
Johann Fischer
44c3053c4b drivers: regulator: do not explicitly enable fixed regulator driver
Do not explicitly enable fixed regulator driver for boards and tests
because it is automatically selected when corresponding node
is defined.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-04-16 09:45:35 +02:00
Johann Fischer
b142a47f73 drivers: regulator: enable driver when compatible node is defined
Add regulator compatibility string to Kconfig.fixed file
and allow fixed regulator driver to be enabled when compatible
node is defined. However, remove this option from common Kconfig
as it is legitimate to enable/disable regulator support.

Change menuconfig REGULATOR_FIXED to config since this
menu nesting is not necessary.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-04-16 09:45:35 +02:00
Pieter De Gendt
3ee5f427e6 drivers: flash: mcux flexspi nor: copy data to RAM buffer on write
This feature prevents issues when trying to write data to the flash
device that is located on or addressed at the same flash device.

An example is the mcuboot logic that writes a magic number to
the secondary partition header.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2021-04-15 16:26:39 -05:00
Pieter De Gendt
bd67c2375f drivers: flash: mcux flexspi nor: Fix write if size > SPI_NOR_PAGE_SIZE
This fixes a bug in the write function of the MCUX FlexSPI flash driver
if the length of the data is larger than a single page.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2021-04-15 16:26:39 -05:00
Pieter De Gendt
f5f502893d dts: add erase/write block sizes for imx rt1064 internal flash
This allows signing the binary for use with mcuboot

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2021-04-15 16:26:39 -05:00
Pieter De Gendt
97179c12bc soc: nxp_imx: Disable IVT/DCD when building for mcuboot
The bootloader application itself should contain the IVT/DCD
in the header, but the chainable application doesn't.

The ROM_START_OFFSET defaults to 0x400 otherwise the linker
alignment isn't taken into account.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2021-04-15 16:26:39 -05:00
Pieter De Gendt
add98e766a drivers: flash: Support i.MX FlexSPI NOR driver with XIP
This change allows writing to the flash while running in XIP mode,
and enables mcuboot or NVS settings to be used on i.MX RT socs.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2021-04-15 16:26:39 -05:00
Ioannis Glaropoulos
13cde704e9 tests: arm_no_multithreading: confirm IRQ index being non-negative
Check that the index returned by the function that looks
for an available IRQ line is non-negative, and do not just
rely on catching this with an ASSERT. That suppresses a
Coverity out-of-bounds warning.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2021-04-15 15:10:51 -05:00
Trond Einar Snekvik
5c6df442ff Bluetooth: Mesh: Transport length checks should account for MIC
The Transport layer would previously rely on the access layer to check
whether there's room for the full message and a MIC in the available
buffer space, and its own checks would ignore the MIC. This should be
handled by the Transport layer checks, so the access layer doesn't have
to.

Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
2021-04-15 20:31:44 +02:00
Trond Einar Snekvik
820cfc52ad Bluetooth: Mesh: Rework publication timer
Periodic publication would previously build and send the first
publication inside the bt_mesh_model_pub() function, before cancelling
and rescheduling the next publication. The timer handler would only
handle retransmissions, and would abandon the rest of the publication
event if one of the packets failed to send.

This design has three issues:
- If the initial timer cancel fails, the publication would interfer with
  the periodic publication management, which might skip an event or
  send too many packets.
- If any of the messages fail to publish, the full publication event
  would be abandoned. This is not predictable or expected from the API.
- bt_mesh_model_pub() required 384 bytes of stack to build the message,
  which has to be factored into all calling threads.

This patch moves all transmission into the publication timer by
replacing k_work_cancel with a single k_work_reschedule(K_NO_WAIT). It
also changes the error recovery behavior to attempt to finish the full
publication event even if some of the transmissions fail.

Split out from #33782.

Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
2021-04-15 20:31:44 +02:00
Anas Nashif
fe3fcede10 doc: smp: use doxygen references
Use :c:func:`..`` where possible to reference documented APIs

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-04-15 14:04:05 -04:00
Anas Nashif
77ee832f2e doc: rename Random -> RNG
Random alone in the TOC is misleading and confusing, so be more
specific.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-04-15 14:04:05 -04:00
Anas Nashif
193c5913a6 doc: modbus: remove extra level in the docs
We had one extra level in the docs, reduce and show modbus details
directly instead of the extra step.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-04-15 14:04:05 -04:00
Anas Nashif
e616a54d08 doc: enable doxygen for CONFIG_TIMING_FUNCTIONS
This was missed and APIs were not showing in final docs.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-04-15 14:04:05 -04:00
Anas Nashif
d31d6ce0be doc: strcutures: use doxygen to reference functions
Use :c:func:`..` possible to reference and link doxygen documentation.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-04-15 14:04:05 -04:00
Anas Nashif
e9662c8cf4 docs: structures: move ring buffer
We had duplicate entries for ring buffer, merge them into one document.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-04-15 14:04:05 -04:00
Anas Nashif
a7f570692f doc: group data structure docs and add doxygen linkage
Move out of misc/ and put in own folder and add the grouping to doxygen
to be able to reference the doxygen docs into RST.
Move each item into their own file to reduce clutter and to make it
less crowded in one single page.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-04-15 14:04:05 -04:00
Anas Nashif
c355b7e7a5 kernel: move workqueue API reference
Move workqueue doxygen docs to its own group and reference that in RST
under the workqueue section.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-04-15 14:04:05 -04:00
Peter Bigot
2ac596b91a usb: conversion of k_work API
Replace all existing deprecated API with the recommended alternative.

Be aware that this does not address architectural errors in the use
of the work API.

Fixes #34092

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-04-15 12:29:34 -04:00
Peter Bigot
28a7309017 samples: led_sx1509b: update to new work API
All this needs is a basic periodic submission.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2021-04-15 10:44:08 -05:00
Ioannis Glaropoulos
345bf8fb64 boards: nrf9160 DK: update board documentation for TF-M
Minor updates to the documentation of the nRF9160 DK
board, stressing that TF-M is the default Secure
firmware binary for non-secure nRF9160 builds.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2021-04-15 17:36:51 +02:00
Ioannis Glaropoulos
5f2b0f9147 boards: nrf9160: update secure image SRAM size to work with TF-M
Update the default Secure SRAM partition size for nRF9160,
so it aligns with the default TF-M secure partition size.
Also, change the DeviceTree node name from "bsd" to "modem",
to align with how the respective library component is named.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2021-04-15 17:36:51 +02:00