Commit graph

51197 commits

Author SHA1 Message Date
Alberto Escolar Piedras
bcd43ff494 posix: Add missing include
The NATIVE_TASK macro uses macros from the toolchain header.
Instead of relaying on the header to be included by somebody else,
include it explicity here.

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2021-04-27 13:17:36 -04:00
Robert Lubos
afaf52af66 net: trickle: Do not initialize a work item from its handler
Initializing a work item from its handler will destroy the content of
the kernel structures used to process the work item. This can lead to a
system crash for example when the delayed work is being rescheduled when
the previous run is already queued for processing but not yet executed.

Fix this by initializing the work item once during trickle timer
creation and moving the logic, previously achieved by switching the work
handler, into the new work handler.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2021-04-27 19:48:16 +03:00
Anas Nashif
80116f1413 tests: benchmarks: footprints: this is not a test
Do not configure this as a test, this will change footprint drastically
and will skew results and tracking.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-04-27 12:15:14 -04:00
Gerson Fernando Budke
260c679af5 boards: arm: cy8ckit_062_ble: Add board rev
Introduce revision for cy8ckit_062_ble board.  Revision 0.0.0 represent
the original board schematic which connects Arduino header signals to
PSoC-6 KitProg.  The revision 1.0.0 should be used after board rework
to access other serial ports and full Arduino headers.

Signed-off-by: Gerson Fernando Budke <gerson.budke@atl-electronics.com>
2021-04-27 09:27:45 -05:00
Gerson Fernando Budke
2efa4db9e8 boards: arm: cy8ckit_062_wifi_bt: Add serial pinctrl and int
Add pinctrl and interrupt information for both cores.  The uart-6 is
the default serial communication on the kit connected to m0 core.  It
uses SCB[6] and the NVIC line 21 as interrupt source on Cortex-M0+ cpu.
The line 21 is an arbitrary value and users can select any value.  The
SCB[6] shares pins with Arduino headers D8/D9.  It may be necessary an
USB serial converter to sample signals and enable Zephyr console on PC.
The uart-5 is the default serial communication port for m4.  It is
connected to Arduino serial line.  A HW rework may need to allow
Arduino header to be useful.

Signed-off-by: Gerson Fernando Budke <gerson.budke@atl-electronics.com>
2021-04-27 09:27:45 -05:00
Gerson Fernando Budke
a24350a1a4 boards: arm: cy8ckit_062_ble: Add serial pinctrl and int
Add pinctrl and interrupt information for both m0/4 cores.  The uart-5
is the default serial communication on the kit and it is connected to
Cortex-M0+ cpu.  It uses SCB[5] and the NVIC line 21 as interrupt
source on Cortex-M0+ cpu.  The line 21 is an arbitrary value and users
can select any value.  The SCB[5] shares pins with Arduino headers
D0/D1 and it is wired with the on-board USB Serial converter.  This
means, if use wants use an external shield it must rework the board.
The uart-6 is the default serial communication for Cortex-M4 cpu, which
uses SCB[6].

Signed-off-by: Gerson Fernando Budke <gerson.budke@atl-electronics.com>
2021-04-27 09:27:45 -05:00
Gerson Fernando Budke
2bd130112a drivers: serial: psoc6: Add interrupts support
Current Cypress PSoC-6 serial driver only works using polling mode.
Add serial driver interrupt routines to allow use of interrupts.

Signed-off-by: Gerson Fernando Budke <gerson.budke@atl-electronics.com>
2021-04-27 09:27:45 -05:00
Gerson Fernando Budke
e6cba8d9c8 drivers: serial: psoc6: Rework to support pinctrl
The current serial driver uses hard code configuration.  Rework driver
to use pinctrl and enable full configuration from device tree.

Signed-off-by: Gerson Fernando Budke <gerson.budke@atl-electronics.com>
2021-04-27 09:27:45 -05:00
Marek Pieta
66b6f07ea3 tests: drivers: Add LED GPIO driver to build_all
Change adds LED GPIO driver to build_all test.

Signed-off-by: Marek Pieta <Marek.Pieta@nordicsemi.no>
2021-04-27 16:21:48 +02:00
Marek Pieta
a712c3622d drivers: led: Add LED GPIO driver
Change introduces LED GPIO driver.

