Commit graph

47544 commits

Author SHA1 Message Date
Ying ming 602b71ca5c test: sensor: add testcase
Add module test of API sensor_sample_fetch_chan().
Add module test of unit coversion function.

Signed-off-by: Ying ming <mingx.ying@intel.com>
2021-01-18 19:05:32 +01:00
Fredrik Gihl 49031cf6e2 fs: littlefs: Fix transient string in LOG_ messages
Fix transient string errors found when enable
CONFIG_LOG_DETECT_MISSED_STRDUP.

Signed-off-by: Fredrik Gihl <fredrik.gihl@flir.se>
2021-01-18 18:47:41 +01:00
Torsten Rasmussen dc2c3ea4dd doc: documenting module_ext_root feature
This commits adds documentation on the Zephyr module ext root feature.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
Signed-off-by: Øyvind Rønningstad <oyvind.ronningstad@nordicsemi.no>
2021-01-18 18:02:46 +01:00
Torsten Rasmussen 3673e288bd modules: introducing MODULE_EXT_ROOT to allow glue code in Zephyr repo
This commit introduces MODULE_EXT_ROOT which allows CMake and Kconfig
glue code to be placed outside of the Zephyr module repository.

This allows for placing glue code in Zephyr, but also allows users to
specify custom MODULE_EXT_ROOTs for glue code using either
`-DMODULE_EXT_ROOT` or `zephyr/module.yml` with
`build:settings:module_ext_root` settings.

MODULE_EXT_ROOT' is a list of directories, similar to other roots such
as BOARD_ROOT, DTS_ROOT, etc.
The Zephyr repo folder ${ZEPHYR_BASE} is always to the MODULE_EXT_ROOT
list as lowest priority.
For each MODULE_EXT_ROOT, the file
`<module_ext_root>/modules/modules.cmake` will be processed.

In Zephyr repo, the folder `modules/<module>/` contains CMakeLists.txt
and Kconfig glue code for the Zephyr module.

A Zephyr module can specify that CMakeLists.txt and Kconfig glue code is
placed in an external module root by specifying:
```
build:
  cmake-ext: True
  kconfig-ext: True
```

It is still possible to place the CMakeLists.txt and Kconfig files
directly in the Zephyr module using the existing:
```
build:
  cmake: <path>
  kconfig: <file>
```.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2021-01-18 18:02:46 +01:00
Ningx Zhao ff7ec0ce40 kernel: poll: remove unreachable code
register_event always returns 0, so the conditional will
always take the first branch and code in the else part
is never reached.

Fixes #31282

Signed-off-by: Ningx Zhao <ningx.zhao@intel.com>
2021-01-18 11:02:59 -05:00
Armando Visconti e4f95863f9 drivers/sensor: iis2dlpc: Move trigger pulse Kconfig property into DT
Move iis2dlpc trigger pulse configurations from Kconfigs to Device Tree.
Moreover the dts properties have been renamed as 'tap', which sounds a
better name to immediately catch the feature behind it. Since tap
threshold cannot be zero, this value (which is the default in dts
binding) is used to enable/disable the device feature per each axis.
The event can be generated on INT1 only.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2021-01-18 09:21:00 -06:00
Armando Visconti 6ceffe8a94 drivers/sensor: iis2dlpc: Simplify the switch on trigger type
Simplify the switch case on trigger types (SENSOR_TRIG_DRDY and
SENSOR_TRIG_TAP) inside iis2dlpc_enable_int().

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2021-01-18 09:21:00 -06:00
Armando Visconti d2e8b0cc6e drivers/sensor: iis2dlpc: Move drdy_int info into DT
The IIS2DLPC drdy interrupt can be routed to either INT1 or
INT2 pin. Currently the selection is done by Kconfig configuration.
This commit is instead moving it into Device Tree as 'drdy-int'.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2021-01-18 09:21:00 -06:00
Anas Nashif b1080ea036 twister: remove test type from json
This is always the same, so we might as well just remove it for now and
save some space since it is the default anyways. Type can be added later
when it provides more value.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-01-18 08:30:49 -05:00
Anas Nashif cd1dccf9bc twister: fix json report
Fix JSON report generation and simplify it a bit.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-01-18 08:30:49 -05:00
Anas Nashif 211ef41125 twister: debug which coverage tool is being used
Add more debug messages about coverage tool being used.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-01-18 08:30:49 -05:00
Robert Lubos 78c77da578 samples: net: lwm2m_client: Remove unused objects
Since the additional objects are only added for compilation, enable
them in sample.yaml instead, so that they get built by the CI. Remove
them from the actual sample, as they obfuscate the sample purpose and
the objects visible from the server perspective.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2021-01-18 11:59:50 +01:00
Robert Lubos 366a2147cc net: lwm2m: Add dimension discovery support
Multi-instance resources shall report its dimension (number of
resource instances) on discovery. Since it was not possible to tell
simply on the instance count whether the resource is multi-instance or
not (there could be a multi-instance resource with only one instance
avaialble) add a new parameter to the structure representing resource,
indicating whether it's multi-instance or not.

