Commit graph

43323 commits

Author SHA1 Message Date
Flavio Ceolin
0aaae4a039 guideline: Make explicit fallthrough cases
-Wimplicit-fallthrough=2 requires a fallthrough comment or a compiler
to tells gcc that this happens intentionally.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2020-08-24 20:28:47 -04:00
Flavio Ceolin
f0ec286759 toolchain: gcc: Add macro to fallthrough attribute
This macro is intended to be used in intentional fallthroughs on
switch / case statements.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2020-08-24 20:28:47 -04:00
Flavio Ceolin
680f401ef2 compiler: gcc: Add warning option to spot poblematic switches
Option -Wimplicit-fallthrough as the name suggests raises a warning when
there is an implicit fallthrough in a switch clause. This warning does
not happen when the last statement is a return or a call to a function
declared with noreturn attribute.

This flag helps to enforce two MISRA-C rules (not completely), 16.1 and
16.3

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2020-08-24 20:28:47 -04:00
Daniel Leung
86b2cbc5ea tests: add a test for coredump
This adds a simple test for coredump.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2020-08-24 20:28:24 -04:00
Daniel Leung
faae15d838 sanitycheck: allow QEMU to crash without failing
Adds some code to allow QEMU to crash without failing the test.
This is required for testing coredump code as it will certainly
cause QEMU to crash.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2020-08-24 20:28:24 -04:00
Daniel Leung
5b1b4a3755 sanitycheck: need to wait for harness to process QEMU outputs
There is a potential that QEMUHandler.handle() returns before
the testing harness finishes processing all the output from QEMU.
Simply wait for the harness thread to finish before returning.

Also, fix the return code in the debug message as it should be
the return code from Popen().

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2020-08-24 20:28:24 -04:00
Daniel Leung
181d07321f coredump: add support for ARM Cortex-M
This adds the necessary bits in arch code, and Python scripts
to enable coredump support for ARM Cortex-M.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2020-08-24 20:28:24 -04:00
Daniel Leung
8fbb14ef50 coredump: add support for x86 and x86_64
This adds the necessary bits to enable coredump for x86
and x86_64.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2020-08-24 20:28:24 -04:00
Daniel Leung
49206a86ff debug/coredump: add a primitive coredump mechanism
This adds a very primitive coredump mechanism under subsys/debug
where during fatal error, register and memory content can be
dumped to coredump backend. One such backend utilizing log
module for output is included. Once the coredump log is converted
to a binary file, it can be used with the ELF output file as
inputs to an overly simplified implementation of a GDB server.
This GDB server can be attached via the target remote command of
GDB and will be serving register and memory content. This allows
using GDB to examine stack and memory where the fatal error
occurred.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2020-08-24 20:28:24 -04:00
Fabio Utzig
054a9aeec9 doc: fix typo in heap.rst
typo: stanard -> standard

Signed-off-by: Fabio Utzig <fabio.utzig@nordicsemi.no>
2020-08-24 20:27:30 -04:00
Fabio Utzig
a83f04ee53 doc: fix typo in fifos.rst
typo: FIF -> FIFO

Signed-off-by: Fabio Utzig <fabio.utzig@nordicsemi.no>
2020-08-24 20:27:30 -04:00
Daniel Leung
203556cd8c sanitycheck: update section names in size calculator
Commit 8d7bb8ffd8 refactored
device structures which changed some of the linker sections:
"devconfig" was removed, and "devices" was added. However,
the list in sanitycheck's size calculator was not updated,
which results in sanitycheck complaining about unrecognized
sections when doing footprint.

Also, a few sections have been renamed (with added suffix
"_area") due to introduction of Z_ITERABLE_SECTION_RAM/ROM
macros. There are also some missing section names.

Fixes the issue by adding the missing sections names, and
updating existing ones.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2020-08-24 20:18:06 -04:00
Jamie McCrae
4cf1832fa8 drivers: sensors: sm351lt: Add new driver
Adds sm351lt magnetoresitive sensor driver.

