Commit Graph

45735 Commits

Author SHA1 Message Date
Henrik Brix Andersen df51a8a5c7 samples: canbus: canopen: add configuration for devices with no storage
Add CANopen sample configuration file for devices with no
storage/settings support.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2020-11-10 15:44:25 -06:00
Eugeniy Paltsev 499b4c9069 ARC: nSIM: DTS: switch UART clock-frequency to 50MHz
UART IP is clocked with 50MHz on HAPS by default. So switch
UART clock-frequency from 100MHz to 50MHz for nsim_* boards
so the binaries can be run on HAPS as well.

This property is dummy in case run in simulator (nSIM) so we
don't need to change anything in nSIM configuration files.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
2020-11-10 14:02:11 -06:00
Andrzej Głąbek be02edb050 drivers/flash/nrf_qspi_nor: Add support for nRF53 Series SoCs
Improve the way the nrf_qspi_nor driver configures the SCK frequency,
to properly support QSPI also on nRF53 Series SoCs that use a different
base clock frequency (96 MHz).
Add also a relevant configuration in the spi_flash sample so that it
can run on the nRF5340 DK.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2020-11-10 21:01:37 +02:00
Andrzej Głąbek 6207300dc3 boards: nrf5340dk_nrf5340: Add dts node for MX25R64 flash on QSPI
The nRF5340 (P)DK is equipped with the MX25R64 flash memory. Add a dts
node for that chip in the board definition as well as the missing QSPI
node in the nRF5340 SoC definition.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2020-11-10 21:01:37 +02:00
Torsten Rasmussen 59bbc5a3c8 Revert "shields: Modify overlay file order"
Fixes: #29074

This reverts commit fc8f639b9a.

The suggestion provided in #27901 is impacting processing order of
overlay files in a non-logical way, see #29074 discussion for details.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2020-11-10 13:14:36 -05:00
Ioannis Glaropoulos 083e272eb5 boards: arm: nrf340: update board image in docs
Update the board image file in the nrf5340 documentation,
reflecting the fact that we now document the nRF5340 DK
instead of the PDK.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2020-11-10 17:49:20 +01:00
Ioannis Glaropoulos d58fa250ed boards: arm: update nRF5340 documentation to point to the nRF5340 DK
Update the docs of nRF5340 board, to point to the
nRF5340 DK instead of the PDK.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2020-11-10 17:49:20 +01:00
Fabio Utzig 448db8087c doc: fix reference/util after sys/util.h split
Add back Doxygen documentation that previously existed in sys/util.h
and was moved to sys/util_macro.h.

Also fixes #29896

Signed-off-by: Fabio Utzig <fabio.utzig@nordicsemi.no>
2020-11-10 15:40:31 +01:00
Kumar Gala 173a1cc08a device: deprecate DEVICE_INIT
deprecate DEVICE_INIT in favor of just using DEVICE_DEFINE directly.
The small handful of DEVICE_INIT users was easily converted to use
DEVICE_DEFINE or SYS_DEVICE_DEFINE.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-11-10 08:38:09 -06:00
Kumar Gala 5e97d779bb device: convert DEVICE_INIT to DEVICE_DEFINE or SYS_DEVICE_DEFINE
Convert handful of users of DEVICE_INIT to DEVICE_DEFINE or
SYS_DEVICE_DEFINE to allow deprecation of DEVICE_INIT.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-11-10 08:38:09 -06:00
Kumar Gala d439478805 device: treat a NULL device_pm_control as device_pm_control_nop
This is a step towards phasing out DEVICE_INIT and just having
DEVICE_DEFINE.  To make it a little easier on users or DEVICE_DEFINE
if they don't care about PM, they can just pass NULL for the
pm_control_fn paramater.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-11-10 08:38:09 -06:00
Alexander Kozhinov 7f0d5ba652 samples: net: sockets: README.rst
change ip addresses

Signed-off-by: Alexander Kozhinov <AlexanderKozhinov@yandex.com>
2020-11-10 16:24:53 +02:00
Alexander Kozhinov a2ca3b5ef5 samples: net: civetweb: prj.conf
change IP addresses