Add dimension information to the discovery result.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2021-01-18 11:59:50 +01:00
Robert Lubos 18cfc3761e net: lwm2m: Cleanup Device Management Discovery
Remove any references of Bootstrap Discovery from Device Management
Discovery procedure and fix some of it's logic following the
specification.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2021-01-18 11:59:50 +01:00
Robert Lubos 1c9fb5488b net: lwm2m: Implement bootstrap discovery
Bootstrap discovery was not implemented properly in the LwM2M engine.

Although, there were some indications in the source code that it is
implemented, it was not done according to spec (and actually broken).

Given that Bootstrap Discovery procedure differs a lot from the regular
Device Management Discovery (different permissions, different
information returned), it's easier to implement it as a separate
function (`bootstrap_discovery()`) instead of making the existing
`do_discovery_op()` function even more complicated.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2021-01-18 11:59:50 +01:00
Martí Bolívar c19c6fb438 Revert "scripts: west build: default build.pristine to auto"
This reverts commit c505ca38cf.

Fixes: #31358

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-01-17 08:58:54 -06:00
Jukka Rissanen 5723f381e9 tests: net: ptp clock: Increase main stack size
The main stack size is too small by default in many boards.
Increase the size to 1024 bytes which works fine with
sam_e70_xplained board.

Fixes #31342

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2021-01-17 15:09:58 +02:00
Katsuhiro Suzuki 586fa78ea3 drivers: gpio: sifive: use interrupt-cell to set IRQ priority
This patch replace CONFIG_GPIO_SIFIVE_N_PRIORITY into interrupt-cell
of device-tree to set IRQ priority.

Signed-off-by: Katsuhiro Suzuki <katsuhiro@katsuster.net>
2021-01-16 17:22:08 -05:00
Katsuhiro Suzuki eb86d1eec1 drivers: serial: sifive: use interrupt-cell to set IRQ priority
This patch replace CONFIG_UART_SIFIVE_PORT_0_IRQ_PRIORITY into
interrupt-cell of device-tree to set IRQ priority.

Signed-off-by: Katsuhiro Suzuki <katsuhiro@katsuster.net>
2021-01-16 17:22:08 -05:00
Lingao Meng 649cc167a8 boards: Add BBC MicroBit V2 support
The BBC micro:bit v2 is a mini-computer that has been
designed to make the coding fun and easy to learn.

The micro:bit v2 is completely programmable so you can
easily bring your ideas to life! From making games to
creating music and even controlling robots.

The micro:bit comes with neat hardware such as a 25 LED
display, buttons, in-built speakers, Bluetooth 5 & Mesh
connectivity and sensors for temperature, motion & light.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2021-01-16 23:06:23 +01:00
Martí Bolívar 877924cd23 devicetree: fix DT_GPIO_CTLR docstring
This returns a node identifier, not a label.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-01-16 08:09:51 -06:00
Martí Bolívar dbad2627c8 soc: nrf: add DT GPIO helper macros
Add some helper macros that will be convenient to use from device
drivers for accessing and error checking pin mux information in the
devicetree:

- NRF_DT_GPIOS_TO_PSEL(): converts a devicetree GPIO phandle
  <&gpioX pin flags> to the "PSEL style" registers found in
  nRF SoC family IPs. The conversion is done at
  build time and relies on devicetree properties.