Signed-off-by: Marek Pieta <Marek.Pieta@nordicsemi.no>
2021-04-27 16:21:48 +02:00
Krzysztof Chruscinski
2115964929 logging: Fix casting related C++ warnings
Fixed C++ warnings coming from implicit casting.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-04-27 08:48:03 -05:00
Krzysztof Chruscinski
d863b93516 lib: os: cbprintf: Prevent using _Generic in C++
Add guard to not use C11 specific feature when in C++.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-04-27 08:48:03 -05:00
Krzysztof Chruscinski
1f3758ff9e logging: Macro cleanup to fix cpp warnings
Cleanup to fix warnings coming from c++ compilation.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-04-27 08:48:03 -05:00
Henrik Brix Andersen
d6318075b7 boards: arm: twr_ke18f: Add pinctrl dts properties
Add pinctrl-0 properties for configuration of UART, I2C, SPI, FTM,
DAC, ADC, ACMP, and PWT peripherals. These settings are based on what
is defined in the board/pinmux.c file.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2021-04-27 08:43:23 -05:00
Peter Bigot
c26cdb7409 drivers: flash: spi-nor: add support for 4-byte addressing
Add a function that uses the JESD216 SFDP BFP DW16 Enter 4-Byte
Addressing parameter to put the device into 4-byte addressing mode if
one of the entry modes that's supported by the driver is available on
the device.

Perform the transition if SFDP data is provided (either by devicetree
or at runtime), or if a special devicetree property provides the entry
mode descriptor.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2021-04-27 14:21:15 +02:00
Peter Bigot
6c4312605c drivers: flash: jesd216: improve support for address size selection
Add a helper function to decode the address byte support data from the
SFDP BFP.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2021-04-27 14:21:15 +02:00
Peter Bigot
e0f514f670 drivers: flash: spi_nor: support 32-bit addresses in access method
Support both 24-bit and 32-bit address values when constructing the
device command.  Note that some commands require 24-bit address
regardless of mode, and some require 32-bit addresses regardless of
mode, so provide command-specific overrides of a generic (but not yet
configurable) default address size.

With this we no longer need a special interface for READ_SFDP which
uses a 24-bit address but with a wait state introduced by clocking out
a fifth command byte.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2021-04-27 14:21:15 +02:00
Peter Bigot
cde962e789 drivers: flash: spi_nor: refactor to allow more access options
This driver abstracts most access through a generic function that
supports both read and write with and without address components in
the command.  Rework this so that instead of distinct arguments
specifying the combination of features there's a flag set that will
allow more combinations to be specified.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2021-04-27 14:21:15 +02:00
Mario Jaun
c276088567 drivers: ethernet: stm32: SRAM3 / MPU configuration
Fixes #29915.

Implements the memory layout and MPU configuration for Ethernet buffers
for STM32H7 controllers as recommended by ST. 16 KB of SRAM3 are
are reserved for this. The first 256 B are for the RX/TX descriptors and
configured as strongly ordered, shareable memory. The rest is for RX/TX
buffers and configured as non cacheable memory. This configuration is
automatically applied for H7 chips if the SRAM3 memory is enabled in the
device tree.

Signed-off-by: Mario Jaun <mario.jaun@gmail.com>
2021-04-27 14:16:35 +02:00
Mario Jaun
43ef9013a8 arch: arm: add define REGION_RAM_NOCACHE_ATTR
Add a define for non cachaeable RAM for MPU region definitions.

Signed-off-by: Mario Jaun <mario.jaun@gmail.com>
2021-04-27 14:16:35 +02:00
Mario Jaun
100227cc85 linker: arm: add SRAM3/4 linker section
Add a linker section for SRAM3/4 if it is enabled in the device tree.

Signed-off-by: Mario Jaun <mario.jaun@gmail.com>
2021-04-27 14:16:35 +02:00
Mario Jaun
086c461edb dts: arm: st: h7: define SRAM1-4
Define SRAM1 to SRAM4 memory areas according to the physical memory
organization of the chips.