Signed-off-by: Alexander Kozhinov <AlexanderKozhinov@yandex.com>
2020-11-10 16:24:53 +02:00
Wolfgang Puffitsch f68d7863e5 Bluetooth: controller: Create HCI stubs for CIG/CIS creation and removal
Put infrastructure for the following HCI commands/events in place:
* LE Set CIG Parameters command
* LE Remove CIG command
* LE Create CIS command
* LE Accept CIS Request command
* LE Reject CIS Request command
* LE CIS Established event
* LE CIS Request event

Signed-off-by: Wolfgang Puffitsch <wopu@demant.com>
2020-11-10 13:19:08 +01:00
Wolfgang Puffitsch e5356595ca Bluetooth: controller: Introduce Kconfig options for CIS central/peripheral
Add Kconfig options to enable Connected Isochronous Stream central and
peripheral roles.

Signed-off-by: Wolfgang Puffitsch <wopu@demant.com>
2020-11-10 13:19:08 +01:00
Benjamin Lindqvist 1578e70eaf net: lwm2m: Add path generation macro
Currently, the Zephyr LwM2M code base is littered with hard-coded
object- and resource IDs, such as

    /* Mark 1st instance of security object as a bootstrap server */
    lwm2m_engine_set_u8("0/0/1", 1);

The purpose of this LoC is extremely opaque without the accompanying
comment. Each use of a resource path requires constantly checking
headers or the object registry to ensure you're not misremembering IDs.

To alleviate this, this commit introduces a variadic LwM2M path
expansion macro which performs preprocessor stringification on each
argument. For instance, "0/0/1" can now be written as

    LWM2M_PATH(LWM2M_OBJECT_SECURITY_ID, 0, SECURITY_BOOTSTRAP_FLAG_ID)

which, while albeit lengthier, avoids the use of hard-coded string
literals, thus making the code much more immediately understandable.

Signed-off-by: Benjamin Lindqvist <benjamin.lindqvist@endian.se>
2020-11-10 14:10:44 +02:00
Jordan Yates daa783ae1a samples: Bluetooth: use indication destroy cb
Update the `peripheral` and `peripheral_ht` samples to use the
indication `destroy` callback to determine when the indication has
completed, instead of using the value callback of the first active
connection.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2020-11-10 11:21:46 +01:00
Jordan Yates ffab099eb9 Bluetooth: add destroy callback to indication
Adds a `destroy` callback to the `struct bt_gatt_indicate_params` which
is used to signify to the application that the indication operation has
completed and the struct instance can be freed/destroyed.

This is required as the number of indication value callbacks that will
be triggered is not known by the caller when the `conn` parameter is
`NULL`.

Tracking when this callback should be run is mananged by a private
reference counter inside the struct.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2020-11-10 11:21:46 +01:00
Jordan Yates 170f17e0e7 Bluetooth: indication callback signature update
Update the signature of the `bt_gatt_indicate_func_t` callback type by
replacing the attr pointer with a pointer to the
`bt_gatt_indicate_params` struct that was used to start the indication.

This allows the callback to free the `bt_gatt_indicate_params` instance
if it was allocated from storage, while still allowing the
`bt_gatt_attr` value to be accessed through `params->attr`.

Allocating the `bt_gatt_indicate_params` instance from storage is
desirable as multiple indications can be queued, however each instance
must be valid until the callback is run.

Implements API update from #29357

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2020-11-10 11:21:46 +01:00
Andrew Boie e51226b827 tests: x86: pagetables: use new Kconfigs
Don't use old SRAM macros for mapped virtual memory bounds.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-11-09 20:19:13 -05:00
Andrew Boie a29b31d800 libc: newlib: fix virtual memory arena size
The calculations need to be from the RAM base virtual
address and not the physical address.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-11-09 20:19:13 -05:00
Andrew Boie ea6e4ad098 kernel: support non-identity RAM mapping
Some platforms may have multiple RAM regions which are
dis-continuous in the physical memory map. We really want
these to be in a continuous virtual region, and we need to
stop assuming that there is just one SRAM region that is
identity-mapped.

We no longer use CONFIG_SRAM_BASE_ADDRESS and CONFIG_SRAM_SIZE
as the bounds of kernel RAM, and no longer assume in the core
kernel that these are identity mapped at boot.

Two new Kconfigs, CONFIG_KERNEL_VM_BASE and
CONFIG_KERNEL_RAM_SIZE now indicate the bounds of this region
in virtual memory.