- NRF_DT_CHECK_GPIO_CTLR_IS_SOC(): make sure a GPIO controller
  in a phandle-array property is one of the SoC GPIO controllers
  by checking its compatible is nordic,nrf-gpio.

See comments in the patch for more details.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-01-16 07:59:27 -06:00
Martí Bolívar e031bc4b48 dts: nordic,nrf-gpio: add port property
This property is required information for extracting PSEL bits relevant
to peripheral pinmux from this node.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-01-16 07:59:27 -06:00
Martí Bolívar c8b89184f8 soc: nrf: clean up soc.h headers
Make a common header for common includes.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-01-16 07:59:27 -06:00
Martí Bolívar 0861b5ba11 dts: bindings: improve documentation for Nordic IPs
Add some details to help new users learn how to manage the nodes
for compatibles corresponding to IP blocks on Nordic SoCs.

The focus is on IP blocks where the pinmux is configured in
devicetree. These typically have individual properties for each pin,
like a SCK pin on a SPI peripheral, which correspond directly to a
PSEL register value. These violate the usual devicetree convention of
using a 'foo-gpios <&gpioX ...>' phandle property and work in ways
that only make sense if you understand the underlying register map, so
it's worth explaining them a bit more carefully.

Skip these two bindings, which have no drivers: nordic,nrf-i2s.yaml,
nordic,nrf-pdm.yaml.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-01-16 07:59:27 -06:00
Martí Bolívar cd8d2b4921 dts: bindings: spi-controller.yaml documentation
Add more explanations etc.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-01-16 07:59:27 -06:00
Martí Bolívar 9633d2ac61 doc: dts: add link from bindings guide to bindings index
We recently added a generated devicetree bindings index. Link to it
from the bindings page in the Guides section of the documentation so
it's easier for beginners to find.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-01-16 07:59:27 -06:00
Martí Bolívar f7d33f2988 scripts: dts: gen_defines: don't include descriptions
Before we had a bindings index in the documentation, the generated
header file was (somewhat unfortunately) often our best reference for
what a particular binding or property within a binding ends up doing,
so it made good sense to put the description in the generated file.

Now that we have HTML documentation that's a bit more digestible than
the generated file, though, we can just point users at that. Do that
and remove the inline description from the generated file.

This makes it possible to put C-style multiline comments in the
descriptions themselves, which will be done in subsequent patches.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-01-16 07:59:27 -06:00
Martí Bolívar 00ffc7e7b7 devicetree: add DT_NODE_PATH()
This macro returns a node's full path, given its node identifier.

The entire path to a node is useful information for the user which can
be added to build-time error messages.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-01-16 07:59:27 -06:00
Martí Bolívar 0d5e6c13e9 boards/shields: re-work handling in cmake and west
Remove the boards and shields lists from the 'usage' target output.
That might have been readable at some point long ago in Zephyr's
history, when only a few boards were available, but right now it's
obscuring the high level targets we really want 'usage' to print.

Instead, add 'boards' and 'shields' targets which the user can run to
get those lists, and reference them from the 'usage' output. This
makes 'usage' squintable again. We use the new list_boards.py script
from the 'boards' target.

Reference the 'help' target from 'usage' as well, and drop the
recommendation that people run '--target help' from the 'west build
--help' output for the 'west build --target' option. The canonical
place to look is 'usage' now.

Use the new list_boards.py code from 'west boards' as well, which
allows us to add the board's directory as a format string key, in
addition to its name and architecture.

Keep west-completion.bash up to date. While doing that, I noticed that
a bunch of references to this file refer to a stale location, so fix
those too.

Finally, the 'usage' output is what we print for a failed board or
shield lookup, so that needs to be updated also. Handle that by
invoking boards.cmake and a new shields.cmake in CMake script mode to
print the relevant output.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-01-15 15:07:49 -05:00
Martí Bolívar 8bd6d08b0b scripts: add list_boards.py
This script is essentially a Python rewrite of the CMake code we're
using to print boards in cmake/boards.cmake, plus some extra features.

