Commit graph

41120 commits

Author SHA1 Message Date
Stephanos Ioannidis
07e9394dba sys: Explicitly include toolchain.h to check for endianness definitions.
This commit adds an explicit inclusion of toolchain.h from byteorder.h.

The endianness preprocessor definitions (__BYTE_ORDER__,
__ORDER_LITTLE_ENDIAN__, __ORDER_BIG_ENDIAN__) are used by byteorder.h;
these being not defined can easily go unnoticed and cause unexpected
behaviours, as detailed in PR #18922.

toolchain.h ensures that these preprocessor definitions are defined and
*must* be included in a file that uses these definitions.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2019-09-09 21:40:54 +02:00
Stephanos Ioannidis
33fbe002d0 kernel: Explicitly include toolchain.h to check for endianness definitions.
This commit adds an explicit inclusion of toolchain.h from kernel.h.

The endianness preprocessor definitions (__BYTE_ORDER__,
__ORDER_LITTLE_ENDIAN__, __ORDER_BIG_ENDIAN__) are used by kernel.h;
these being not defined can easily go unnoticed and cause unexpected
behaviours, as detailed in PR #18922.

toolchain.h ensures that these preprocessor definitions are defined
and *must* be included in a file that uses these definitions.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2019-09-09 21:40:54 +02:00
Stephanos Ioannidis
91e75075ae toolchain: Add global check for endianness preprocessor definitions.
This commit adds a global check for __BYTE_ORDER__,
__ORDER_LITTLE_ENDIAN__ and __ORDER_BIG_ENDIAN__ preprocessor
definitions that are used throughout the Zephyr codebase.

These preprocessor definitions being not defined can easily
go unnoticed and cause unexpected behaviours, as detailed in
PR #18922.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2019-09-09 21:40:54 +02:00
Olle Norelius
5a53e21966 scripts: dts: Fix generation of single-value phandle/value array
Put a type check in the offending method.
Now any scalar will be put in a list for
compatibility with following code.

Signed-off-by: Olle Norelius <norelius.olle@gmail.com>
2019-09-09 14:15:44 -05:00
Kumar Gala
80433e218a dts: rv32m1: Rework interrupt mux dts descriptions
Each intmux block acts like 8 interrupt controllers in which we can
have multiple device interrupts on a single channel and that channel
than interrupt than chained to another interrupt controller (in the
case of the RISC-V cores, it is the event unit).

So to describe things better to properly be able to walk the interrupt
chain in the device tree we treat each channel in the interrupt mux as
an interrupt controller rather than the intmux as a single interrupt
controller.

In the future this will allow the device tree generation code to walk
the interrupt chain from the device and up through any interrupt
controllers to generate the IRQ value that Zephyr expects (rather than
us hard coding this into the DTS).

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-09-09 13:47:20 -05:00
Yannis Damigos
ad3f56f044 usb_device: Fix typo in comment
Fix typo in comment

Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
2019-09-09 13:38:41 -05:00
Ulf Magnusson
cbb332369f kconfiglib: Expose parsing location to Python preprocessor functions
Update Kconfiglib (and menuconfig/guiconfig, just to sync) to upstream
revision f2ce282eca, to get this commit in:

    Allow preprocessor user functions to access the parsing location

    Just requires making Kconfig.filename/linenr public.

    'lineno' would be a more standard name, but be consistent with
    MenuNode.linenr.

This can be used to give friendly errors in
scripts/kconfig/kconfigfunctions.py, e.g. for
https://github.com/zephyrproject-rtos/zephyr/pull/18752.

Some minor optimizations are included too.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-09-09 19:48:44 +02:00
Michał Oleszczyk
e4ed17472f driver/sensor: lis2dw12: single/double tap trigger implementation
Implementation for two new interrupt triggers: single tap and
double tap. Add new Kconfig options to configure those triggers:
trigger mode (single/single and double), latency/quiet/shock time,
threshold levels, active axes.

Signed-off-by: Michał Oleszczyk <oleszczyk.m@gmail.com>
2019-09-09 10:52:57 -05:00
Ulf Magnusson
58b46d7089 dts: binding-template.yaml: Document how 'type: boolean' works
It's a bit subtle in that it's the only type where a property can
generate output even if it doesn't exist.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-09-09 08:47:49 -05:00
Ulf Magnusson
ff1f75293e dts: edtlib: Support giving missing properties a default value
For missing optional properties, it can be handy to generate a default
value instead of no value, to cut down on #ifdefs.

Allow a default value to be specified in the binding, via a new
'default: <default value>' setting for properties in bindings.
Defaults are supported for both scalar and array types. YAML arrays are
used to specify the value for array types.

'default:' also appears in json-schema, with the same meaning.

Include misc. sanity checks, like the 'default' value matching 'type'.

The documentation changes in binding-template.yaml explain the syntax.

