Commit graph

43582 commits

Author SHA1 Message Date
Fabio Utzig 6111da4481 doc: use non-deprecated CSS/JS import methods
Update methods used to include JS/CSS files, avoiding deprecated
versions the don't work on Sphinx>=3.x. The new methods work on both
Sphinx==3.x and Sphinx>=2.4.x.

Signed-off-by: Fabio Utzig <fabio.utzig@nordicsemi.no>
2020-08-31 09:57:33 -04:00
Fabio Utzig 551f1789a5 doc: update versions of build tools
Update documentation build tooling:

- Sphinx>=3.2.0
- Breathe>=4.20.0
- docutil>=0.16.0

Signed-off-by: Fabio Utzig <fabio.utzig@nordicsemi.no>
2020-08-31 09:57:33 -04:00
Watson Zeng 0079cecc19 sanitycheck: add argument --pre-script
add argument --pre-script to specify a pre script. This will be
executed before device handler open serial port and invoke runner.

Currently, pre_script can only get from hardware.map file. just like:
./scripts/sanitycheck  --hardware-map xxx.map
and set pre_script in xxx.map file.

Signed-off-by: Watson Zeng <zhiwei@synopsys.com>
2020-08-31 15:54:32 +02:00
Watson Zeng 3b43d946fd sanitycheck: run custom pre script before open the serial port
In some cases it might be a good idea to reset the board for real to
make sure it is completely recovered from some failed state (simple
re-loading of the application binary or even Elf file contents doesn't
affect most of internal CPU states so doesn't help in recovery,
see https://github.com/zephyrproject-rtos/zephyr/issues/25022 &
https://github.com/zephyrproject-rtos/zephyr/issues/26665).
And so we may want to utilize some external utility which triggers the
hard reset (in case of ARC boards it is
https://github.com/foss-for-synopsys-dwc-arc-processors/rff-ftdi-reset).
So we need to have a way to execute an external command before each and
every test.

Now given we already have quite some call-backs we try to use them
before re-inventing the wheel. And pre_script seem to be a good option
with just on minor note - it is called after serial port gets open.
And while in some cases it might be OK if serial port on the board is
not affected by the board's reset, if it is affected we'll be losing
connection on reset (and that's the case with ARC boards BTW as the
FTDI USB-to-Serial IC is also wired to the reset signal on most of
the boards). That said we just move invocation of pre_script before
opening the serial port and everything should be good now.

Signed-off-by: Watson Zeng <zhiwei@synopsys.com>
2020-08-31 15:54:32 +02:00
Martí Bolívar 36aa42f384 ci: retry failed west update
Transient network errors may cause west update to fail. Retry it in
case that happens. Updates for projects which are already up to date
won't hit the network.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-08-31 09:42:51 -04:00
Andrzej Głąbek 8e5afef6da bluetooth: controller: nrf5: Add support for nRF52805
Add the nRF52805-specific file with radio related defintions.
Use also specific configurations for certain PPI channels used by
the controller, as this SoC has limited number of programmable PPI
channels.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2020-08-31 15:40:19 +02:00
Andrzej Głąbek 89c7588917 bluetooth: controller: nrf5: Refactor a bit radio_nrf5_ppi.h
Change hard-coded (D)PPI channel bitfield values to the BIT() macro
calls with the corresponding channel base value supplied as parameter,
to make it possible to actually change this base value if needed.
Remove unused *_EXCLUDE macros.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2020-08-31 15:40:19 +02:00
Andrzej Głąbek 2ba4f5d06f boards: arm: Add definition of nrf52dk_nrf52805 board
Add a board that uses the nRF52805 SoC.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2020-08-31 15:40:19 +02:00
Andrzej Głąbek c519184211 soc: nordic_nrf: Add definition of nRF52805 SoC
Add definition of the nRF52805 SoC together with the corresponding
dts files.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2020-08-31 15:40:19 +02:00
Anas Nashif ad44bed754 sanitycheck: fix footprint reports
By default show reports based on last release. Fix a few other issues
where we had 0 values and were dividing by zero.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-08-31 09:20:52 -04:00
Andrzej Kaczmarek 3e7db661d1 tests: Bluetooth: bsim_test_advx: Fix adv_type parameter
The value of adv_type shall be 0x07 for extended advertising, it will
be converted to 0x05 inside ll_adv_params_set after some checks.

This did not cause any issues with tests since input parameters in
already implemented test cases do not test any code that was skipped
by invalid parameter, however obvious one side-effect is that phy_p
would be always set to 1M regardless of input parameter so any test
case using Coded on primary would fail.

Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
2020-08-31 13:50:13 +02:00
Vinayak Kariappa Chettimada 293aa54ef3 Bluetooth: controller: Revert back to using EGU in nRF5340PDK
Refer to nRF5340 Engineering A Errata 29.
[29] SWI: SWIRQ is not functional.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-08-31 13:49:35 +02:00
Vinayak Kariappa Chettimada 5a40aa073d Bluetooth: controller: nRF53: Use SWI instead of EGU
nRF5340 does have SWI peripheral, hence use it instead of
the single available EGU peripheral. Use of SWI will allow
controller's LLL, ULL_HIGH and ULL_LOW execution context to
be independently configured to different interrupt priority
levels.

When ULL_HIGH priority equals ULL_LOW priority, only SWI2
is used by controller. Otherwise, SWI3 is used for ULL_LOW.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-08-31 13:49:35 +02:00
Vinayak Kariappa Chettimada 13bbfc8172 Bluetooth: controller: Handle AD data set race condition
Detect and handle AD data set race condition between thread
and ISR context.

Fixes #27637.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-08-31 13:49:13 +02:00
Vinayak Kariappa Chettimada 530c090cba Bluetooth: controller: Add cpu_dsb hal interface
Add cpu_dsb() hal interface so that data synchronization
barrier be used in ARM Cortex M4 and M33 architecture
implementation.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-08-31 13:49:13 +02:00
Vinayak Kariappa Chettimada c0950dc35d Bluetooth: controller: Add volatile to AD data double buffer index
Set the AD data double buffer first index as volatile
because it is modified in LLL ISR context.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-08-31 13:49:13 +02:00
Vinayak Kariappa Chettimada 8b2024e26c Bluetooth: controller: Add code to detect AD data set race
Added code to detect AD data set race condition.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-08-31 13:49:13 +02:00
Vinayak Kariappa Chettimada 819a0e3ff2 tests: Bluetooth: Update AD Data as fast as possible
Added tests to update AD data as fast as possible. This test
shall exercise any race condition assert checks in the
Zephyr BLE controller implementation.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-08-31 13:49:13 +02:00
Vinayak Kariappa Chettimada 35f2db810d tests: Bluetooth: bsim_advx_test: Increase sim_length to 60 seconds
Increased sim_length value to 60 seconds so as to meet the
current length of 13.56 seconds and any future test timing
increases in the near future.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-08-31 13:47:36 +02:00
Vinayak Kariappa Chettimada 58620ec5a7 Bluetooth: controller: Review rework use HCI defines
Use HCI error and command parameter defines.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-08-31 13:47:36 +02:00
Vinayak Kariappa Chettimada 42ea52c39f tests: Bluetooth: bsim_test: tests periodic adv enable/disable
Update bsim test to test Periodic Advertising Enable and
Disable alongwith Extended Advertising Enable/Disable.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-08-31 13:47:36 +02:00
Vinayak Kariappa Chettimada 139fbb0f4d Bluetooth: controller: Add sync info structure fill function
Refactor out into function the filling of sync info
structure in the common extended advertising payload format
header.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-08-31 13:47:36 +02:00
Vinayak Kariappa Chettimada c85786ff6f Bluetooth: controller: Add aux ptr fill function
Refactor out into function the filling of aux ptr structure
in the common extended advertising payload format header.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-08-31 13:47:36 +02:00
Vinayak Kariappa Chettimada 4a2300d2da Bluetooth: controller: Add common header len get/fill function
Refactor out into functions the calculation of common
extended advertising payload format header length.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-08-31 13:47:36 +02:00
Vinayak Kariappa Chettimada 3abe58e7f1 Bluetooth: controller: Refactor to allow code reuse
Moved the assignment of PDU length out side of a conditional
so that code to calculate PDU length can be reused.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-08-31 13:47:36 +02:00
Vinayak Kariappa Chettimada 3120cddb47 Bluetooth: controller: Refactor out AD data population
Refactor out AD data population to use the common function
ull_adv_aux_hdr_set_clear.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-08-31 13:47:36 +02:00
Vinayak Kariappa Chettimada f69d9ed515 Bluetooth: controller: Refactor sync info population
Refactor out sync info field population into a utility
function with set and clear interface to add or remove
the common extended advertising header format fields.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-08-31 13:47:36 +02:00
Peter Bigot b9e3226f60 i2c: bitbang: fix SDA pin configuration
The driver must be able to read from this pin as well as write to it.
If the driver doesn't support bidirectional configuration then fall
back to the legacy mode.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-08-31 13:07:24 +02:00
Ilya Averyanov afc480f12b drivers/spi: spi_context_longest_current_buf fix
spi_context_longest_current_buf must return max buffer len.
Also remove redundant check

Signed-off-by: Ilya Averyanov <a1ien.n3t@gmail.com>
2020-08-31 13:05:50 +02:00
Gerson Fernando Budke 9974a2a76a mgmt: updatehub: Fix possible deref an uninitialized ptr
There are several references to objects[1] at updatehub_probe function.
The structures are decoded from json, and have a maximum length of 2.
However, if the returned json only has a single element in this array,
this objects[1] value will be uninitialized. Because the structure
contains pointers, these will be uninitialized, causing the code to
reference uninitialized memory as pointers.

Add zeroing memory before passing it to the JSON API and do check if
objects_len field is two.

Fixes #27718.

Signed-off-by: Gerson Fernando Budke <gerson.budke@ossystems.com.br>
2020-08-31 13:04:36 +02:00
Martí Bolívar b5ad84afe9 scripts: west_commands: handle EOFError in nrfjprog.py
We should simply exit if the user hits control-D during the prompt.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-08-31 12:56:20 +02:00
Krzysztof Chruscinski 17d7ad482a drivers: clock_control: Rename nrf_power_clock to clock_control_nrf
Renamed nrf clock control driver file since it does no long control
POWER peripheral.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2020-08-31 12:40:47 +02:00
Andrzej Głąbek 6738aec457 tests/bluetooth/ll_settings: Prevent switch-unreachable warning
After the fallthrough comments have been replaced (see commit
741ad17a37807a5396e73c10cf3e5fb425bc87bb) with a macro expanding
to the corresponding attribute, those hints became statements,
and if one happens to occur before any switch case, a warning
reporting it as an unreachable statement is generated.
Prevent the above from happening for function ll_rx_dequeue() in
ull.c by enabling an option that will make some switch case to
appear before this problematic statement.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2020-08-31 12:40:47 +02:00
Krzysztof Chruscinski 701e9befe4 drivers: clock_control: nrf: Move USB part to the USB driver
Removed all nrf_power/USB related stuff from clock control
driver to USB driver.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2020-08-31 12:40:47 +02:00
Krzysztof Chruscinski d8da2e59c8 drivers: clock_control: nrf: Make use of related nrfx drivers
Update the driver implementation to use nrfx_clock and nrfx_power
drivers. Update also revisions of the hal_nordic and nrf_hw_models
modules, so that it is actually possible to use those drivers.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2020-08-31 12:40:47 +02:00
Andrzej Głąbek d2027b3b98 soc: nordic: nrf51: Add missing peripheral Kconfig options
To indicate that the CLOCK and POWER peripherals are present in those
SoCs, thus the corresponding nrfx drivers can be used.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2020-08-31 12:40:47 +02:00
Torsten Rasmussen 4e8a991590 cmake: Zephyr module error on module name current
In CMake, ZEPHYR_CURRENT_MODULE_DIR is used during processing of module
CMakeLists.txt files.
If a module is named `current` then it's corresponding
`ZEPHYR_<module_name>_MODULE_DIR` would become ZEPHYR_CURRENT_MODULE_DIR
and thus colliding with internal Zephyr CMake variable.

Using module name `current` is therefore forbidden.
Print an error to users when a module named `current` is used in
Zephyr.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2020-08-31 12:15:02 +02:00
Torsten Rasmussen 42d84eaacf docs: Zephyr module and CMake processing
This commit describes add a section which describes how Zephyr modules
are integrated into Zephyr build system and what Zephyr module variables
that are available during CMake and Kconfig processing.

Those variables may be used for refering other Zephyr modules or
including of additional code.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2020-08-31 12:15:02 +02:00
Torsten Rasmussen a861fc96b2 cmake: export Zephyr modules as Kconfig variables.
In CMake it is possible to reference each Zephyr module as a CMake
variable. This commit introduces the same feature to Kconfig, so that
it is possible to reference a module in consistent way in both CMake
and Kconfig.

To include a file from module FOO in CMake, use:
include(${ZEPHYR_FOO_MODULE_DIR}/somefile.cmake

To source a file from module FOO in Kconfig, use:
source "$(ZEPHYR_FOO_MODULE_DIR)/Kconfig.somefile"

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2020-08-31 12:15:02 +02:00
Torsten Rasmussen ab7ec17b86 cmake: zephyr module processing improvements.
This commit improves Zephyr modules support in CMake.
All Zephyr modules will now have a corresponding
`ZEPHYR_${module_name}_MODULE_DIR` set, regardless of whether they
define a cmake folder in module.yml.

This results in:
`ZEPHYR_${module_name}_MODULE_DIR` defined for all modules and refers to
the root of the modle.
`ZEPHYR_${module_name}_CMAKE_DIR` defined for modules that specifies
cmake in module.yml, or is having both a CMakeLists.txt and Kconfig file
in the zephyr folder.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2020-08-31 12:15:02 +02:00
Torsten Rasmussen 25c3f8e12f scripts: zephyr_modules.py cleanup.
This commit has no functional changes but is simply a cleanup so that
flake8 will pass without warnings.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2020-08-31 12:15:02 +02:00
Torsten Rasmussen 2fc062b3a4 cmake: zephyr modules variable names.
This commit refactors processing of Zephyr modules.
The Zephyr module name processing has been moved to zephyr_modules.cmake
to ensure that all `ZEPHYR_<MODULE_NAME>_MODULE_DIR` are defined early
in the build system.

No changes to inclusion of Zephyr module CMake code.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2020-08-31 12:15:02 +02:00
Torsten Rasmussen c8295b19aa cmake: kconfig cmake file environment cleanup
This commit is a cleanup of the cmake/kconfig.cmake file.
It removes `set(ENV{<name>} <value>)` and instead creates a shared list
that can be used for execute_process() and add_custom_target() when
running Kconfig during CMake configure time or menuconfig and related
build targets.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2020-08-31 12:15:02 +02:00
Ryan Erickson eca8842b67 drivers: modem: add Sierra Wireless HL7800 Modem Driver
The driver utilizes the CONFIG_NET_OFFLOAD setting to avoid the
normal handling of IP packets, and instead uses a socket-like
UART interface to handle incoming and outgoing data via AT commands.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2020-08-31 10:46:33 +02:00
Chris Coleman 99a268fa16 arch: arm: Collect full register state in Cortex-M Exception Stack Frame
To debug hard-to-reproduce faults/panics, it's helpful to get the full
register state at the time a fault occurred. This enables recovering
full backtraces and the state of local variables at the time of a
crash.

This PR introduces a new Kconfig option, CONFIG_EXTRA_EXCEPTION_INFO,
to facilitate this use case. The option enables the capturing of the
callee-saved register state (r4-r11 & exc_return) during a fault. The
info is forwarded to `k_sys_fatal_error_handler` in the z_arch_esf_t
parameter. From there, the data can be saved for post-mortem analysis.

To test the functionality a new unit test was added to
tests/arch/arm_interrupt which verifies the register contents passed
in the argument match the state leading up to a crash.

Signed-off-by: Chris Coleman <chris@memfault.com>
2020-08-31 10:13:27 +02:00
Trond Einar Snekvik db0e559b74 Bluetooth: Mesh: Reduce microbit memory consumption
Trims the default memory configuration for the BBC Microbit in mesh
samples to ensure that it fits.

Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
2020-08-30 17:09:59 +03:00
Trond Einar Snekvik 3c8e5b0e1c Bluetooth: Mesh: Network loopback
Changes the local network interface to exclusively handle packets for
the local interface, duplicating the buffers in the process.

The loopback mechanism now operates its own packet pool for the local
interface queue. The loopback is moved ahead of encryption, allowing the
local interface packets to go back up the stack without network crypto,
saving a full round of encrypt/decrypt for self-send.

Packets for group addresses the local node subscribes to are now
duplicated, with one unencrypted variant going into the network
queue, and the network bound packets following the regular path to the
advertiser.

Introduces one new configuration for setting the number of loopback
buffers.

Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
2020-08-30 17:09:59 +03:00
Jose Alberto Meza e3eb9bedec samples: drivers: espi: Showcase how to handle lenghty boot initializations
Add sample where a fictious lenghty operation is required before a more
elaborate handshake is perform with eSPI master.
This requires sending SLAVE_BOOT_DONE virtual wire explicitly.

Signed-off-by: Jose Alberto Meza <jose.a.meza.arellano@intel.com>
2020-08-30 08:22:11 -04:00
Jose Alberto Meza 01ddb4787d drivers: espi: xec: support for eSPI slaves with long initializations
Add Kconfig switch to disable automatic eSPI slave boot acknowledge.
This allows to perform lenghty operations before continue any eSPI
handshake with eSPI master.

Required for eSPI SAF boot configuration.

Signed-off-by: Jose Alberto Meza <jose.a.meza.arellano@intel.com>
2020-08-30 08:22:11 -04:00
Anas Nashif 9eb9c4cce9 sanitycheck: add option --emulation-only
This will only build/run on emulation platforms.
The decision is made based on the value of the 'simulation' key in the
platform yaml file.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-08-28 14:22:07 -07:00