Having this in Python will simplify some later adjustments to our
'usage' build system target in ways that will make its output easier
to read, while simultaneously making 'west boards' more useful.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-01-15 15:07:49 -05:00
Erwan Gouriou 2b0311d903 drivers/serial: stm32: Revert change in uart_irq_rx_ready
In #31192 stm32 uart driver uart_irq_rx/tx_ready functions were
modified to take into account status of irq.
While it seems wlecome for TX (based on uart client's implementation),
this is not correct for RX.
Revert change in uart_stm32_irq_rx_ready function.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-01-15 13:19:39 -05:00
Martin Åberg dc4e331e45 logging: improve string logging on 64-bit ABI
In std_print(), the log arguments were casted to uint32_t before
being sent further to the output function.

For integer types which can not be represented by uint32_t, the
degraded user experience may be acceptable.

However, for string arguments, the output function will eventually
dereference the pointer, so if the "char *" can not be represented
by uint32_t, bad things are going to happen. In practice you will see
this on 64-bit systems where sizeof (char *) is 8 byte and addresses
higher than 0x80000000.

Signed-off-by: Martin Åberg <martin.aberg@gaisler.com>
2021-01-15 13:06:33 -05:00
Martin Åberg 9d1dd9a760 arch/riscv: boost default stacks
Increased stacks required for RISC-V 64-bit CI to pass. Most of these
were catched by the kernel stack sentinel.

The CMSIS stacks are for programs in samples/portability.

Signed-off-by: Martin Åberg <martin.aberg@gaisler.com>
2021-01-15 13:06:33 -05:00
Martin Åberg cda619996e logging: more default stack on RISC-V 64-bit
The default stack size of 768 is just too small for RISC-V 64-bit.

Signed-off-by: Martin Åberg <martin.aberg@gaisler.com>
2021-01-15 13:06:33 -05:00
Martin Åberg c8759ffa01 tests/mbedtls: increase stack size
The testcase allocates lots of stack space, many KiB, for RISC-V
64-bit in the mbedtls bignum functions.

Signed-off-by: Martin Åberg <martin.aberg@gaisler.com>
2021-01-15 13:06:33 -05:00
Martin Åberg 9156c2d32e tests/websocket: improve portability
This commit improves portability somewhat on machines where sizeof
(int) is less than sizeof (void *). Note that the implementation is
still not portable and will fail when you start using addresses which
can not be represented by "int cast to unsigned int".

On RISC-V 64-bit with RAM on 0x80000000 we previously got hit by
  E: Exception cause Load access fault (5)
    ld      s0,16(a0)
    a0: 0xffffffff80025610

(The int should probably be changed to intptr_t if possible.)

Signed-off-by: Martin Åberg <martin.aberg@gaisler.com>
2021-01-15 13:06:33 -05:00
Martin Åberg 9e463d023f benchmarks: app_kernel: limits to 1 CPU
The app_kernel test hangs or crashes on qemu_x86_64 when more than
one CPU is enabled. So limits the number of CPUs to 1 even when SMP
is enabled.

This issue has probably been masked for some time because the test
was previously marked as being "slow".

Signed-off-by: Martin Åberg <martin.aberg@gaisler.com>
2021-01-15 13:06:33 -05:00
Martin Åberg 108a669813 tests/mem_alloc: improve newlib nano detection
The test now uses CONFIG_HAS_NEWLIB_LIBC_NANO rather than
toolchain_allow to determine if newlib nano is available.

Signed-off-by: Martin Åberg <martin.aberg@gaisler.com>
2021-01-15 13:06:33 -05:00
Martin Åberg 4604c45541 tests: enable and run many tests on RISC-V
This commit enables lots of tests on riscv32 and riscv64 which were
previously disabled.

Signed-off-by: Martin Åberg <martin.aberg@gaisler.com>
2021-01-15 13:06:33 -05:00
Martin Åberg a362463fdf boards: qemu_riscv64 use virt machine
Upgrade board specification to use the VirtIO board.

Keeps FPU run-time support disabled since the RISC-V 64-bit FPU
support in kernel appears to be non-functional.

Signed-off-by: Martin Åberg <martin.aberg@gaisler.com>
2021-01-15 13:06:33 -05:00
Martin Åberg 8a2d5aa716 boards: qemu_riscv32 use virt machine
Upgrade board specification to use the VirtIO board.

Signed-off-by: Martin Åberg <martin.aberg@gaisler.com>
2021-01-15 13:06:33 -05:00
Martin Åberg 152d3e46ad soc/riscv: add the QEMU "RISC-V VirtIO board"
The QEMU RISC-V VirtIO board is capable:
- 8 x CPU
- 256 MiB RAM
- PMP
- PCI
- ISA string: RVnnIMAFDCSU
  - mul/div
  - FPU with double precision
  - MMU
  - Compressed instructions

Devicetree was extracted from QEMU as described in virt.dtsi.
The same .dtsi SOC description is used for 32-bit and 64-bit.

Signed-off-by: Martin Åberg <martin.aberg@gaisler.com>
2021-01-15 13:06:33 -05:00
Martin Åberg d2e9568543 riscv: make COMPRESSED_ISA independent of FLOAT_HARD
The CONFIG_FLOAT_HARD config previously enabled the C (compressed)
ISA extensions (CONFIG_COMPRESSED_ISA). This commit removes that
dependency.

Signed-off-by: Martin Åberg <martin.aberg@gaisler.com>
2021-01-15 13:06:33 -05:00
Martin Åberg a0a875026b arch/riscv: semantic ESF printer
Present ESF registers as columns of argument registers and temporary
registers. Also print 64-bit values in full width.

It now looks like this:

E:  mcause: 2, Illegal instruction
E:      a0: 00000000    t0: 12345678
E:      a1: 00000000    t1: 00000000
E:      a2: 00000000    t2: 00000000
E:      a3: 00000000    t3: 0badc0de
E:      a4: 00000000    t4: 00000000
E:      a5: 8000733c    t5: deadbeef
E:      a6: 00000000    t6: 00000000
E:      a7: 00000000
E:                      tp: 00000000
E:      ra: 80000d9a    gp: 00000000
E:    mepc: 8000733c
E: mstatus: 00001880

Signed-off-by: Martin Åberg <martin.aberg@gaisler.com>
2021-01-15 13:06:33 -05:00
Martin Åberg 0b7c89927c riscv: give -mcmodel=medany to GCC when linking
We compile objects with -mcmodel=medany. Now also give -mcmodel=medany
to the GCC front-end when linking to pick up the corresponding
multilibs.

Signed-off-by: Martin Åberg <martin.aberg@gaisler.com>
2021-01-15 13:06:33 -05:00
Enjia Mai 53ca709828 tests: coverage: exclude the CODE UNREACHABLE of code coverage
1. Exclude the CODE UNREACHABLE line while generating coverage report.
2. Exclude the memory domain deprecated API when calculating code
coverage.

Signed-off-by: Enjia Mai <enjiax.mai@intel.com>
2021-01-15 12:42:00 -05:00
Enjia Mai 07d67c1bd4 tests: device: add two more error case testing
1. Add a null dynamic name testing for device_get_binding().
2. Add a driver which initialization failed in SYS_INIT.

Signed-off-by: Enjia Mai <enjiax.mai@intel.com>
2021-01-15 12:18:16 -05:00
Noelle Clement b9d45ecf27 dts: arm: stm32: stm32l1x remove eeprom reg attribute & add eeprom sizes
'reg' attribute removed from overall stm32l1 dts,
so eeprom size has to be specified for each SoC
in stm32l1x series.
Adds remaining stm32l1x SoCs that didn't have eeprom size specified yet.
Eeprom size added in stm32l151Xb-a & stm32l151X8-a dtsi files,
(based on device overview in datasheet DocID024330 Rev 5).
Eeprom size added in stm32l151Xb dtsi file (based on
device overview in datasheet DocID17659 Rev 12).

Signed-off-by: Noelle Clement <noelleclement@hotmail.com>
2021-01-15 12:15:40 -05:00
Jukka Rissanen ebd077b258 tests: net: af_packet: Increase main stack size
The main stack size is too small by default in many boards.
Increase the size to 1024 bytes which works fine with
sam_e70_xplained board.

Fixes #31343

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2021-01-15 12:14:53 -05:00