Suggested by Peter A. Bigot in
https://github.com/zephyrproject-rtos/zephyr/issues/17829.

Fixes: #17829
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-09-09 08:47:49 -05:00
Johan Hedberg
c333e8e8a4 Bluetooth: Mesh: Fix matching for "All Proxies" group address
The bt_mesh_fixed_group_match() function is intended to match the
various well-known group addresses, however it was never updated when
Proxy support was added.

Fixes #19015

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2019-09-09 13:03:47 +03:00
Trond Einar Snekvik
110332cad9 Bluetooth: Mesh: Make unicast elem lookup O(1)
As element addresses are sequential, there's no need for iterating
through the elements to find the one matching a unicast address.

Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
2019-09-09 11:14:30 +03:00
Ulf Magnusson
247d40cf55 gen_isr_tables: Fix pylint warning by using isinstance()
Fix this warning, as a preparation for a CI check:

    arch/common/gen_isr_tables.py:167:11: C0123: Using type() instead of
    isinstance() for a typecheck. (unidiomatic-typecheck)

isinstance() has the advantage that it also handles inheritance, though
it doesn't really matter here. It's more common at least.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-09-08 22:24:45 -04:00
Ulf Magnusson
c191156454 ci: scripts: Suppress pylint warnings for the sh library
pylint does not like how this library works and generates spurious
warnings like

    scripts/ci/get_modified_tests.py:55:13: E1121: Too many positional
    arguments for function call (too-many-function-args)

    scripts/ci/get_modified_tests.py:57:13: E1123: Unexpected keyword
    argument '_tty_out' in function call (unexpected-keyword-arg)

These warnings are useful enough to want to have enabled in the upcoming
pylint CI check, so suppress them here.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-09-08 22:22:35 -04:00
Ulf Magnusson
ad8ac7469b x86: gen_idt.py: Simplify test with 'not in'
Getting slightly subjective, but fixes this pylint warning:

    arch/x86/gen_idt.py:281:11: R1714: Consider merging these
    comparisons with "in" to 'handler not in (spur_code, spur_nocode)'
    (consider-using-in)