Signed-off-by: Mario Jaun <mario.jaun@gmail.com>
2021-04-27 14:16:35 +02:00
Ioannis Glaropoulos
cf631fe034 samples: rpmsg_service: use mps2_an521_remote target for remote core
When building and running the rpmsg_service sample on MPS2 AN521
use the mps2_an521_remote target to build the Zephyr image
for the remote core.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2021-04-27 13:40:42 +02:00
Ioannis Glaropoulos
7725699030 samples: openamp: use mps2_an521_remote target for remote core
When building and running the openamp sample on MPS2 AN521,
use the mps2_an521_remote target to build the Zephyr image
for the remote core.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2021-04-27 13:40:42 +02:00
Ioannis Glaropoulos
e04a57de04 boards: mps2_an521: remove dependencies for BUILD_WITH_TFM
We do not need to have dependencies any more on !OPENAMP
for BUILD_WITH_TFM in the mps2 an521 target, because we
now have different targets for the non-secure version of
the board and the remote core.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2021-04-27 13:40:42 +02:00
Ioannis Glaropoulos
de8af66057 boards: mps2_an521: add an mps2_an521_remote target
Add a new target for MPS2 AN521, called mps2_an521_remote.
This target is used in dual image MPS2 AN521 builds, for
the 'remote' target. It is indentical to mps2_an521_nonsecure,
except for the fact that it does not enable TrustZone-M and
it does not set the security domain to Non-Secure.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2021-04-27 13:40:42 +02:00
Erwan Gouriou
45418dedc0 CODEOWNERS: Add code owner for dts/common
Add @galak as codeowner for dts/common


Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-04-27 11:53:37 +02:00
Erwan Gouriou
2f42f51bd8 boards: stm32: nucleo_f429zi: Configure clocks using dt
Configure clock for these two boards using device tree.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-04-27 11:53:37 +02:00
Erwan Gouriou
a7989f64a3 drivers/clock_control: stm32: Configure CLOCK_STM32_HSE_CLOCK using dt
Kconfig symbol is used in hal_stm32 module to define Cube HAL
symbol HSE_VALUE (cf hal_stm32/stm32cube/CMakeLists.txt).
Due to this specific usage, this symbol should be kept. As a
consequence it could not be replaced by dts equivalent but we can
use dts to configure it.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-04-27 11:53:37 +02:00
Erwan Gouriou
5633fd4aba boards: disco_l475_iot1: Move to dt based clocks configuration
Configure disco_l475_iot1 clocks using device tree.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-04-27 11:53:37 +02:00
Erwan Gouriou
ac25135423 boards: stm32: nucleo_l476rg, nucleo_wb55rg: Configure clocks using dt
Configure clock for these two boards using device tree.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-04-27 11:53:37 +02:00
Erwan Gouriou
c4d3306042 soc/arm: st_stm32: Optionally Set SYS_CLOCK_HW_CYCLES_PER_SEC using dt
Optionally configure Kconfig SYS_CLOCK_HW_CYCLES_PER_SEC using
clock-frequency provided by dt if sysclk node is enabled

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-04-27 11:53:37 +02:00
Erwan Gouriou
3b51069e5a dts/arm: stm32: Add clocks nodes on stm32wb,l4 and stm32f4 series
Provided nodes reflect the clock tree of each series.
Clock nodes are disabled by default but populated with default
start up configuration. Main reason is the we don't want to
impact boards using Kconfig based clock configuration for now.
Exception to these rules:
- syslck: Default enabled, clock frequency and clock source not
provided
- pll: clock source not provided
This is made on purpose so that errors are triggered if parameters
essential to the board configuration are not provided.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-04-27 11:53:37 +02:00
Erwan Gouriou
f4b130ae29 dts/bindings: clocks: Add new STM32 clock bindings
Add dts bindings for new STM32 clock nodes.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-04-27 11:53:37 +02:00
Erwan Gouriou
2691541ad2 drivers/clock_controller: stm32: Prepare for dts based configuration
To allow transition to device tree based clock configuration on
stm32 targets, rework clock_control driver to use intermediate
STM32_ macros initially defined as the equivalent Kconfig macros
for now.
Propagate the change in all code using these macros.

The reason to introduce these new macros instead of configuring
Kconfig flags using dt kconfigfunctions is that we'll need
to be able to inform users that Kconfig flags are deprecated
once the whole family conversion is done, to encourage
out of tree users to adopt this new configuration scheme.

Note: For now STM32H7 series and code is excluded.
This is the same for some series specific code such as
PLL mul/div for L0/L1 and XTRE prescaler on F1 series.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-04-27 11:53:37 +02:00
Jukka Rissanen
698d12f4d2 net: pkt: Separate the timestamp and TX/RX stats configs
The timestamp is no longer depending on TX/RX time config
options so move it to separate settings.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2021-04-27 12:02:19 +03:00
Jukka Rissanen
91ff30513f tests: net: poll: Increase ztest thread stack size
The socket poll test was running out of ztest stack so increase
it by 256 bytes.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2021-04-27 12:02:19 +03:00
Jukka Rissanen
bd03493fdc net: pkt: Have separate create time for net_pkt
This value is used to measure the RX/TX statistics. The previous
use of the timestamp field did not work in RX path as the timestamp
value could be overwritten by the driver if gPTP timestamping
is enabled. So to fix the RX statistics, use a separate field
for the create time.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2021-04-27 12:02:19 +03:00
Jukka Rissanen
a9b3057f15 tests: net: ptp: Compile only on relevant boards
The tests need gPTP support so set the options and boards
properly.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2021-04-27 12:02:19 +03:00
Jukka Rissanen
3b08e87680 net: If userspace support is enabled, then we need TX/RX threads
If user enables CONFIG_USERSPACE, then at least one TX or RX thread
is needed to isolate the application from the kernel space components.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2021-04-27 12:02:19 +03:00
Jukka Rissanen
f5fb80750e net: Enable running without TX or RX threads
Set the default behaviour of the networking subsystem so that
no TX or RX threads are created. This will save RAM as there
is no need to allocate stack space for the RX/TX threads.
Also this will give small improvement to network packet latency
shown here:
* with 1 traffic class (1 TX and RX thread)

