Commit graph

41120 commits

Author SHA1 Message Date
Kumar Gala
47ec94a662 ci: Bump docker image and SDK support to 0.11.1
Bump the SDK version to 0.11.0 and associated docker image

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-02-03 14:57:10 -06:00
Kumar Gala
9897c3b0dd libc: Move xtensa reentrant syscall impl to common libc-hooks
The xcc specific reentrant syscall implementations are actually useful
for xtensa in general.  So move that code from being specific to
intel_s1000 / xcc into generic newlib/libc-hooks.c.  This is in prep
for the Zephyr SDK dropping -DMISSING_SYSCALL_NAMES which will make
its version of newlib on xtensa match behavior with xcc.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-02-03 14:57:10 -06:00
Oane Kingma
1421dfb3f1 boards: efr32_slwstk6061a: Enable watchdog
This commit adds the following:
- EFR32FG1P SoC support for the watchdog
- efr32_slwstk6061a board support for the watchdog

Signed-off-by: Oane Kingma <o.kingma@interay.com>
2020-02-03 11:25:40 -08:00
Christian Taedcke
6b382bc9e7 boards: efr32mg_sltb004a: Enable watchdog
This commit adds the following:
- EFR32MG SoC support for the watchdog
- efr32mg_sltb004a board support for the watchdog

Signed-off-by: Christian Taedcke <hacking@taedcke.com>
2020-02-03 11:25:40 -08:00
Oane Kingma
fff0a2b5e7 dts / boards / soc: Add support for SiLabs Gecko watchdog
This commit adds the following:
- device tree bindings for Gecko watchdog driver
- EFM32PG SOC support for the watchdog driver
- EFM32PG board support for the watchdog driver
- DTS aliases for testing with default watchdog driver test

Signed-off-by: Oane Kingma <o.kingma@interay.com>
2020-02-03 11:25:40 -08:00
Oane Kingma
dc5c242223 drivers/watchdog: Add support for SiLabs Gecko Watchdog
Watchdog type is found on e.g. Pearl/Jade Gecko, often
more than 1 is present.

Driver supports timeout and (minimum) window configuration
and reset or timeout interrupt support for now.

Signed-off-by: Oane Kingma <o.kingma@interay.com>
2020-02-03 11:25:40 -08:00
Frank Li
59208ac13b runners: pyocd: add --tool-opt parameter
add --tool-opt to support more pyocd parameter

Signed-off-by: Frank Li <lgl88911@163.com>
2020-02-03 13:32:38 -05:00
Dominik Ermel
c0d31bf02b settings: Reduction of settings_src_register function
The contentes of the function has been reduced with use of
sys_slist_append instead of sys_slist_insert.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2020-02-03 18:39:49 +01:00
Dominik Ermel
f3dc623478 kconfig: Remove log backend options from MCUMGR configuration
The log handler source does not compile for quite long now.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2020-02-03 18:21:55 +01:00
François Delawarde
9d2e34e9c8 bluetooth: host: Add workaround for USB HCI controllers
This commit adds a new option CONFIG_BT_SMP_USB_HCI_CTLR_WORKAROUND
to support USB HCI controllers that sometimes send out-of-order HCI
events and ACL Data due to using different USB endpoints.

Enabling this option will make the master role not require the
encryption-change event to be received before accepting
key-distribution data.

It opens up for a potential vulnerability as the master cannot detect
if the keys are distributed over an encrypted link.

Fixes: #22086

Signed-off-by: François Delawarde <fnde@oticon.com>
2020-02-03 18:39:55 +02:00
Peter A. Bigot
d715fbba63 samples: boards: nrf: add battery measurement sample
Use the voltage divider devicetree binding to demonstrate measurement
of battery voltage for two Nordic-based boards that have the necessary
circuitry.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2020-02-03 16:26:51 +01:00
Peter A. Bigot
4420c5ed40 adc: provide API to help with conversions
Gain values are specified with enumeration values that can't be used
to reverse the effects of scaling the input signal.  Provide a
function that reverses the effect of the gain by scaling a measured
value.

Also provide a function that converts a raw measurement captured with
a reference voltage and specific gain and resolution to the
corresponding voltage in millivolts.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2020-02-03 16:26:51 +01:00
Peter A. Bigot
6438195701 devicetree: add voltage-divider binding
Define a binding for a voltage divider circuit with one or more analog
input channels.  Add devicetree nodes for several boards that have
battery voltage measurement support.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2020-02-03 16:26:51 +01:00
Andy Ross
96ccc46e03 kernel/sched: Put k_thread_start() under a single lock
Similar to the suspend refactoring earlier, this really nees to be
done in an atomic block.  There were two confirmable races here,
though it's not completely clear either was being hit in practice:

