Commit graph

41120 commits

Author SHA1 Message Date
Andy Ross
729f2037c4 doc: Add docs on data structures
Add some documentation and diagrams for OS library data structures:
dlist/slist, rbtree and ring buffer.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2020-05-07 17:17:52 -07:00
Andrew Boie
ac9abb10b8 tests: mem_protect: cleanup
This suite was fairly messy and very unstable on how it re-used
kernel objects.

* Unnecessary ztest_test_pass() or self-aborts removed
* k_thread_join() now used to wait for child thread completion,
  instead of a strange use of a semaphore which was effectively
  a 10ms sleep
* Barriers simplified
* the number of thread objects in kobject.c is now drastically reduced
* test case function names are now descriptive and made static if
  only used in local scope in kobject.c
* SMP no longer disabled

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-05-07 19:21:16 -04:00
Andrew Boie
1ff066548a ztest: end tests more robustly
If a ztest test case creates child thread(s), and one of the
descendent threads invokes ztest_test_pass(), ztest_test_fail(),
or ztest_thread_skip(), only that descendent thread will be
aborted.

Then ztest will try to run the next scenario on the ztest_thread
which is already in use. This was causing corruption issues on
SMP systems, and possibly other subtle, hard-to-debug
situations.

This patch ensures that ztest_thread is always dead before
re-using it, as run_test() now attempts to join on it instead
of using a semaphore.

The ztest_test_* functions now ensure that the ztest_thread
is always aborted, in addition to the current thread.

This isn't perfect. If the testcase spawned other threads,
they will keep running. The most robust way to fix this is to
iterate over all non-essential threads in the system and abort
them. Unfortunately, Zephyr doesn't have a facility to do
this safely.

It would also be simpler to re-use thread objects if
k_thread_create() could detect whether the thread was already
active and abort it, but this is currently not possible
since k_thread_create() can be used with uninitialzed
thread object memory and no checks are possible. This
may be improved in the future, see #23030.

Fixes: #22738
Partial fix for: #24713

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-05-07 19:21:16 -04:00
Andrew Boie
d2dce5e845 x86: Revert "qemu_x86: use icount for 32-bit"
This was causing problems on some network tests.

This reverts commit 9b055ecf82.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-05-07 15:37:43 -07:00
Jose Alberto Meza
8fa9659aea drivers: gpio: xec: Apply initialization value after pin config.
Update GPIO grouped output after pin control is updated.

Signed-off-by: Jose Alberto Meza <jose.a.meza.arellano@intel.com>
2020-05-07 15:35:55 -07:00
Richard Osterloh
6b41ce5b67 soc: stm32g4: Fix typo in include filename for wwdg
Due to a typo compiling the WWDG on the g4 family does not
work. This adds the correct include filename.

Signed-off-by: Richard Osterloh <richard.osterloh@gmail.com>
2020-05-07 17:24:20 -05:00
Andrzej Puzdrowski
1d34dd88c3 manifest: update mcuboot to 1.6.0-rc2
MCUBoot was synchronized with upsteram tag v1.6.0-rc2
version.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2020-05-07 17:12:09 -05:00
Anas Nashif
61c6e2b172 sanitycheck: raise exception on bad exclusion in ztest
Abort if we find tests that are being skipped incorrectly. Tests should
be skipped using ztest_test_skip().

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-05-07 14:24:02 -04:00
Anas Nashif
29a06975e3 tests: stream_flash: skip tests correctly
User ztest_test_skip() to skip tests, not by conditionally including the
tests in the suite.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-05-07 14:24:02 -04:00
Anas Nashif
7a69125fbf sanitycheck: raise exceptions on bad test names
Raise exception on bad test names such as 'test' or 'sample'.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-05-07 14:23:45 -04:00
Anas Nashif
5622ee4c59 samples: x_nucleo_iks02a1: fix test identifier
Use a more complete test identifier instead of just test.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-05-07 14:23:45 -04:00
Joakim Andersson
194079d5bd Bluetooth: shell: Enable extended advertising support in the shell
Enable extended advertising commands in the shell and enable the
runtime check of feature support in the controller.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-05-07 20:12:29 +02:00
Joakim Andersson
21a42f3b67 Bluetooth: shell: Add phy handling to the shell
Add phy update callback and command to the shell.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-05-07 20:12:29 +02:00
Joakim Andersson
322f70243e Bluetooth: shell: Add data length handling in the shell
Add data length callback and command to the shell.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-05-07 20:12:29 +02:00
Joakim Andersson
0ccee9ba60 Bluetooth: host: Read current PHY when using extended advertising
When using extended advertising the connection can be established on
different PHY. In order to have an updated value of the current PHY
we need to read the PHY of the connection in the connection complete
event.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-05-07 20:12:29 +02:00
Joakim Andersson
6f0b8c1421 Bluetooth: host: Add application control of PHY change procedure
Add application control of initiating phy change procedure and it's
parameters.
The reasons for allowing the application control over the PHY:
 - Allow changing to Coded PHY.
 - Application may change PHY to react to changes in environment
   to balance throughput and range.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-05-07 20:12:29 +02:00
