Commit Graph

45704 Commits

Author SHA1 Message Date
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
Jukka Rissanen b68f7dfac2 net: scripts: Fix indentation and help usage
Fixing the indentation of run-sample-tests.sh script so that it
is easier to read.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-11-09 14:42:34 +02:00
Joakim Andersson f8956cfbc7 Bluetooth: L2CAP: Enable L2CAP dynamic channels without Enhanced CBFC
Allow application to enable L2CAP dynamic channels without support
for Enhanced Credit Based Flow Control (CBFC).

Since these are separate features in the qualification it should
be possible to qualify L2CAP connection oriented channels without
also having to qualify L2CAP enhanced credit based flow control.

The L2CAP/LE/REJ/BI-02-C conformance test will fail when enhanced CBFC
has not been selected in the ICS.

The lower tester expects that since the Enhanced CBFC is not supported,
the command L2CAP_CREDIT_BASED_CONNECTION_REQ should be met with an
L2CAP_COMMAND_REJECT_RSP and not an L2CAP_CREDIT_BASED_CONNECTION_RSP.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-11-09 11:25:10 +01:00
Trond Einar Snekvik ad2fd44d7a Bluetooth: Mesh: Encapsulate feature config
Moves mesh feature configuration to a separate module, deprecating the
bt_mesh_cfg_srv structure. The initial values for the features should
now be enabled through KConfig, where new config entries have been added
for each feature.

This removes the upward dependency on the config server from the core
stack, and makes the config server a pure frontend for the configuration
states, as all spec mandated behavior around the feature states is now
encapsulated.

Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
2020-11-09 11:23:34 +02:00
Trond Einar Snekvik 8e284750c8 Bluetooth: Mesh: Document Heartbeat
Adds public documentation for the Heartbeat feature in a separate page
under Bluetooth Mesh.

Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
2020-11-09 11:23:34 +02:00
Trond Einar Snekvik 0dc9e5cd96 Bluetooth: Mesh: Move heartbeat to separate module
Encapsulates the Heartbeat state and functionality in a separate
heartbeat module, removing all manipulation of the heartbeat state from
the transport and config server modules.

Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
2020-11-09 11:23:34 +02:00
Christopher Friedt ec0e737b0c drivers: ieee802154: cc13xx_cc26xx: sub-ghz support
This change adds IEEE 802.15.4g (Sub GHz) support for the
cc1352r.

The 2.4 GHz radio and the Sub GHz radio are capable of
operating simultaneously.

Fixes #26315

Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>
2020-11-09 10:25:24 +02:00
Fabio Utzig 577d588b3a workflows: enable documentation build for Kconfig*
Trigger documentation builds when Kconfig files are changed.

Signed-off-by: Fabio Utzig <fabio.utzig@nordicsemi.no>
2020-11-07 08:29:57 -06:00
Fabio Utzig 0f1517a490 doc: fix broken rST syntax in Kconfig help
Update usage of literal syntax in Kconfig file from markdown to
proper rST.

Signed-off-by: Fabio Utzig <fabio.utzig@nordicsemi.no>
2020-11-07 08:29:57 -06:00
Yurii Gubin f700d74884 drivers: sensor: lsm6dsl: fixed irq_pin for interrupt handling
Obtaining irq_pin from dev leads to disabling interrupts
on unpredictable pin, as dev points to GPIO, not LSM6DSL.

Fixes #29721

Signed-off-by: Yurii Gubin <y.gubin@gmail.com>
2020-11-06 12:48:33 -06:00
Ehud Naim cea6fb7753 logging: fix cmd_log_self_disable argc checker
according to the comment "all if no modules specified"
to support "all" state, set to 1 number of parameters.

Signed-off-by: Ehud Naim <ehudn@marvell.com>
2020-11-06 13:16:39 -05:00
Gerson Fernando Budke 3fe4c702e7 runners: bossac: Add speed argument
The current stty command uses a hard code value of 1200.  This is not
compliant with SAM-BA specs and may create compatibility problems.  Add
an optional speed argument with 115200 as default value following SAM-BA
specifications.  All boards that needs a different speed should define
board_runner_args(bossac "--speed=<value>") with value as required
speed.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2020-11-06 12:15:55 -06:00
Steven Wang 788dd6356c Test: add doxygen comment for test_pipe_thread2thread().
Add doxygen comments for details of test_pipe_thread2thread().

By the way, plan to do the same thing to all test cases
in test_pipe_contexts.c.

Signed-off-by: Steven Wang <steven.l.wang@linux.intel.com>
2020-11-06 13:14:36 -05:00
Dominik Ermel 06aedc4323 west.yml: Update modules/fs/fatfs to latest
The FAT FS driver module has been updated to latest

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2020-11-06 13:10:13 -05:00
Dominik Ermel e8fa66f951 tests/fs/fatfs: Add tests for FS_MOUNT_FLAG_*
Adds various tests for mounting ELM FAT FS with FS_MOUNT_FLAG_NO_FORMAT
and FS_MOUNT_FLAG_READ_ONLY, and operations on read-only mounted
file system.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2020-11-06 13:10:13 -05:00
Dominik Ermel 5c2a004c0b tests/fs/littlefs: Add tests for FS_MOUNT_FLAG_*
Adds various tests for mounting LittleFS with FS_MOUNT_FLAG_NO_FORMAT
and FS_MOUNT_FLAG_READ_ONLY, and operations on read-only mounted
file system.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2020-11-06 13:10:13 -05:00
Dominik Ermel 86dcaebbe7 tests/fs/fs_api: Add API tests fo FS_MOUNT_FLAG_READ_ONLY
The commit adds read-only mount scenario tests to fs_api test
suite.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2020-11-06 13:10:13 -05:00
Dominik Ermel aa0fd027fc fs: Add support for mount flags
The flags field has been added to fs_mount_t structure, accompanied
with two new flags:
  FS_MOUNT_FLAG_READ_ONLY -- mount fs as read only
  FS_MOUNT_FLAG_NO_FORMAT -- do not format volume when system not found