1. The bit operations in z_mark_thread_as_started() aren't atomic so
   it needs to be protected.

2. The intermediate state in z_ready_thread() could result in a dead
   or suspended thread being added to the ready queue if another
   context tried a simultaneous abort or suspend.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2020-02-03 09:31:56 -05:00
Andy Ross
ed6b4fb21c kernel/sched: Properly synchronize pend()
Kernel wait_q's and the thread pended_on backpointer are scheduler
state and need to be modified under the scheduler lock.  There was one
spot in pend() where they were not.

Also unpack z_remove_thread_from_ready_q() into an unsynchronized
utility so that it can be called by this process in a single lock
block.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2020-02-03 09:31:56 -05:00
Andy Ross
83d1ca06dc tests/mem_protect/stackprot: Need a delay under SMP
The "alternate thread" test would spawn a thread and then exit the
test, but on SMP that other thread runs asynchronously and it was
possible for the main thread to exit the test entirely before the test
thread had a chance to run (and overflow its stack), leading to
spurious test case failures.

Obviously we can't exactly synchronize to an async crash, so put a
short delay in after spawning the thread.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2020-02-03 09:31:56 -05:00
Andy Ross
9e37e80a1d samples/userspace/shared_mem: Add volatile to interthread data
This test uses bare variables to synchronize state between threads,
but had forgotten volatile qualifiers on all the data.  So the
compiler was free to reorder and make assumptions that aren't valid
when the values are being written from other CPUs.

Single-cpu operation was fine because the code would always hit an
external function call like k_sleep() that would force it to re-read
from memory every time there was a context switch (timeslicing isn't
enabled on this test and the threads are cooperative), but on SMP the
volatiles can change at any time and we could see spurious state
mixups and hangs.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2020-02-03 09:31:56 -05:00
Andy Ross
b8ff63e3c7 kernel/sem: Fix SMP race
This had the same race that queue did: you have to be 100% done with
state management before calling z_ready_thread(), because another CPU
can pick up the thread before the return value was set.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2020-02-03 09:31:56 -05:00
Andy Ross
5b85d6da6a arch/x86_64: Poison instruction pointer of running threads
There was a bug where double-dispatch of a single thread on multiple
SMP CPUs was possible.  This can be mind-bending to diagnose, so when
CONFIG_ASSERT is enabled add an extra instruction to __resume (the
shared code path for both interupt return and context switch) that
poisons the shared RIP of the now-running thread with a recognizable
invalid value.

Now attempts to run the thread again will crash instantly with a
discoverable cookie in their instruction pointer, and this will remain
true until it gets a new RIP at the next interrupt or switch.

This is under CONFIG_ASSERT because it meets the same design goals of
"a cheap test for impossible situations", not because it's part of the
assertion framework.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2020-02-03 09:31:56 -05:00
Patrik Flykt
65ffc71466 scripts: net: Add script for running sample tests
Add a script that sets up Docker networking and starts the net-tools
Docker container. If successful, run Zephyr with native_posix and
execute the appropriate net-tools container executable. The proper
net-tools executable and arguments is selected depending on the
basename of the sample directory. This script needs to be updated
if the net-tools Docker image is updated in some incompatible way.

The net-tools directory is assumed to exist at the same level as
the Zephyr base directory, but its location can be set using the
'-N' command line argument. Likewise, '-Z' sets the Zephyr top level
directory.

When stopping Zephyr, go through all child processes since running a
native posix or other variant of Zephyr may cause a hierarchy of
processes to be created.

Fixes: #19540

Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
2020-02-03 09:04:12 -05:00
Patrik Flykt
cf5d2e07ca west: Update required net-tools revision
Net-tools revision 4bff01084d225996e4aae84b98be5969e2f9f33d
is needed for running network sample test scripts.

Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
2020-02-03 09:04:12 -05:00
Patrik Flykt
dbd3439cf9 samples: net: echo_client: Add Kconfig option to run a number of times
Add Kconfig option NET_SAMPLE_SEND_ITERATIONS that sets the number of
times the Zephyr echo client sample sends its data. By default the
value is zero, which means indefinite, and demonstrates the same
behavior as before.

Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
2020-02-03 09:04:12 -05:00
Vinayak Kariappa Chettimada
814654af80 Bluetooth: host: Invalid role used in finding connections
Directed advertising timeout was dropped in the host due to
not being able to find a pending connection. Host used the
role parameter from the error event parameters which has
been earlier zero-ed out.