We are currently only memory-mapping physical device driver
MMIO regions so we do not need virtual-to-physical calculations
to re-map RAM yet. When the time comes an architecture interface
will be defined for this.

Platforms which just have one RAM region may continue to
identity-map it.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-11-09 20:19:13 -05:00
Christopher Friedt 0fc80cf79f net: dns: enable dns service discovery for mdns responder
This change enables support for DNS service discovery
(RFC 6763) in the mdns_responder service and sample app.

Fixes #29429

Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>
2020-11-09 16:15:02 -08:00
Christopher Friedt 0ddce66d86 tests: net: dns: dns-sd: tests for dns service discovery
Tests for DNS-SD (RFC 6763)

Fixes #29099

Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>
2020-11-09 16:15:02 -08:00
Christopher Friedt e7e58439e7 net: dns: dns-sd: support dns service discovery
This change adds support for DNS Service Discovery (DNS-SD)
as described in RFC 6763.

Fixes #29099

Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>
2020-11-09 16:15:02 -08:00
Christopher Friedt 5c691491a7 net: context: add net_context api to check if a port is bound
This change adds net_context_port_in_use(), which is a simple
wrapper around net_context_check_port() and is used to check
if a particular socket is bound to a given IP address.

Fixes #29649

Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>
2020-11-09 16:15:02 -08:00
Jose Alberto Meza df43f17883 drivers: espi: xec: Avoid flash interrupt by ROM bootloader activity
When MEC15xx boots in MAFS, ROM bootloader performs activity over
eSPI flash channel prior to FW is loaded.
Need to clear STS_DONE during early eSPI driver initialization,
before enabling interrupts to avoid unexpected ISRs in FW.

Otherwise this would cause flash_lock semaphore to be incremented
due to ROM activity and result in FW's first espi flash request
to return immediately even before eSPI bus transaction completes.

Signed-off-by: Jose Alberto Meza <jose.a.meza.arellano@intel.com>
2020-11-09 16:01:16 -08:00
Maksim Masalski b2bd0a0608 samples: add capture output for the mec15xxevb_assy6853 pm sample
To make it runnable in the sanitycheck necessary to add
capture output, because that sample runs infinite period of time
and can not finished by itself. To avoid timeout error
in the sanitycheck I added capture output for a several times.
Also added one more tag to describe that it is a power
management sample.

Signed-off-by: Maksim Masalski <maksim.masalski@intel.com>
2020-11-09 16:08:04 -06:00
Gerard Marull-Paretas 394c7d0bef boards: arm: update pwm signals on all STM32 based boards
Update PWM pinctrl signal names of all non-F1 STM32 boards.
`pwm` variant is not available anymore on non-F1 series.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2020-11-09 16:04:24 -06:00
Gerard Marull-Paretas ee47498cea west: update hal_stm32
Update hal_stm32 to have access to the updated timer pinctrl signals.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2020-11-09 16:04:24 -06:00
Yuguo Zou 3826eb302c arch: arc: add support of ARConnect inter-core debug unit
The Inter-core Debug Unit provides additional debug assist features in
multi-core scenarios.This commit allows ARConnect to conditionally
halt cores during debugging.

Signed-off-by: Yuguo Zou <yuguo.zou@synopsys.com>
2020-11-09 15:52:15 -06:00
Diwakar C 909072d012 peci: driver: Ping cmd fail due to improper tx len and wait handling
In current implementation, for Ping command, write data/payload is
queued in FIFO infinitely eventhough Ping command have write length
of '0'.

This issue is addressed in this patch.

Signed-off-by: Diwakar C <diwakar.c@intel.com>
2020-11-09 15:49:19 -06:00
Jan Van Winkel 9fd240f08b manifest: Updated LVGL
Updated LVGL reference to take in fix for compiler warning

Fixes: #29720

Signed-off-by: Jan Van Winkel <jan.van_winkel@dxplore.eu>
2020-11-09 15:43:16 -06:00
Nicolas Pitre a5c53d255c lib/os/prf.c: let the compiler optimize _ldiv5() on 64-bit architectures
The compiler doesn't need help here.

For example, gcc creates this on Aarch64:

_ldiv5:
        ldr     x1, [x0]
        mov     x2, -3689348814741910324
        movk    x2, 0xcccd, lsl 0
        add     x1, x1, 2
        umulh   x1, x1, x2
        lsr     x1, x1, 2
        str     x1, [x0]
        ret

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2020-11-09 13:23:25 -08:00
Nicolas Pitre 822dfbd012 lib/os/prf.c: alternate implementation for _ldiv5()
The _ldiv5() is an optimized divide-by-5 function that is smaller and
faster than the generic libgcc implementation.

Yet it can be made even smaller and faster with this replacement
implementation based on a reciprocal multiplication plus some tricks.

For example, here's the assembly from the original code on ARM:

_ldiv5:
        ldr     r3, [r0]
        movw    ip, #52429
        ldr     r1, [r0, #4]
        movt    ip, 52428
        adds    r3, r3, #2
        push    {r4, r5, r6, r7, lr}
        mov     lr, #0
        adc     r1, r1, lr
        adds    r2, lr, lr
        umull   r7, r6, ip, r1
        lsr     r6, r6, #2
        adc     r7, r6, r6
        adds    r2, r2, r2
        adc     r7, r7, r7
        adds    r2, r2, lr
        adc     r7, r7, r6
        subs    r3, r3, r2
        sbc     r7, r1, r7
        lsr     r2, r3, #3
        orr     r2, r2, r7, lsl #29
        umull   r2, r1, ip, r2
        lsr     r2, r1, #2
        lsr     r7, r1, #31
        lsl     r1, r2, #3
        adds    r4, lr, r1
        adc     r5, r6, r7
        adds    r2, r1, r1
        adds    r2, r2, r2
        adds    r2, r2, r1
        subs    r2, r3, r2
        umull   r3, r2, ip, r2
        lsr     r2, r2, #2
        adds    r4, r4, r2
        adc     r5, r5, #0
        strd    r4, [r0]
        pop     {r4, r5, r6, r7, pc}

And here's the resulting assembly with this commit applied:

_ldiv5:
        push    {r4, r5, r6, r7}
        movw    r4, #13107
        ldr     r6, [r0]
        movt    r4, 13107
        ldr     r1, [r0, #4]
        mov     r3, #0
        umull   r6, r7, r6, r4
        add     r2, r4, r4, lsl #1
        umull   r4, r5, r1, r4
        adds    r1, r6, r2
        adc     r2, r7, r2
        adds    ip, r6, r4
        adc     r1, r7, r5
        adds    r2, ip, r2
        adc     r2, r1, r3
        adds    r2, r4, r2
        adc     r3, r5, r3
        strd    r2, [r0]
        pop     {r4, r5, r6, r7}
        bx      lr

So we're down to 20 instructions from 36 initially, with only 2 umull
instructions instead of 3, and slightly smaller stack footprint.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2020-11-09 13:23:25 -08:00
Alexandre Mergnat 0a5b25916c tests: protection: add riscv support
Execute tests are disabled for RISC-V because is isn't able
to set an execution restriction. From RISC-V documentation:
  "Instruction address-translation and protection are unaffected
  by the setting of MPRV"
MPRV is used to apply memory protection restriction when CPU is
running in machine mode (kernel).

Signed-off-by: Alexandre Mergnat <amergnat@baylibre.com>
2020-11-09 15:37:11 -05:00
Alexandre Mergnat 39208c2700 tests: mem_protect: add riscv support
Add a memory region allocation for RISCV architecture.
Also fix an arbitraty value which can't work with
RISC-V granularity.

Signed-off-by: Alexandre Mergnat <amergnat@baylibre.com>
2020-11-09 15:37:11 -05:00
Alexandre Mergnat 52e6b7fe6b tests: userspace: add riscv support
Add support for the following tests:
- test_write_control
- test_disable_mmu_mpu
- test_read_priv_stack
- test_write_priv_stack

Signed-off-by: Alexandre Mergnat <amergnat@baylibre.com>
2020-11-09 15:37:11 -05:00
Nicolas Royer 86c5cf18db samples: userspace: syscall_perf
The goal of this sample application is to measure the performance loss
when a user thread has to go through a system call compared to a
supervisor thread that calls the function directly.

Signed-off-by: Nicolas Royer <nroyer@baylibre.com>
2020-11-09 15:37:11 -05:00
Alexandre Mergnat c9a3fca1e4 samples: userspace: hello_world
This sample print a hello world message through a user thread.

Signed-off-by: Alexandre Mergnat <amergnat@baylibre.com>
2020-11-09 15:37:11 -05:00
Alexandre Mergnat e76b8e427d boards: hifive1_revb: add support for memory protection features
Add this board to E31 core family.

Signed-off-by: Alexandre Mergnat <amergnat@baylibre.com>
2020-11-09 15:37:11 -05:00
Alexandre Mergnat 4b97619b19 riscv: add support for canaries
Kobject test area size must be increased if canary feature
is enabled.

Signed-off-by: Alexandre Mergnat <amergnat@baylibre.com>
2020-11-09 15:37:11 -05:00
Nicolas Royer f5ac11ae32 arch: riscv: linker: add support for userspace
- Move kobject list after .bss
  The previous order shift kernel object address defined in prebuild
  file (which is use as reference in running time). So it was impossible
  for zephyr to check if a kernel object address was granted because
  address changed during build.

- Add support for memory shared.

- Move sdata2 section in ROM because it contains constants.

Signed-off-by: Nicolas Royer <nroyer@baylibre.com>
2020-11-09 15:37:11 -05:00
Alexandre Mergnat 542a7fa25d arch: riscv: add memory protection support
The IRQ handler has had a major changes to manage syscall, reschedule
and interrupt from user thread and stack guard.

Add userspace support:
- Use a global variable to know if the current execution is user or
  machine. The location of this variable is read only for all user
  thread and read/write for kernel thread.
- Memory shared is supported.
- Use dynamic allocation to optimize PMP slot usage. If the area size
  is a power of 2, only one PMP slot is used, else 2 are used.

Add stack guard support:
- Use MPRV bit to force PMP rules to machine mode execution.
- IRQ stack have a locked stack guard to avoid re-write PMP
  configuration registers for each interruption and then win some
  cycle.
- The IRQ stack is used as "temporary" stack at the beginning of IRQ
  handler to save current ESF. That avoid to trigger write fault on
  thread stack during store ESF which that call IRQ handler to
  infinity.
- A stack guard is also setup for privileged stack of a user thread.

Thread:
- A PMP setup is specific to each thread. PMP setup are saved in each
  thread structure to improve reschedule performance.

Signed-off-by: Alexandre Mergnat <amergnat@baylibre.com>
Reviewed-by: Nicolas Royer <nroyer@baylibre.com>
2020-11-09 15:37:11 -05:00
Alexandre Mergnat 18962e4ab8 arch: riscv: add pmp support
- Set some helper function to write/clear/print PMP config registers.
- Add support for different PMP slot size function to core/board.

Signed-off-by: Alexandre Mergnat <amergnat@baylibre.com>
2020-11-09 15:37:11 -05:00
Alexandre Mergnat 6340dd7a59 arch: riscv: add e31 core support
Introducing core E31 family to link Zephyr features (userspace and
stack protection) to architecture capabilities (PMP).

Signed-off-by: Alexandre Mergnat <amergnat@baylibre.com>
2020-11-09 15:37:11 -05:00
Henrik Brix Andersen 4f8563364e boards: shields: ssd1306_128x64_spi: fix GPIO usage
Move the data/command GPIO from Arduino header 16 (D10), which collides
with Arduino SPI SS, to Arduino header 15 (D9).

Add commented example for specifying a reset GPIO on Arduino header 14
(D8).

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2020-11-09 09:51:19 -06:00
Ioannis Glaropoulos c3ac3027a1 boards: arm: mark nRF5340 PDK as deprecated.
We deprecate nRF5340 PDK and add a note that
the board will be replaced by nRF5340 DK.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2020-11-09 17:33:54 +02:00
Ioannis Glaropoulos 9a51c01559 boards: arm: nrf: remove note about board name change
Nordic Dev Kit board names were changed in Zephyr
v2.3 release, following the standard Board deprecation
policy. Two releases later we do not need to keep
references to the old names in the boards' documentation.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2020-11-09 17:04:22 +02:00
Jukka Rissanen 2f4b66967d net: scripts: Close zephyr network interface when test closes
The zeth interface was left hanging around when the test
finished but we can remove it here as it is not needed.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-11-09 14:42:34 +02:00