Commit graph

46813 commits

Author SHA1 Message Date
Kumar Gala
055a01b962 drivers: ps2: Convert drivers to new DT device macros
Convert ps2 drivers to use new DT variants of the DEVICE APIs.
    DEVICE_AND_API_INIT -> DEVICE_DT_DEFINE
    DEVICE_GET -> DEVICE_DT_GET

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-12-15 15:17:59 -06:00
Kumar Gala
640437003f drivers: peci: Convert drivers to new DT device macros
Convert peci drivers from:

	DEVICE_AND_API_INIT -> DEVICE_DT_INST_DEFINE

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-12-15 15:17:59 -06:00
Kumar Gala
3dfcdd81e1 drivers: espi: Convert drivers to new DT device macros
Convert espi drivers to use new DT variants of the DEVICE APIs.
    DEVICE_AND_API_INIT -> DEVICE_DT_DEFINE
    DEVICE_GET -> DEVICE_DT_GET

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-12-15 15:17:59 -06:00
Kumar Gala
c8fd75ba29 drivers: ec_host_cmd_periph: Convert drivers to new DT device macros
Convert ec_host_cmd_periph drivers from:

	DEVICE_AND_API_INIT -> DEVICE_DT_INST_DEFINE

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-12-15 15:17:59 -06:00
Kumar Gala
07d1e4a45b disk: sdhc: Convert drivers to new DT device macros
Convert sdhc drivers from:

	DEVICE_AND_API_INIT -> DEVICE_DT_INST_DEFINE
	DEVICE_DECLARE -> DEVICE_DT_INST_DECLARE

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-12-15 15:17:59 -06:00
Kumar Gala
f19e36f4a6 drivers: lora: Convert drivers to new DT device macros
Convert lora drivers from:

        DEVICE_AND_API_INIT -> DEVICE_DT_INST_DEFINE

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-12-15 15:17:59 -06:00
Anas Nashif
6be5e02923 actions: use descriptive job names
Use descriptive and unique job names, otherwise we end up with those
showing up in different location with no way to know which is which.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-12-15 14:47:26 -05:00
Andrew Boie
0a791b7a09 x86: mmu: clarify physical/virtual conversions
The page table implementation requires conversion between virtual
and physical addresses when creating and walking page tables. Add
a phys_addr() and virt_addr() functions instead of hard-casting
these values, plus a macro for doing the same in ASM code.

Currently, all pages are identity mapped so VIRT_OFFSET = 0, but
this will now still work if they are not the same.

ASM language was also updated for 32-bit. Comments were left in
64-bit, as long mode semantics don't allow use of Z_X86_PHYS_ADDR
macro; this can be revisited later.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-12-15 14:16:51 -05:00
Seppo Takalo
3492e8e248 tests: socket: getaddrinfo: Add tests for getaddrinfo() with NULL host
Also improve test coverage on hints, when queried with numerical
host.

Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
2020-12-15 19:22:50 +02:00
Seppo Takalo
f684b7c6cd net: getaddrinfo: Fix getaddrinfo() to respect socket type hints
If getaddrinfo() was called with AI_PASSIVE flag in hints,
returned address defaulted to SOCK_STREAM and IPPROTO_TCP.
Fixed so that SOCK_DGRAM leads to correct address type
that can be fed to bind() directly.

Same hard coding was visible when numerical IPv4 address string
was converted to binary. That is also fixed to respect hints now.

Also, added functionality to get IPv6 address, when hints contained
AF_INET6.

Fixes #30686

Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
2020-12-15 19:22:50 +02:00
Andrzej Głąbek
b7ce849307 drivers: adc: Make all API functions available
Change the way the `adc_read_async()` function is defined so that
the function is always available and appears in the generated
documentation but returns `-ENOTSUP` when `CONFIG_ADC_ASYNC` is not
enabled.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2020-12-15 10:10:28 -05:00
Eugeniy Paltsev
8d9fa56093 ARC: boards: hsdk: disable XIP
XIP (eXecute In Place) is a method of executing programs directly
from long term storage (i.e flash memory). It allows us to
avoid copying text it into RAM, saving writable memory for dynamic
data and not the static program code.