Avg TX net_pkt (42707) time 60 us	[0->22->15->22=59 us]
Avg RX net_pkt (42697) time 36 us	[0->10->3->12->7=32 us]

* with 0 traffic classes (no TX and RX threads)

Avg TX net_pkt (41608) time 42 us	[0->21->20=41 us]
Avg RX net_pkt (41593) time 31 us	[0->9->12->8=29 us]

In this qemu_x86 test run, 40k UDP packets was transferred between
echo-server and echo-client. In TX the speed increase was 30% and
in RX it was 14%.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2021-04-27 12:02:19 +03:00
Jukka Rissanen
ccadbe2e7d drivers: eth: e1000: Add simulated PTP clock device
For testing purposes, add simulated PTP clock device to e1000
Ethernet driver that is used in qemu_x86 board. The PTP clock
does nothing useful as there is no real hw behind this device.
We just emulate the clock in order to do some SO_TXTIME testing.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2021-04-27 12:02:19 +03:00
Jukka Rissanen
d533f95e18 net: pkt: Set the pkt creation time more accurately
Set the net_pkt creation time just before the actual net_pkt
is allocated in order to get more accurate information for
statistics.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2021-04-27 12:02:19 +03:00
Jukka Rissanen
476b1885ce drivers: eth: mcux: Separate PTP clock from gPTP support
It is possible that user wants to access PTP clock but does
not need gPTP support. The networking txtime sample does exactly
this.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2021-04-27 12:02:19 +03:00
Jukka Rissanen
567860a5e2 drivers: eth: gmac: Separate PTP clock from gPTP support
It is possible that user wants to access PTP clock but does
not need gPTP support. The networking txtime sample does exactly
this.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2021-04-27 12:02:19 +03:00
Jukka Rissanen
c59372b6e6 net: Push highest priority net_pkt directly to driver
If user has set the priority of the sent net_pkt to highest
priority (NET_PRIORITY_CA) and enabled CONFIG_NET_TC_SKIP_FOR_HIGH_PRIO
option, then push that packet directly to driver instead of TX queue.
This will make the TX sending latency smaller for the high priority
packet. This is not enabled by default.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2021-04-27 12:02:19 +03:00
Jukka Rissanen
1771cee065 samples: net: socket: txtime: Simple app for SO_TXTIME
This application shows how to use SO_TXTIME option, which can be
used to specify the time when the network packet should be sent
out by the network device driver.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2021-04-27 12:02:19 +03:00
David Leach
70edc3c1d0 tests: net: tcp2: Perform tests on DUMMY interface
Tests are designed to run over the DUMMY interface but when run on
hardware, net_if_get_default() can return the actual hardware
interface.

Fixes: #31969

Signed-off-by: David Leach <david.leach@nxp.com>
2021-04-27 12:00:14 +03:00
Jim Paris
e729e6db10 drivers: nrf: avoid UARTE pm infinite loop
If there is a UARTE receive error (e.g. framing or break), the RXTO
event may never come.  Check error event too, to avoid an infinite loop.

Signed-off-by: Jim Paris <jim@jim.sh>
2021-04-27 09:53:04 +02:00
Mulin Chao
2368aeae61 dts: pwm: npcx: add override mechanism for pwm input clock assignment.
This CL adds a override mechanism for pwm module's input clock source
assignment. If the 'clock-bus' property exists, the NPCX_DT_PROP_ENUM_OR
macro function will return an enum upper token value. Otherwise, it
expands to default value in 'clocks' property.

For example, if the users want to select LFCLK as pwm0's input clock,
ths node can be overridden by adding 'clock-bus' property with an enum
string, "NPCX_CLOCK_BUS_LFCLK".

&pwm0 {
	status = "okay";
	clock-bus = "NPCX_CLOCK_BUS_LFCLK";
};

Signed-off-by: Keith Short <keithshort@google.com>
Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2021-04-26 21:51:24 -04:00