Code supporting the flags has been added to FS layer and drivers for
LittleFS and FAT FS.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2020-11-06 13:10:13 -05:00
Dominik Ermel e43ec70d4f subsys/fs: Make FAT FS write support optional
The commit adds FS_FATFS_READ_ONLY Kconfig option; the option, when
selected, excludes write supporting code within ELM FAT driver.

When write support to FAT FS volumes is not desired, this option may be
selected to slightly reduce code size.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2020-11-06 13:10:13 -05:00
Dominik Ermel c31d659f70 subsys/fs: Make FAT FS formatting code optional
The commit adds FS_FAFTFS_MKFS Kconfig option; the option, y by default,
allows to include mkfs supporting code, within fs_mount callback,
for ELM FAT file system driver.

When formatting of FAT FS volumes is not desired, this option may be
deselected to slightly reduce code size.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2020-11-06 13:10:13 -05:00
Jukka Rissanen db6dac3bcf net: tcp2: Fix sending to 6lo based networks
Do not send the original pkt in 6lo based networks as in those
the IPv6 header is mangled and we would not be able to do any
resends of the original pkt. So for 6lo networks, clone the
pkt and send it to peer. The original pkt is kept in sent list
in case we need to resend to peer.

Fixes #29771

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-11-06 18:58:17 +02:00
Jukka Rissanen f08285fd6f net: shell: Fix TCP statistics printing
Fix TCP statistics printing.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-11-06 09:50:02 -06:00
Jukka Rissanen ab8fd8270a net: stats: Separate dropped TCP data segments and TCP packets
Track the number of dropped TCP data segments and number of dropped
TCP packets in network statistics. It is useful to see these
numbers separately.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-11-06 09:50:02 -06:00
Jukka Rissanen d4320eedf2 net: tcp2: Update statistics
The amount of sent bytes and transmit errors should update
network statistics.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-11-06 09:50:02 -06:00
Dominik Ermel 93cccf27b3 west.yml: Snapshot update of mcumgr from upstream
This commit updates mcumgr with latest snapshot from the upstream.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2020-11-06 09:46:06 -06:00
Kumar Gala b4a3880a75 drivers: remove unnecessary use of DEVICE_AND_API_INIT
For drivers that support CONFIG_DEVICE_POWER_MANAGEMENT there are some
cases that look like:

  #ifdef CONFIG_DEVICE_POWER_MANAGEMENT
    DEVICE_DEFINE()
  #else
    DEVICE_AND_API_INIT()
  #endif

There is no need to special case this as the pm_control_fn argument to
DEVICE_DEFINE will just be ignored in the
!CONFIG_DEVICE_POWER_MANAGEMENT case.  So we can cleanup the code a
little and remove the #else cases for the drivers that do this.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-11-06 09:42:47 -06:00
Mahesh Mahadevan 9ac36e7fe5 west.yml: Pull in build fix for NXP USB driver
The SDK USB driver was missing some defines that were
accidentally deleted when updating to SDK 2.8

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2020-11-06 09:25:47 -06:00
Robert Lubos 7127f0a742 net: lwm2m: Notify the application on network error
Add a simple backoff mechanism between consecutive registration attempts
in case of registration failures. Finally, notify the application in
case the registration failed several times.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2020-11-06 12:58:14 +01:00
Robert Lubos 571b65830b net: lwm2m: Move bootstrap registration send into a separate function
Refactor the boostrap regstration procedure, by splitting the message
creation and sending into a separate function, in similar manner as
it's done with regular registration.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2020-11-06 12:58:14 +01:00
Robert Lubos 397b2a71fa net: lwm2m: Add a callback to notify socket errors to engine users
Currently, when socket errors occur during receive, the LwM2M engine
restarts the state machine and registers again to the server. While this
works in simple use case (only RD client socket open), it's not a valid
approach when more sockets are open (FW update socket).

Fix this by introducing socket fault callback, which is registered by
the LwM2M engine users. This way, a proper socket owner is notified on
error and can pertake appropriate action.

For RD socket errors the behaviour remains the same - the state machine
is reset and the client registers again to the server. For FW update
socket, handle the error by reopening the socket and retransmitting the
last request. This allows to resume the download from the point the
error occured, w/o a need to start from scratch.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2020-11-06 12:57:32 +01:00
Pavel Král 97696f3ed0 uart: native_posix: Add support for pts readiness
Option to pause writing to the pseudo terminal until it is ready to
receive data. Useful for pseudo terminal synchronization with other
host processes.

Signed-off-by: Pavel Král <pavel.kral@omsquare.com>
2020-11-06 12:29:57 +01:00
Christian Taedcke 8910d1c59f drivers: ethernet: stm32: Add missing net_if_set_link_addr() call
When setting the MAC address, the ethernet driver has to call
net_if_set_link_addr() with the updated address. This was missing and is
added now.
See e.g.
https://github.com/zephyrproject-rtos/zephyr/pull/28874

Signed-off-by: Christian Taedcke <christian.taedcke@lemonbeat.com>
2020-11-06 10:11:10 +02:00