Getting rid of pylint warnings for a CI check. I could disable any
controversial ones (it's already a list of warnings to enable anyway).

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-09-08 22:21:46 -04:00
Ulf Magnusson
b558956bd7 doc: application.py: Make functions that don't use 'self' static
Fixes this pylint warning:

    R0201: Method could be a function (no-self-use)

Another option would be to turn them into regular functions, but that'd
be a bigger change.

Fixing pylint warnings for a CI check.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-09-08 22:20:55 -04:00
Ulf Magnusson
ec116e4298 filter-known-issues.py: Remove '== True' test
Fixes this pylint warning:

    Comparison to True should be just 'expr' (singleton-comparison)

Getting rid of pylint warnings for a CI check.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-09-08 22:20:20 -04:00
Ulf Magnusson
1c57b223ef zephyr_commit_rules.py: Fix pylint warning by simplifying conditional
Non-empty sequences are truthy in Python, so len() can be skipped in
tests.

Fixes this pylint warning:

    scripts/gitlint/zephyr_commit_rules.py:115:11: C1801: Do not use
    `len(SEQUENCE)` to determine if a sequence is empty
    (len-as-condition)

Fixing warnings for a CI check.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-09-08 22:19:37 -04:00
Charles E. Youse
4a166f4913 drivers/pci: remove legacy PCI implementation
This has been subsumed by the new implementation in drivers/pcie.
We remove the legacy subsystem, related tests, shell module, and
outdated documentation/config references.

Signed-off-by: Charles E. Youse <charles.youse@intel.com>
2019-09-08 22:09:10 -04:00
Charles E. Youse
34ffdd0aab drivers/spi/spi_intel.c: remove Quark SPI support
This was only used on Quark SoCs. It is no longer used, can no
longer be tested, and it's reliant upon the deprecated legacy PCI
subsystem. Remove it to prevent bitrot.

Signed-off-by: Charles E. Youse <charles.youse@intel.com>
2019-09-08 22:09:10 -04:00
Charles E. Youse
cda625b726 drivers/ethernet/eth_dw: remove DesignWare Ethernet driver
This was only used on the Quark SoCs. It is no longer used, can no
longer be tested, and it's reliant upon the deprecated legacy PCI
subsystem. Remove it to prevent bitrot.

Signed-off-by: Charles E. Youse <charles.youse@intel.com>
2019-09-08 22:09:10 -04:00
Charles E. Youse
68f45fd6d4 drivers/gpio/gpio_dw: remove support for legacy PCI interface
Only Quark SoCs used this IP block hanging off a PCI bus, and the PCI
support is written for the deprecated legacy PCI subsystem, so remove.

Signed-off-by: Charles E. Youse <charles.youse@intel.com>
2019-09-08 22:09:10 -04:00
Charles E. Youse
f8789d5276 drivers/pci: remove support for Quark PCI legacy bridge
We have dropped support for Quark SoCs, and so too for this device.

Signed-off-by: Charles E. Youse <charles.youse@intel.com>
2019-09-08 22:09:10 -04:00
Michael Scott
a4f4f6d6f3 net: net_if: avoid deref of NULL L2
When using offloaded network, an L2 is never assigned to the net_if.
Only certain portions of the net_if code are referenced such as:
net_if_up()
net_if_down()

And these functions make use of several L2 references:
get_flags()
enable()

Let's add checks to make sure we don't deref a NULL when using these
functions.

Fixes the following exception on K64F and other HW which can make
use of offloaded network HW:
FATAL: ***** Reserved Exception ( -16) *****
FATAL: r0/a1:  0x00000010  r1/a2:  0x0000644f  r2/a3:  0x00000000
FATAL: r3/a4:  0x00000000 r12/ip:  0x2000474c r14/lr:  0x0001475b
FATAL:  xpsr:  0x00000000
FATAL: Faulting instruction address (r15/pc): 0x0001b1cd
FATAL: >>> ZEPHYR FATAL ERROR 0: CPU exception
FATAL: Current thread: 0x20004c4c (unknown)

Fixes: https://github.com/zephyrproject-rtos/zephyr/issues/18957

Signed-off-by: Michael Scott <mike@foundries.io>
2019-09-08 22:08:02 -04:00
Johann Fischer
60c4882bad usb: fix ZLP handling for Variable-length Data Stage
ZLP flag should only be set if less data is sent
than requested by host and the length is a multiple
of wMaxPacketSize. Current implementation does not
check it correctly.

For some platforms like nRF52, this patch will not
be enough to fix the problem. The driver must be informed
about the transfer type before sending the last packet,
without changing the API, it is not possible.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2019-09-08 22:06:48 -04:00
Yannis Damigos
6425c52e62 usb_device: Wait for write done event (in) before sending zlp
Don't send zlp immediately after last packet for EP0.
Wait for write done event (in) before sending zlp.

Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
2019-09-08 22:06:48 -04:00
Johann Fischer
ac8a4eacce usb: make number of usb_write retries configurable
Make number of usb_write retries configurable.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2019-09-08 22:06:48 -04:00
Andrei Emeltchenko
77125eafa9 usb: device: Allow limited amount of tries for write
Set limited amount of tries to write to USB control endpoint EP0.

Fixes #16223

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2019-09-08 22:06:48 -04:00
Nick Ward
b130633255 boards: nrf52_pca10040: Add Arduino header definition to DTS
Expose the Arduino R3-compatible pin definition as DTS
for the nrf52_pca10040 board.

Signed-off-by: Nick Ward <nick.ward@setec.com.au>
2019-09-08 17:16:01 -04:00
Nick Ward
c6ca48382e boards: nrf52_pca10040: Fix Arduino SPI pin assignment
Moved arduino_spi to spi2
Set sck-pin in arduino_spi correctly as pin 25
Moved disabled spi0 miso pin assignment to pin 28

Signed-off-by: Nick Ward <nick.ward@setec.com.au>
2019-09-08 17:16:01 -04:00
Jukka Rissanen
2262c48d37 net: socket: Return 0 in recvfrom() if buffer size is 0
If user has buffer with size 0, then return 0.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-09-08 17:13:07 -04:00
Jose Alberto Meza
599c2b80d2 drivers: i2c: xec: Add proper error handling for I2C transactions
Adjust I2C timeouts after k_busy_wait precision has increased.
Report error on first I2C message failure.
Send STOP condition when error is detected.

Signed-off-by: Jose Alberto Meza <jose.a.meza.arellano@intel.com>
2019-09-08 17:11:26 -04:00
Pavel Kral
51eb4572f5 subsystem: console: tty init checks and support for polled-only devices
This patch add tty runtime initialization check for console support
routines. Without it callers of routines API are not aware that
initialization of tty was failed. This patch basically checks
availability of console device and also its support for
interrupt driven transfers if routines are configured to use it.

Signed-off-by: Pavel Kral <pavel.kral@omsquare.com>
2019-09-08 12:43:49 +02:00
Markus Fuchs
750a30296f soc: stm32: add SWO logger backend support
This patch adds HAS_SWO selections to all STM32 SoCs supporting Serial
Wire Output via the Trace Port Interface Unit (TPIU).

Signed-off-by: Markus Fuchs <markus.fuchs@de.sauter-bc.com>
2019-09-08 12:43:09 +02:00
Andrzej Puzdrowski
94a022c954 fcb: start using errno codes
Switch form using privater FCB error codes to
errno codes. FCB private codes convention were compatible
with <errno.h> codes:
- 0 mean success
- negative values mean errors
- similar error types.
There was no sense to kept private FCB error codes.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2019-09-08 12:42:53 +02:00
Christoph Schramm
ce4cc465fc driver: modem: add simple power management to modem receiver
As modem receiver is using UART, it requires disabling
of the UART and its callbacks to save power.
This adds simple sleep/wake functions which should be
called from defined device_pm functions in modem drivers later.

Signed-off-by: Christoph Schramm <schramm@makaio.com>
2019-09-08 12:41:29 +02:00
Pavlo Hamov
8076c8095b subsystem: kernel_shell: extend thread info
1) Dump time sinse last scheduler call
Could be handy for tickless kernel debug.
Will indicate that no rtc irq is called