Joakim Andersson
f55c8c9d0b Bluetooth: host: Document parameters to remote information callback
Document the parameters in the remote_info_available callback.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-05-07 20:12:29 +02:00
Joakim Andersson
d9e228a4b0 Bluetooth: host: Add application control of data length procedure
Add application control of initiating data length procedure and it's
parameters.
The reasons for allowing the application control over the data length:
 - Bandwidth control adjusted based on number of active connections.
 - Changing data length before switching to coded phy.
 - Applying workarounds for interoperability problems.
 - Controlling order of ATT MTU and data length procedures.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-05-07 20:12:29 +02:00
Joakim Andersson
69dfcc6fca Bluetooth: host: Add Kconfig option for auto data length procedure
Add Kconfig option so that the application can disable automatic
initiation of the data length procedure. This is symmetric with the
PHY auto initiation kconfig option.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-05-07 20:12:29 +02:00
Joakim Andersson
f85433c4a9 Bluetooth: host: Refactor setting maximum data length
Refactor setting the maximum data length parameters supported on in
auto data length procedure. This makes setting the data length of the
connection a re-usable function.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-05-07 20:12:29 +02:00
Andrei Gansari
3f11f4c207 tests: LPC platforms SPI use default frequncy
After increasing SPI speeds on LPC family SoCs, the slow clock
speeds have been removed and default clock speeds are in use now.

Signed-off-by: Andrei Gansari <andrei.gansari@nxp.com>
2020-05-07 12:47:34 -05:00
Andrei Gansari
ec7fad0853 drivers: spi_mcux_flexcomm clock increase
Attached Flexcomm SPI driver to the main clock used by the core.
This means setting the SPI clock the same value as the core clock.

Signed-off-by: Andrei Gansari <andrei.gansari@nxp.com>
2020-05-07 12:47:34 -05:00
Andrei Gansari
3cc0aa7c62 soc: lpc devices spi clock speed increase
High Speed Flexcomm device that handles high speed SPI transfer are
mapped to the same High Frequency clock that the ARM core uses.
This allows for higher frequency SPI traffic.

Signed-off-by: Andrei Gansari <andrei.gansari@nxp.com>
2020-05-07 12:47:34 -05:00
Andrzej Puzdrowski
8da94d06db manifest: update mcuboot to 1.6.0-rc2
MCUBoot was synchronized with upsteram tag v1.6.0-rc2
version.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2020-05-07 19:47:19 +02:00
Peter Bigot
93884a4fe1 coccinelle: run int_ms_to_timeout conversion semantic patch
This fixes some cases where an integer timeout received as a parameter
was not converted to a timeout before being used in standard API.

Changes to the POSIX library were not included as that's being
reworked in a separate PR.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-05-07 19:46:03 +02:00
Peter Bigot
f77e03bb44 scripts/coccinelle: rename and extend ms to timeout conversion script
Originally this only dealt with constant timeouts.  Add the ability to
recognize integer parameters and convert them as well.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-05-07 19:46:03 +02:00
Peter A. Bigot
e6976562aa tests: drivers: counter: add rtc_ds3231_api
Cloned from counter_basic_api with modifications based on DS3231
limitations:
* Only one device tested per board;
* Counter cannot be stopped or started;
* Alarms are serviced by worker thread, so are not invoked from ISR
  and require that test thread yield to allow processing (no
  k_busy_wait());
* Multiple Alarms test is disabled as documented in test.