We don't have such non-volatile memory capable for executing in
place on HSDK so we load Zephyr image to DDR memory with debugger
each time.

Disable XIP option for HSDK as we don't need it.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
2020-12-15 09:22:34 -05:00
Marcin Niestroj
bc5a6164c9 drivers: pwm: nrf_sw: support generating PWM based on RTC
So far nRF's TIMER was used for generating PWM signal. Add support for
generating PWM based on RTC, which is sourced by 32KHz low frequency
crystal. This allows to use low frequency PWM with much lower power
consumption, because high frequency clock path can be disabled.

Don't support RTC clock prescaler, because maximum 512s period covers
most use cases. This allows to adjust pulse and period cycles to the
fact that CLEAR task event is generated always one LFCLK cycle after
period COMPARE value is reached.

Also update hal_nordic revision, as it contains updated check for PPI
channels conflict when RTC is used to generate PWM.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-12-15 15:19:43 +01:00
Marcin Niestroj
0d58960abb drivers: pwm: nrf_sw: convert to timer phandle instead instance number
So far 'timer-instance' DT property was the way to configure TIMER which
was used for generating PWM signal. Replace that by using 'generator'
phandle, so we get prepared for supporting RTC instances as PWM signal
generator.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-12-15 15:19:43 +01:00
Marcin Niestroj
4f868cd9fa drivers: pwm: nrf_sw: drop broken runtime timer clock scaling
There is some kind of runtime clock scaling implemented when period
cycles exceed 16-bit value. This is broken, because configured PWM has
far higher frequency in that case. Replace that mechanism with simply
veryfying if requested PWM period does not exceed 16-bit value.

Suggested-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-12-15 15:19:43 +01:00
Kumar Gala
6808d29baf drivers: dac: Convert drivers to new DT device macros
Convert dac drivers from:

        DEVICE_AND_API_INIT -> DEVICE_DT_INST_DEFINE

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-12-15 08:04:04 -06:00
Torsten Rasmussen
a019b6f280 cmake: using zephyr_get_compile_options_for_lang_as_string for export
Fixes: #30712

Now using zephyr_get_compile_options_for_lang_as_string for makefile
export of Zephyr build flags.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2020-12-15 08:37:54 -05:00
Alexey Brodkin
853e52472d board: arc: hsdk_2cores: Re-add missing taps into JTAG chain
On introduction of a "simplified" HSDK configuration where we only
use 2 cores out of 4 (in assumption that it will be working much
more reliably) we excluded a bit too much of details from OpenOCD script.

In particular we stripped not-used cores from JTAG chain description
which made OpenOCD quite unhappy:
----------------------------->8----------------------------
Info : ftdi: if you experience problems at higher adapter clocks, try the command "ftdi_tdo_sample_edge falling"
Info : clock speed 10000 kHz
Info : JTAG tap: arc-em.cpu2 tap/device found: 0x200c24b1 (mfg: 0x258 (ARC International), part: 0x00c2, ver: 0x2)
Warn : JTAG tap: arc-em.cpu2       UNEXPECTED: 0x200c24b1 (mfg: 0x258 (ARC International), part: 0x00c2, ver: 0x2)
Error: JTAG tap: arc-em.cpu2  expected 1 of 1: 0x200424b1 (mfg: 0x258 (ARC International), part: 0x0042, ver: 0x2)
Info : JTAG tap: arc-em.cpu1 tap/device found: 0x200824b1 (mfg: 0x258 (ARC International), part: 0x0082, ver: 0x2)
Warn : JTAG tap: arc-em.cpu1       UNEXPECTED: 0x200824b1 (mfg: 0x258 (ARC International), part: 0x0082, ver: 0x2)
Error: JTAG tap: arc-em.cpu1  expected 1 of 1: 0x200024b1 (mfg: 0x258 (ARC International), part: 0x0002, ver: 0x2)
Info : JTAG tap: auto0.tap tap/device found: 0x200424b1 (mfg: 0x258 (ARC International), part: 0x0042, ver: 0x2)
Info : JTAG tap: auto1.tap tap/device found: 0x200024b1 (mfg: 0x258 (ARC International), part: 0x0002, ver: 0x2)
Error: Trying to use configured scan chain anyway...
----------------------------->8----------------------------