Signed-off-by: Jamie McCrae <jamie.mccrae@lairdconnect.com>
2020-08-24 16:48:47 -05:00
Peter Bigot
c789ea87ef dts: nordic,nrf-twim: rename non-hardware property
As a general rule devicetree properties should correspond to hardware
description or configuration.  In cases where a Zephyr driver receives
instance-specific configuration data from a devicetree property that
property should be marked as being Zephyr-specific.  Rename
concat-buf-size to zephyr,concat-buf-size to follow this guideline.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-08-24 16:35:29 -05:00
Peter Bigot
afdb98a4a9 drivers: i2c_nrfx_twim: restore previous behavior without concat buffer
The Nordic TWIM peripheral generates a start condition for each bus
transaction.  Devices such as the SSD1306 display and some NXP sensors
can only tolerate the presence of a start condition and device address
after a stop condition.  Those devices will not operate correctly when
these signals are observed while the bus is already active.  This
motivated the addition of a RAM buffer into which message fragments
could be collected so TWIM can transmit them without injecting
unnecessary start conditions.

However many I2C devices interpret these signals as a repeated start
and ignore them and so function properly without a buffer
concatenating the message fragments.

There is no default for the concat-buf-size property, and the previous
strict requirement for one when performing scatter/gather I/O
transactions broke working drivers for devices that tolerate the
repeated starts.  Allow those drivers to work by respecting the
property description and attempting to concatenate messages only if a
buffer in which to place them has been provided.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-08-24 16:35:29 -05:00
Peter Bigot
faa855b9df drivers: i2c_nrfx_twim: refactor concat check logic
The condition of being either the last message or not concatenable to
the next message is the inverse of the condition of committing to
concatenate the next message.  The latter is arguably easier to
understand.  Reverse the logic, document the conditions, and simplify
the early continue.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-08-24 16:35:29 -05:00
Peter Bigot
1278c13d47 drivers: i2c_nrfx_twim: clean up when buffer capacity failure detected
Do the normal post-transfer shutdown and sync management when a
transaction is rejected due to insufficient buffer size rather than
returning with the peripheral left enabled and the transfer lock held.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-08-24 16:35:29 -05:00
Peter Bigot
d719801d1e drivers: i2c_nrfx_twim: correct concat buf bounds check
The original checked only the current message length against the
buffer size, not accounting for space already used.

Also improve the diagnostic to indicate how much space is required vs
given.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-08-24 16:35:29 -05:00
Peter Bigot
be8c59b4a4 drivers: i2c: nordic increase timeout to 500 ms
The 100 ms hard-coded timeout is too small to complete the transfer of
1025 bytes of SSD1306 data at 100 kHz.  Increase it to 500 ms to match
STM32 policy and fix this problem.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-08-24 16:31:21 -05:00
Erwin Rol
7bf50875c5 drivers: counter: stm32: Allow disabling backup domain reset
Allow the disabling of reseting of the backup domain. This gives
the possibility to keep the content of the 20 backup registers
and use them to store information that survives a reboot.

Signed-off-by: Erwin Rol <erwin@erwinrol.com>
2020-08-24 16:27:13 -05:00
Peter Bigot
4f8f286a2a drivers: i2c: document speed levels
Many developers will be unfamiliar with UM10204 so document the rates
that are associated with the standard, fast, etc. speed names.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-08-24 16:23:43 -05:00
Mahesh Mahadevan
fe2b393fff MXRT600: Add support for SPI
Enable access to the arduino pins on the mxrt600 evk board

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2020-08-24 16:19:12 -05:00
Andrei Emeltchenko
38a1b85398 CODEOWNERS: Add IPM ADSP driver code owner
Auto assign to ipm_adsp.c as a code owner.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2020-08-24 13:38:33 -04:00
Andrei Emeltchenko
765305e697 ipm: ipm_intel_adsp: Add INTEL ADSP IPM driver
Add IPM driver for Host-DSP communication channel.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2020-08-24 13:38:33 -04:00
Andrei Emeltchenko
58b7c875ff soc: intel_apl_adsp: Add mailbox to the board
Add mailbox to the board DTS.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2020-08-24 13:38:33 -04:00
Andrei Emeltchenko
198709245f dts: Add intel ADSP mailbox bindings
Add bindings for ADSP mailbox.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2020-08-24 13:38:33 -04:00
David Leach
ea9e02e66d boards: mimxrt1050/60/64: Warning on CONFIG_DISPLAY usage
Display a build warning when creating firmware with CONFIG_DISPLAY
enabled that running the firmware on a board without a display
may damage the board.