Additional tests were added for DS3231-specific API.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2020-05-07 19:45:06 +02:00
Peter A. Bigot
e444274e95 drivers: counter: add Maxim DS3231 support
The DS3231 is an I2C real-time clock with internal temperature
compensated oscillator, maintaining civil time to 1 s precision with
nominal 2 ppm accuracy from 0-40 Cel.

The basic functionality is exposed as a counter that is always running
at 1 Hz.  Much more functionality is exposed as driver-specific API,
including the ability to translate between the time scale of the DS3231
and the time scale of the Zephyr uptime clock.  This allows correlation
of events in the system clock to UTC, TAI, or whatever time scale is
used to maintain the DS3231.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2020-05-07 19:45:06 +02:00
Christopher Friedt
967f7a8bcb tests: kernel: pipe: tests for read_avail write_avail
Tests for issue #25036

Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>
2020-05-07 19:39:53 +02:00
Christopher Friedt
3315f8fecf kernel: pipe: read_avail / write_avail syscalls
These helper functions may clarify how much data is available to read
from or write to the circular buffer of a k_pipe.

Fixes #25036

Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>
2020-05-07 19:39:53 +02:00
Vinayak Kariappa Chettimada
aa60a51a66 Bluetooth: controller: Update Bluetooth version to 5.2
Update the Bluetooth HCI Version to 5.2.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-05-07 19:26:13 +03:00
Vinayak Kariappa Chettimada
ba4e8ff2fd Bluetooth: Add identifiers for Bluetooth 5.2
The Bluetooth 5.2 specification was recently released, and has a new
version identifier (11) assigned to it in the Bluetooth Assigned
Numbers.