Regression introduced in commit a0349689ff ("Bluetooth:
host: Fix conn object assigned to wrong connection")

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-02-03 12:51:59 +02:00
Joakim Andersson
a570be6e93 Bluetooth: host: Refresh advertiser NRPA when active scan is using NRPA
When starting a non-connectable advertiser and an active scanner is also
using NRPA address then this use-case should be supported. A new
advertiser that is non-connectable should have a fresh NRPA address
every time it is started, so we must refresh the NRPA used by the active
scanner.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-02-03 12:44:39 +02:00
Joakim Andersson
d977282514 Bluetooth: host: Scanner must be disabled to update to NRPA address
When advertiser is disabled we should update the random address for both
passive and active scanner back to an NRPA. But this command will fail
because the if the scanner is an active scanner, we must disable and
re-enabled the active scanner after setting the random address.
This behavior should not be there when scanner is configured to scan
with identity address.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-02-03 12:44:39 +02:00
Joakim Andersson
499b4e0ce0 Bluetooth: host: Document privacy-disabled directed advertising reports
Document why a privacy-disabled scanner will not notify about directed
advertising reports. This is the default behaviour of the
privacy-disabled scanner. In order to receive the reports the option
BT_SCAN_WITH_IDENTITY must be enabled.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-02-03 12:44:39 +02:00
Joakim Andersson
56bbc4e6d3 Bluetooth: host: Prevent adv overwriting passive scan identity address
Prevent the advertiser from overwriting the passive scanners identity
address when the scanner has been configured to scan using the identity.
In this case the LE Set Random Address command would not prevent the
address from being overwritten. So instead we explicitly stop it in the
host.

Also fix original code function not working at all since the first
if statement was should had a bad check. Resulting in it always
returning success.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-02-03 12:44:39 +02:00
Joakim Andersson
a6b978b1f2 Bluetooth: host: Drop directed adv reports for NRPA passive scanner
Drop directed advertiser reports when the passive scanner should have
been using the NRPA address. The advertiser has overwritten the NRPA
with it's identity address instead and a peer is sending directed
advertiser packets to it.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-02-03 12:44:39 +02:00
Trond Einar Snekvik
a112f1568d Bluetooth: host: Skip set passive scan when not scanning with identity
When privacy is disabled by default the scanner still protects it's
identity with the use of NRPA addresses. We should not set the identity
address for the passive scanner unless the Kconfig option to scan with
the identity has been enabled.

This makes passive scanner behave the same way as an active scanner
since none of them will report directed advertising reports towards
the scanners identity.

This also enables the advertiser to switch out the random address which
is needed for the Bluetooth Mesh LPN case.

Fixes #22088.

Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
2020-02-03 12:44:39 +02:00
Joakim Andersson
ab2902ec69 Bluetooth: tests: Update hci_prop_evt for LE Set Random Address command
Accept LE Set Random Address command during HCI init.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-02-03 12:44:39 +02:00
David D
b45b1e393c test: net: pkt: Added a test case for net_pkt_pull()
Added a test case for net_pkt_pull() with large packet buffers

Signed-off-by: David D <a8961713@gmail.com>
2020-02-03 10:47:08 +02:00
David D
3de967749a net: pkt: Fixed packet buffer corruption in net_pkt_pull()
Changed size related variables type to size_t to handle
large packet buffers correctly

Signed-off-by: David D <a8961713@gmail.com>
2020-02-03 10:47:08 +02:00
Marcin Niestroj
4f1626851b shell: device: show PM state in device list
Show current power management state in the list of devices, which is
helpful during PM debugging.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-02-02 09:05:15 -05:00
Marcin Niestroj
21409494d1 power: device: deduplicate suspending code
Function to put devices in lower power mode were all implemented in the
same way. Deduplicate code there by implementing single function to
handle all cases.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-02-02 09:05:15 -05:00
Marcin Niestroj
8224a449a2 power: device: use ARRAY_SIZE() for getting number of core_devices
There is no point to specify number of core devices explicitly, as it
can be done by compiler with ARRAY_SIZE() macro.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-02-02 09:05:15 -05:00
Maureen Helm
06d17aa68d samples: display: Enhance lvgl sample to support touch input
Enhances the lvgl sample to support an optional touch panel input on
mimxrt10{50,60,64}_evk boards.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2020-02-01 08:50:16 -05:00
Maureen Helm
cad729dcfb boards: Configure ft5336 touch panel on i.mx rt boards
Adds device tree nodes and configures Kconfig defaults for the ft5336
touch panel driver on mimxrt10{50,60,64}_evk boards.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2020-02-01 08:50:16 -05:00
Maureen Helm
514b5861c3 gui: Add support for lvgl touch input device
Adds support for an optional lvgl touch input device using the zephyr
keyboard scan interface. This can be used with the ft5336 touch panel
driver, which returns single touch coordinates through the kscan
driver callback.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2020-02-01 08:50:16 -05:00
Maureen Helm
6382f06aa0 drivers: kscan: Introduce ft5336 touch panel driver
Introduces a new ft5336 touch panel driver for the keyboard scan (kscan)
interface. The driver currently uses a timer to periodically poll touch
data in the system work queue, but later it can be enhanced to use a
gpio interrupt instead of a timer.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2020-02-01 08:50:16 -05:00
Maureen Helm
ca43b7ceb4 dts: Add bindings for ft5336 touch panel controller
Adds device tree bindings for the focaltech ft5336 touch panel
controller, which will be used on several i.mx rt evk boards.

Moves address-cells and size-cells properties from the base kscan
bindings to the specific microchip,xec bindings since they are not
required for the ft5336.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2020-02-01 08:50:16 -05:00
Maureen Helm
5a330f9b36 drivers: kscan: Extend callback arguments to 32-bits
Extends the keyboard scan callback row and column arguments from 8-bits
to 32-bits to support a touch panel driver implementation.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2020-02-01 08:50:16 -05:00
Ulf Magnusson
46f98d86c7 include: gcc.h: Add a __WARN() macro with a custom warning on expansion
Works like __DEPRECATED_MACRO with a custom message. Can do this for
example:

    #define FOO __WARN("Please use BAR instead") ...

Implement __DEPRECATED_MACRO with __WARN().

Useful for https://github.com/zephyrproject-rtos/zephyr/pull/21506.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2020-02-01 08:48:17 -05:00
Krzysztof Chruscinski
279e5b45b8 shell: Fix SHELL_COND_CMD_ARG_REGISTER macro with NULL handler
Macro was failing when handler was NULL and else case was
hit because of attempt to concatenate with handler which was
set to NULL (which is ((void *)0)).

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2020-02-01 08:10:06 -05:00
Krzysztof Chruscinski
3e414b6ab4 logging: Add source name to error message about missing log_strdup
Added source name to help identifing which message caused the issue.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2020-02-01 08:09:26 -05:00
Carlo Caione
0958673ee1 arch: arm64: Enable shared IRQ line for UART
Enable the shared IRQ for the UART line and enable the remaining tasks
that depends on a separated declaration of the TX/RX/Err/... IRQs.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2020-02-01 08:08:43 -05:00
Carlo Caione
3cdead707d arch: arm64: Fix cmsis_rtos tests
The cmsis_rtos tests are failing because the stack size used by CMSIS is
too small. Customize the stack size for the aarch64 architecture and
re-enable the tests.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2020-02-01 08:08:43 -05:00
Carlo Caione
3aef85458d arch: arm64: Dump registers content on fatal error
Extend the ESF structure and dump the most important registers in the
error exception handler.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2020-02-01 08:08:43 -05:00
Carlo Caione
6531d1c649 arch: arm64: Enable config option to switch from EL3 to EL1
ARMv8-A SoCs enter EL3 after reset. Add a new config option
(CONFIG_SWITCH_TO_EL1) to switch from EL3 to EL1 at boot and default it
to 'y'.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2020-02-01 08:08:43 -05:00
Carlo Caione
86a60475a4 arch: arm64: Fix logging test
We need a slightly bigger stack to be able to successfully pass the
logging test. Fix the stack size and enable back the test.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2020-02-01 08:08:43 -05:00
Carlo Caione
0d5e011be4 arch: arm64: Enable tracing
Enable the tracing hooks on the ARM64 platform and white-list the
tracing tests.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2020-02-01 08:08:43 -05:00