That lead us to the situation when the target cores were programmed
in a wrong way effectively failing all tests. Fixing it now.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
2020-12-15 08:36:50 -05:00
Alexey Brodkin
de668aa692 board: arc: hsdk*: Accommodate upstream OpenOCD for ARC
During review of ARC port of OpenOCD some changes were requested
in particular:
1. L2 cache (SLC in ARC parlance) semantics, see
   http://openocd.zylin.com/#/c/5688/

2. JTAG probe interface (AKA "adapter") setup, see
   http://openocd.zylin.com/#/c/5784/

And so we need to change OpenOCD scripts accordingly to match
newer OpenOCD version from Zephyr's SDK v0.12.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
2020-12-15 08:36:50 -05:00
Daniel Leung
8ad5ad2214 kernel: don't unlock and then lock immediately in idle loop
Inside the idle loop, in some configuration, IRQ is unlocked and
then immediately locked again. There is a side effect:

1. IRQ is unlocked in middle of the loop.
2. Another thread (A) can now run so idle thread is un-scheduled.
3. Thread A runs to its end and going through the thread
   self-abort path.
4. Idle thread is rescheduled again, and continues to run
   the remaining loop when it eventuall calls k_cpu_idle().
   The "pending abort" path is not being executed on thread A
   at this point.
5. Now, thread A is suspended, and the CPU is in idle waiting
   for interrupts (e.g. timeouts).
6. Thread B is waiting to join on thread A. Since thread A has
   not been terminated yet so thread B is waiting until
   the idle thread runs again and starts executing from
   the beginning of while loop.
7. Depending on how many threads are running and how active
   the platform is, idle thread may not run again for a while,
   resulting in thread B appearing to be stuck.

To avoid this situation, the unlock/lock pair in middle of
the loop is removed so no rescheduling can be done mid-loop.
When there is no thread abort pending, it simply locks IRQ
and calls k_cpu_idle(). This is almost identical to the idle
loop before the thread abort code was introduced (except
the check for cpu->pending_abort).

Fixes #30573

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2020-12-15 08:27:27 -05:00
Hubert Miś
d35d26d250 drivers: ieee802154: Reserve TIMER used by 802.15.4 driver
Use new Kconfig structure to marks which TIMER peripheral is reserved by
802.15.4 radio driver. It prevents peripheral usage collisions.

Signed-off-by: Hubert Miś <hubert.mis@nordicsemi.no>
2020-12-15 11:22:56 +01:00
Watson Zeng
0bc64a7946 tests: tls: add toolchain filter
tls rely on both arch has tls and toolchain support tls, add filter:
CONFIG_TOOLCHAIN_SUPPORTS_THREAD_LOCAL_STORAGE for
some tests enabled tls.

Signed-off-by: Watson Zeng <zhiwei@synopsys.com>
2020-12-15 11:22:38 +01:00
Peter Bigot
54d8c40340 drivers: video_common: fix build errors on mimxrt1064_evk
Add a missing keyword in a variable declaration and correct the type
in a missed declaration.  Also use a more appropriate upper bound in a
loop.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-12-15 11:22:22 +01:00
Puranjay Mohan
acfb2ace1d drivers: sensor: tmp116: Correct dev_name to tmp116
The dev_name field in DEVICE_AND_API_INIT() call should match the
driver's name. Tmp116 driver had a wrong dev_name field.

Signed-off-by: Puranjay Mohan <puranjay12@gmail.com>
2020-12-15 11:21:04 +01:00
Joakim Andersson
d840f42b33 Bluetooth: host: Document the allowed disconnect reasons.
Document the disconnect reasons that is allowed in the disconnect
command.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-12-15 11:20:34 +01:00
Joakim Andersson
39e14580e9 Bluetooth: controller: Validate disconnect reason in disconnect command
Validate the disconnect reason in the disconnect command, according
to the the core specification.