Relates to commit fa241f0249 ("bluetooth: Add decoding for BLE 5.2
version string")

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-05-07 19:26:13 +03:00
Morten Priess
3ed658e9ed Bluetooth: controller: Added support for vendor ticker nodes
With BT_CTLR_USER_TICKER_ID_RANGE it is possible for vendors to add a
number of ticker nodes for proprietary purposes. The feature depends on
BT_CTLR_USER_EXT.

Signed-off-by: Morten Priess <mtpr@oticon.com>
2020-05-07 17:34:21 +02:00
Martí Bolívar
eac56e4fb6 edtlib: add EDT.compat2nodes, EDT.compat2okay
These look up tables generalize the compat2enabled map in a way we
will need to make the API more flexible in Zephyr.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-05-07 08:12:49 -05:00
Martí Bolívar
bd0ecc83fb edtlib: add Node.status accessor
Let's get the actual node status, instead of relying on enabled.
Leave enabled in place for gen_legacy_defines.py's sake.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-05-07 08:12:49 -05:00
Kumar Gala
bc48f1ce45 edtlib: allow default property types for nodes without bindings
If a devicetree node doesn't have a matching binding we will at least
populate a common standard set of properties for that node.  The list of
standard properties is:
	compatible
	status
	reg
	reg-names
	label
	interrupt
	interrupts-extended
	interrupt-names
	interrupt-controller
This allows us to handle cases like memory nodes that don't have any
compatible property, we can still generate the reg values.
We limit this to known properties as for any other property we can not
fully determine the property type without a binding and thus we can't
ensure the generation for that property is correct or may not change.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-05-07 08:12:49 -05:00
Andrzej Głąbek
e92ba8f362 samples: drivers: Add sample that shows how to use AT45 flash driver
This commit adds a sample application intended to present capabilities
of the flash driver for AT45 family chips and to serve as a reference
of how to make use of that driver.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2020-05-07 14:51:10 +02:00
Andrzej Głąbek
8ee12207ff drivers: flash: Add driver for AT45 compatible SPI flash chips
Add a driver that can handle several instances of AT45 family chips,
which are enabled by specifying DT nodes for them with the "compatible"
property set to "atmel,at45" and other required properties like JEDEC
ID, chip capacity, block and page size etc. configured accordingly.

The driver is only capable of using "power of 2" binary page sizes in
those chips and at initialization configures them to work in that mode
(unless it is already done).

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2020-05-07 14:51:10 +02:00
Peter A. Bigot
31bc1c0dfd boards: arm: particle*: add header nexus maps and feather labels
The Gen3 (formerly "mesh") Particle product line has a header that is
structurally related to the Adafruit Feather, and is generally
compatible with Featherwing shields.  Provide nexus maps for both the
native header layout, and for the subset feather header layout, and
add alias labels for the peripherals that would be referenced from
shield overlays.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2020-05-07 14:49:49 +02:00
Peter A. Bigot
99495af802 dts: gpio: add Particle Gen3 header binding
This header is physically related to the Adafruit Feather, but uses a
different pin numbering and exposes a slightly different set of pins.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2020-05-07 14:49:49 +02:00
Peter A. Bigot
6b04499331 dts: bindings: add particle vendor identifier
Supports the Particle Gen3 feather header nexus map.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2020-05-07 14:49:49 +02:00
Wayne Ren
0156511e71 drivers: improve the arcv2_timer driver to update cycles correctly
referring the ARM's Systick driver, we did the following improvements:

* use 31 bits of 32-bit counter to avoid the rare but possible
  overflow of elapsed(). If 32 bits val are used, elpased() may
  return a wrong value. then wrong HW cycles.
* two ways to update the correct cycles
  - through systick timer irq
  - when systick timer irq cann't be handled because of irq
    locked/disabled, call z_timer_cycle_get_32->elapsed to update
    the correct cylces. no more than one counter-wrap is allowed.
* if elapsed() is not called too long (more than one counter-wrap) from
  systick tiemr irq or from z_timer_cycle_get_32. The lost of HW cycles
  is unavoidable.

* some detailed discussion can be found in #24332

Signed-off-by: Wayne Ren <wei.ren@synopsys.com>
2020-05-07 14:49:31 +02:00
Joakim Andersson
293cd5664d drivers: can: Fix use of DT_HAS_DRV_INST which does not exist
Fix use of DT_HAS_DRV_INST which does not exist.
Use DT_HAS_NODE_STATUS_OKAY(DT_DRV_INST(n)) instead.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-05-07 07:49:16 -05:00
Andreas Sandberg
7663be01f1 samples: lora: Use the new DT alias to discover radio
The LoRa shell requires the alias 'lora0' for the default radio. Use
the same alias for the samples to make them portable across different
radios and devices.

Signed-off-by: Andreas Sandberg <andreas@sandberg.pp.se>
2020-05-07 14:49:06 +02:00
Andreas Sandberg
d8de33e966 drivers: lora: Add a shell for LoRa testing
Provide basic commands that are useful when testing a LoRa
radio. Currently, the shell supports:

> lora conf ...
> lora send ...
> lora recv ...
> lora test_cw ...

Signed-off-by: Andreas Sandberg <andreas@sandberg.pp.se>
2020-05-07 14:49:06 +02:00
Andreas Sandberg
75b5359d75 boards: arm: 96b_wistrio: Add an alias for the LoRa radio
The LoRa shell and samples need a way to find the default LoRa
radio. Add the DT alias 'lora0' for the default radio.

Signed-off-by: Andreas Sandberg <andreas@sandberg.pp.se>
2020-05-07 14:49:06 +02:00
Andreas Sandberg
d3c6cfc0ee drivers: lora: Add a continuous wave test API
Add an API to transmit a continuous wave at a fixed frequency. This
functionality is useful to test the radio in a lab setup.

Signed-off-by: Andreas Sandberg <andreas@sandberg.pp.se>
2020-05-07 14:49:06 +02:00
Maureen Helm
cda8cf265e samples: subsys: fs: Add new board configurations to fat_fs sample
Adds new configurations for mimxrt10{60,64}_evk boards to the fat_fs
sample application.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2020-05-07 14:47:43 +02:00
Maureen Helm
b21f4cb677 samples: subsys: fs: Update fat_fs sample documentation
Updates the fat_fs sample documentation to reflect that it can run on
multiple boards, not just the nrf52840_blip.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2020-05-07 14:47:43 +02:00
Maureen Helm
389ff5d6d4 samples: subsys: fs: Refactor fat_fs sample yaml to reduce whitelist
Refactors the fat_fs sample yaml to depend on a feature rather than
whitelisting specific boards. This implicitly extends the sample to
mimxrt10{60,64}_evk boards, since they already support the feature.

The only whitelist board remaining is the nrf52840_blip, which requires
a device tree overlay for this sample.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2020-05-07 14:47:43 +02:00