2) Dump current timeout of each thread
Could be used to find yout when thread will wake up

3) Dump human friendly thread state

4) Use shell_prin instead shell_fprintf

Signed-off-by: Pavlo Hamov <pavlo_hamov@jabil.com>
2019-09-08 12:39:58 +02:00
Morten Priess
d62ad4117c bluetooth: controller: Added function to support RX link quota update
Added ll_rx_link_inc_quota to allow vendor to manipulate
mem_link_rx.quota_pdu when cleaning up nodes via ull_vendor.h.

Signed-off-by: Morten Priess <mtpr@oticon.com>
2019-09-08 12:39:09 +02:00
Bartosz Sokolski
07b942f689 usb: device: limit interface bits in setup message to 8
In setup messages addressing classes, USB standard defines that wIndex
constains interface number encoded in bits 0..7. Bits 8..15
are reserved and normally set to 0. However, in Audio Class they contain
entity number. Hence the need to filter 8 bits for getting interface
number.

Signed-off-by: Bartosz Sokolski <bartosz.sokolski@nordicsemi.no>
2019-09-08 12:38:52 +02:00
Jan Van Winkel
a219710760 net: ip: utils: Corrected memcpy length for port in parse_ipv6
Corrected the amount of bytes copied for port handling in parse_ipv6
to prevent reading past the boundaries of the input string.

Signed-off-by: Jan Van Winkel <jan.van_winkel@dxplore.eu>
2019-09-08 12:37:16 +02:00
Jun Qing Zou
ca783d72a6 net: lwm2m: support client-initiated De-register
Add new RD Client API of lwm2m_rd_client_stop() for this
Fix issues of de-register and event reporting in RD Client

Signed-off-by: Jun Qing Zou <jun.qing.zou@nordicsemi.no>
2019-09-08 12:36:33 +02:00
Wayne Ren
a75b0014fb arc: replace 32-bit instructions with possible 16-bit instructions
replace 32-bit instructions with possible 16-bit instructions to
get better code density

Signed-off-by: Wayne Ren <wei.ren@synopsys.com>
2019-09-08 12:36:02 +02:00
Jan Van Winkel
4539c4bee1 tests: littlefs: Added support for native posix
Added support for native posix boards to littlefs tests.

Signed-off-by: Jan Van Winkel <jan.van_winkel@dxplore.eu>
2019-09-08 12:35:39 +02:00
Jan Van Winkel
48206d1339 native: dts: Added label for flash-controller
Added a label for flash-controller@0

Signed-off-by: Jan Van Winkel <jan.van_winkel@dxplore.eu>
2019-09-08 12:35:39 +02:00
Johann Fischer
e16217aa06 drivers: usb_dc_sam: validate pointer in usb_dc_ep_is_stalled
Validate pointer argument in usb_dc_ep_is_stalled.

Fixes: #18824

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2019-09-08 12:35:23 +02:00
Kamil Piszczek
c05b0c74a3 tests: subsys: settings: functional: nvs & fcb split for CI
Splitted configuration for NVS & FCB so it is possible for the CI to
pick it up.

Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
2019-09-08 12:35:15 +02:00
Kamil Piszczek
1aca71b93e settings: nvs backend: fix build warning due to the type mismatch
Fixed the build warning that was caused by type mismatch.

Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
2019-09-08 12:35:15 +02:00
Kamil Piszczek
03c79fa10e tests: subsys: settings: functional: fix for nvs backend
Fixed build failure for the Settings NVS backend.

Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
2019-09-08 12:35:15 +02:00
Kamil Piszczek
16d45a8a14 boards: qemu_x86: adding missing flash definitions
Added missing flash definitions.

Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
2019-09-08 12:35:15 +02:00
Ulf Magnusson
50b9b1249b scripts: Simplify code with sys.exit(<string>)
Promote a handy and often-overlooked sys.exit() feature: Passing it a
string (or any other non-int object) prints it to stderr and exits with
status 1.

See the documentation at
https://docs.python.org/3/library/sys.html#sys.exit.

This indirectly prints some errors to stderr that previously went to
stdout.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-09-08 12:34:16 +02:00