7.1.6 Disconnect command:
Authentication Failure error code (0x05), Other End Terminated Connec-
tion error codes (0x13 to 0x15), Unsupported Remote Feature error code
(0x1A), Pairing with Unit Key Not Supported error code (0x29) and Unac-
ceptable Connection Parameters error code (0x3B).

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-12-15 11:20:34 +01:00
Joakim Andersson
9205fe0a3a Bluetooth: host: Return error code if disconnect has invalid parameters
Return the error code from the disconnect command to the application
when an invalid disconnect reason has been provided.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-12-15 11:20:34 +01:00
Joakim Andersson
068af16e18 tests: bluetooth: Use a valid disconnect reason
Update test_connect1 test case to use a valid disconnect reason.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-12-15 11:20:34 +01:00
Joakim Andersson
353bfc0fc1 west.yml: Update EDTT version to include disconnect reason fixes
Update EDTT version to include disconnect reason fixes.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-12-15 11:20:34 +01:00
Øyvind Rønningstad
0cb6c409be west.yml: Update TFM module SHA to bring in TFM MCUboot update.
Turn on import, so tfm's west.yml is processed.

Signed-off-by: Øyvind Rønningstad <oyvind.ronningstad@nordicsemi.no>
2020-12-15 11:19:39 +01:00
Peter Bigot
11c923cfc8 boards: efr32mg_sltb004a: rework sensor power enable infrastructure
There are three groups of sensors on this board, each of which
requires a different I2C bus configuration and a different power
supply.  Currently only the CCS811 is supported.

Change the board configuration to pull the necessary information about
the CCS811 supply switch from devicetree, and to supply power based on
whether the device is enabled in devicetree (rather than whether a
driver is selected).  The implementation is designed to support
additional supply switches (there are at least six on the board, most
of which are dedicated).

Also document the I2C configuration necessary for the other sensors.
There is currently no way to select alternative configurations without
editing the devicetree binding, but at least they're available for use
in overlays.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-12-15 11:19:26 +01:00
Peter Bigot
c70cc93833 drivers: i2c_gecko: refactor to unify device definition
Switch to iterated definition based on indexes.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-12-15 11:19:26 +01:00
Peter Bigot
ade3ef3ef7 devicetree: fix base power supply-gpios
This should have been a phandle-array since it's a full GPIO specifier
including pin and flags.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-12-15 11:19:26 +01:00
Fabio Utzig
76bfc02345 doc: add initial mcumgr documentation
Add an initial mcumgr documentation to the device management guide,
avoiding the need to redirect a user to the upstream documentation.

Signed-off-by: Fabio Utzig <fabio.utzig@nordicsemi.no>
2020-12-15 11:19:01 +01:00
Meng xianglin
04d8d485e8 test: fs: improve code coverage for file system core
Refine test cases to improve code coverage

Signed-off-by: Meng xianglin <xianglinx.meng@intel.com>
2020-12-15 11:17:54 +01:00
Jukka Rissanen
9080a46e68 net: tcp2: Use mutex instead of irq_lock
When needing to lock non-connection related access, use k_mutex
instead of locking irq. There is really no reason to prevent the
system from generating interrupts.

Fixes #30636

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-12-15 12:16:19 +02:00
Alexander Wachter
2331d10d4b include: sys: thread_stack add missing extern "C" on C++
Add C linkage for compiling with C++

Signed-off-by: Alexander Wachter <alexander.wachter@leica-geosystems.com>
2020-12-15 11:13:41 +01:00
Daniel Leung
55df308025 Revert "boards/x86: Enable Intel VT-D for up_squared"
This reverts commit 7492841dd1.

Enabling CONFIG_INTEL_VTD_ICTL on UP Squared board results
in tests and apps hanging. So revert this for now.

Relates to #30574

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2020-12-14 23:21:41 -05:00
Marcin Niestroj
94be9b387a drivers: pwm: nrf_sw: use Nordic HAL to configure GPIO
Use Nordic HAL to configure GPIO output. This adds support for P1 GPIOs,
when pin numbers above 31 are used.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-12-14 20:23:43 -05:00
Maciej Perkowski
5bb0d9877c ci: Rename leftover Sanitycheck occurances
Rename leftovers in buildkite script