Signed-off-by: David Leach <david.leach@nxp.com>
2020-08-24 09:06:04 -05:00
Andrzej Kaczmarek
3006dac9ae Bluetooth: controller: Add privacy handling for LE Scan Request Recv
Scanner address returned in event should be resolved, if possible.

Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
2020-08-24 13:28:31 +02:00
Andrzej Kaczmarek
bca3560100 Bluetooth: controller: Use set handle for LE Scan Request Received
Set handle is passed in node_rx header.

Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
2020-08-24 13:28:31 +02:00
Andrzej Kaczmarek
37badf0afa Bluetooth: controller: Enable LE Scan Request Received Event
Just need to pass HCI command parameter to LLL.

Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
2020-08-24 13:28:31 +02:00
Andrzej Kaczmarek
28238fef71 Bluetooth: controller: Add public scan_req_report function
This will be also used by lll_adv_aux code.

Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
2020-08-24 13:28:31 +02:00
Anas Nashif
5ab117ffd2 tracing: scripts: add scripts for parsing ctf data
Generate trace using samples/subsys/tracing for example:

    west build -b qemu_x86 samples/subsys/tracing  -t run \
      -- -DCONF_FILE=prj_uart_ctf.conf

    mkdir ctf
    cp build/channel0_0 ctf/
    cp subsys/tracing/ctf/tsdl/metadata ctf/
    ./scripts/tracing/parse_ctf.py -t ctf

1969-12-31 19:00:00.001779 (+0.000000 s): thread_create: thread_a
1969-12-31 19:00:00.001915 (+0.000136 s): thread_info (Stack size: 1024)
1969-12-31 19:00:00.002021 (+0.000107 s): thread_ready: thread_a
1969-12-31 19:00:00.002287 (+0.000265 s): thread_switched_out: main
1969-12-31 19:00:00.002320 (+0.000033 s): thread_switched_in: main
1969-12-31 19:00:00.002585 (+0.000265 s): thread_abort: main
1969-12-31 19:00:00.002730 (+0.000145 s): thread_switched_out: main
1969-12-31 19:00:00.002762 (+0.000032 s): thread_switched_in: thread_a
1969-12-31 19:00:00.002829 (+0.000067 s): thread_create: 1130656
1969-12-31 19:00:00.002860 (+0.000031 s): thread_info (Stack size: 1024)
1969-12-31 19:00:00.002911 (+0.000052 s): thread_ready: 1130656
1969-12-31 19:00:00.003033 (+0.000121 s): thread_name_set
1969-12-31 19:00:00.003132 (+0.000100 s): semaphore_take (1140992)
1969-12-31 19:00:00.003201 (+0.000069 s): end_call 38 (SEMA_TAKE)
1969-12-31 19:00:00.003330 (+0.000128 s): start_call 39 (SLEEP)
1969-12-31 19:00:00.003721 (+0.000391 s): thread_suspend: thread_a
1969-12-31 19:00:00.003802 (+0.000081 s): thread_switched_out: thread_a
1969-12-31 19:00:00.003834 (+0.000032 s): thread_switched_in: thread_b
1969-12-31 19:00:00.003872 (+0.000038 s): semaphore_take (1141016)
1969-12-31 19:00:00.003976 (+0.000103 s): thread_pending: thread_b
1969-12-31 19:00:00.004095 (+0.000119 s): thread_switched_out: thread_b
1969-12-31 19:00:00.004127 (+0.000032 s): thread_switched_in: idle 00
1969-12-31 19:00:00.004232 (+0.000105 s): idle
1969-12-31 19:00:00.510848 (+0.506616 s): isr_enter
1969-12-31 19:00:00.511664 (+0.000816 s): thread_resume: thread_a
1969-12-31 19:00:00.511947 (+0.000283 s): thread_ready: thread_a
1969-12-31 19:00:00.512385 (+0.000438 s): isr_exit
1969-12-31 19:00:00.512570 (+0.000186 s): thread_switched_out: idle 00
1969-12-31 19:00:00.512689 (+0.000119 s): thread_switched_in: thread_a
1969-12-31 19:00:00.512869 (+0.000180 s): end_call 39 (SLEEP)

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-08-24 13:21:12 +02:00
Anas Nashif
0be0743144 tracing: x86: trace isr_exit
We were missing exit from ISR..

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-08-24 13:21:12 +02:00
Anas Nashif
390537bf68 tracing: trace mutex/semaphore using dedicated calls
Instead of using generic trace calls, use dedicated functions for
tracing sempahores and mutexes.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-08-24 13:21:12 +02:00
Anas Nashif
ffe032e757 tracing: ctf: capture thread names in ctf payload
Add thread name to the payload where applicable.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-08-24 13:21:12 +02:00
Anas Nashif
1d60a3e86f ztest: set thread name
If thread names are enabled, set thread name for the ztest thread for
tracing purposes.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-08-24 13:21:12 +02:00
Anas Nashif
e5e6ba240d tracing: posix_arch: trace swap
Moving trace points to the architecture code.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-08-24 13:21:12 +02:00
Anas Nashif
caa348034f tracing: riscv: fix tracing of context switch
We had switched_in and switched_out mixed up.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-08-24 13:21:12 +02:00
Anas Nashif
b234660f4f tracing: cortex_a53: fix order of swap tracing
We had switched_in and switched_out mixed up.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-08-24 13:21:12 +02:00
Anas Nashif
c1a2c7992b tracing: nios2: fix swap tracing
Fixed ordering of tracepoints for the nios2 architecture.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-08-24 13:21:12 +02:00
Anas Nashif
a45c403c56 tracing: arc: depend on CONFIG_TRACING_ISR for ISRs
Use CONFIG_TRACING_ISR to exclude tracing ISRs just like other
architectures.