Signed-off-by: Maciej Perkowski <Maciej.Perkowski@nordicsemi.no>
2020-12-14 16:46:44 -05:00
Anas Nashif
7883eedfde doc: rename sanitycheck -> twister
Replace leftover sanitycheck mentions.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-12-14 14:13:16 -05:00
Anas Nashif
17b09c2761 ci: rename sanitycheck -> twister
Replace leftover sanitycheck mentions.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-12-14 14:13:16 -05:00
Anas Nashif
4594370b46 twister: remove some leftover sanitycheck mentions
Few leftover mentions of Sanitycheck.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-12-14 14:13:16 -05:00
Thomas Stranger
86c872dbc5 tests: i2c: i2c_slave_api add nucleo_g071
Adds necessary overlays for nucleo_g071 in i2c_slave_api test case
and enables the board.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2020-12-14 13:17:46 -05:00
Thomas Stranger
03923ce9de boards: nucleo_g071rb enable i2c
Enables I2C on nucleo_g071rb board.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2020-12-14 13:17:46 -05:00
Yestin Sun
f7d866735e boards: stm32l562e_dk: Enable SPI and BLE
Enable spi1 interface that connects to STM module SPBTLE-RFTR on the
stm32l562e_dk board.

Tested the configuration with st_ble_sensor sample + ST BLE Sensor
app on Android phone.

Signed-off-by: Yestin Sun <sunyi0804@gmail.com>
2020-12-14 13:16:10 -05:00
Yestin Sun
87ff1513fa boards: stm32l562e_dk: Fix inverted GPIO flags for user LEDs
Fix the GPIO configurations for both user LEDs on the stm32l562e_dk
board that shall be active low.

Signed-off-by: Yestin Sun <sunyi0804@gmail.com>
2020-12-14 13:16:10 -05:00
Yestin Sun
6264788f6d soc: arm: st: Add spi to stm32l5 MCUs
Add spi1 interface for stm32l552xx and stm32l562xx microcontrollers

Signed-off-by: Yestin Sun <sunyi0804@gmail.com>
2020-12-14 13:16:10 -05:00
Anas Nashif
0ce662f29d doc: thread-analyzer: document THREAD_RUNTIME_STATS
Add details about THREAD_RUNTIME_STATS and how it can be used and
document how the feature can be used with an example.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-12-14 13:00:47 -05:00
Anas Nashif
802d214582 debug: analyzer: add support for thread runtime stats
Add thread runtime statistics to the thread analyser.

With CONFIG_THREAD_RUNTIME_STATS enabled:

Booting from ROM..*** Booting Zephyr OS build zephyr-v2.4.0-2330-g77be0e93e65b  ***
thread_a: Hello World from cpu 0 on qemu_x86!
Thread analyze:
 thread_b            : STACK: unused 740 usage 284 / 1024 (27 %); CPU: 0 %
 thread_analyzer     : STACK: unused 8 usage 504 / 512 (98 %); CPU: 0 %
 thread_a            : STACK: unused 648 usage 376 / 1024 (36 %); CPU: 98 %
 idle 00             : STACK: unused 204 usage 116 / 320 (36 %); CPU: 0 %
thread_b: Hello World from cpu 0 on qemu_x86!
thread_a: Hello World from cpu 0 on qemu_x86!
thread_b: Hello World from cpu 0 on qemu_x86!
thread_a: Hello World from cpu 0 on qemu_x86!
thread_b: Hello World from cpu 0 on qemu_x86!
thread_a: Hello World from cpu 0 on qemu_x86!
thread_b: Hello World from cpu 0 on qemu_x86!
thread_a: Hello World from cpu 0 on qemu_x86!
Thread analyze:
 thread_b            : STACK: unused 648 usage 376 / 1024 (36 %); CPU: 7 %
 thread_analyzer     : STACK: unused 8 usage 504 / 512 (98 %); CPU: 0 %
 thread_a            : STACK: unused 648 usage 376 / 1024 (36 %); CPU: 9 %
 idle 00             : STACK: unused 204 usage 116 / 320 (36 %); CPU: 82 %
thread_b: Hello World from cpu 0 on qemu_x86!

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-12-14 13:00:47 -05:00