Also, z_sys_trace_isr_exit was not defined (It was renamed some time ago
and this was forgotten...)

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-08-24 13:21:12 +02:00
Anas Nashif
8f9b087e41 tracing: convert ctf timestamp to ns
We have been using cycles instead of time units.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-08-24 13:21:12 +02:00
Anas Nashif
d1049dc258 tracing: swap: cleanup trace points and their location
Move tracing switched_in and switched_out to the architecture code and
remove duplications. This changes swap tracing for x86, xtensa.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-08-24 13:21:12 +02:00
Anas Nashif
5c31d00a6a tracing: trace k_sleep
Trace when k_sleep is called.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-08-24 13:21:12 +02:00
Anas Nashif
6e3d1fbd3c tracing: make uart backend sync capable
This works just fine, no need to make this backend async only.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-08-24 13:21:12 +02:00
Philip Serbin
b7b73d0160 net: ipv6: added interface multicast group filtering
Added additonal checks in net_ipv6_input to ensure that multicasts
are only passed to the upper layer if the originating interface
actually joined the destination multicast group.

Signed-off-by: Philip Serbin <philip.serbin@lemonbeat.com>
2020-08-24 13:53:15 +03:00
Dominik Ermel
a3d47d9d7d shell: Fix signal shell_thread only when data received
In case when SMP has been enabled, the shell_thread would be signaled
even if no data has been read from fifo.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2020-08-24 11:48:19 +02:00
Dominik Ermel
d8c7fc8be6 shell: Fix uart_rx_handle byte processing when ring buffer full
In case when shell ring buffer gets full the data may still be taken
from the UART fifo, byte by byte, and accepted by the SMP back-end,
if the back-end has been enabled.

Unfortunately the uart_rx_handle failed to check if it has been
successfull in reading a byte from the fifo, before passing it to
the SMP for processing, which could lead to processing random stack data
as a part of an SMP frame.

Additinally, when the SMP would have accepted the byte,
the uart_rx_handle would fail to signal shell_thread, that the SMP has
internally buffered data that could be processed.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2020-08-24 11:48:19 +02:00
Henrik Brix Andersen
8b94d67dc8 samples: drivers: jesd216: check return value of flash_sfdp_read()
Check the return value of flash_sfdp_read() and print error message if
not successful.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2020-08-24 11:06:48 +02:00
Anas Nashif
f5d606ef72 Kconfig: cleanup subsystems
Sort entries alphabetically and cleanup top level menu for each
subsystem. Move stats subsystem Kconfig from debug into its own Kconfig.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-08-24 10:24:30 +02:00