Commit graph

50892 commits

Author SHA1 Message Date
Sylvio Alves
df5b22b264 linker: esp32: moved windowspill to IRAM
xthal_window_spill call has to be placed into IRAM
in order to allow flash cache disabled operation, otherwise
it will crash.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2021-04-19 13:04:51 -04:00
Sylvio Alves
56d4e835b9 linker: esp32: remove libhal dependency
libhal.a is not used and can be removed from linker

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2021-04-19 13:04:51 -04:00
Robert Lubos
0b63a9618b net: telnet: Fix character mode handling
If the telnet client operates in a character mode, it may send
individual characters in packets. Such packets were dropped in the
telnet shell backend instead of being process by the shell engine.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2021-04-19 17:12:23 +02:00
Guillaume Paquet
d3d789d7ee boards: arm: Add RAK4631 Wisblock Core LPWAN board
Add rak4631 board from RAKWireless based on nrf52840 and SX1262.
Board Documentation is completed

Signed-off-by: Guillaume Paquet <guillaume.paquet@smile.fr>
2021-04-19 11:01:24 -04:00
Nicolas Pitre
29c8e9bf66 arm64: decrustify and extend SMP boot code
The SMP boot code depends on physical CPU #0 to be first to boot and
subsequent CPUs to follow suit in a linear fashion. Let's decouple
physical and logical numbering so that any physical CPU can be the
boot CPU. This is based on a prior code proposal from
Jiafei Pan <Jiafei.Pan@nxp.com>.

This, however, was about to turn the boot code into some hairy mess.
So let's clean things up and simplify the code as well while at it.
Both the extension and the clean up aren't separate commits because
they actually depend on each other.

The BOOT_PARAM_*_OFFSET defines are locally hardcoded as there is no
point exposing the related structure widely. Build time assertions
ensure they don't go out of sync with the struct definition. And
vector_table.h is repurposed into boot.h to gather boot related
definitions.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
Signed-off-by: Jiafei Pan <Jiafei.Pan@nxp.com>
2021-04-19 11:00:05 -04:00
Jiafei Pan
7889364771 arm64: refine the code for primary core checking
We can find caller of z_arm64_mmu_init is on primary
core or not, so no need to check mpidr, just add a
function parameter.

Signed-off-by: Jiafei Pan <Jiafei.Pan@nxp.com>
2021-04-19 11:00:05 -04:00
Joakim Andersson
a7daeebf0e Bluetooth: host: Document default behavior of le_param_req with no cb
Document the default behavior of LE connection parameters request when
the application has not defined a callback.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2021-04-19 10:59:43 -04:00
Krzysztof Chruscinski
320f7c3808 net: lib: openthread: logging: Refactor logging function
Refactor logging function to avoid multiple macro calls.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-04-19 10:59:23 -04:00
Krzysztof Chruscinski
be80109719 manifest: Temporary point to sof repo with MAX workaround
Point to commit which contains temporary fix for sof redefining
MAX macro.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-04-19 10:59:23 -04:00
Krzysztof Chruscinski
7bae59481e shell: Add support for logging v2
Extended shell to support logging v2.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-04-19 10:59:23 -04:00
Krzysztof Chruscinski
bb64419a29 logging: Adapt ADSP backend to v2
Added support for v2 backend interface to ADSP.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-04-19 10:59:23 -04:00
Krzysztof Chruscinski
da31e09f2b logging: Add v2 support to RTT backend
Add support for logging v2 to RTT backend.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-04-19 10:59:23 -04:00
Krzysztof Chruscinski
e767bf6377 logging: Add v2 support to native_posix backend
Add support for logging v2 to native_posix backend.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-04-19 10:59:23 -04:00
Krzysztof Chruscinski
7ce3f7a25a logging: backend_uart: Adapt to support v2 api
Adapted to handle processing of v2 log messages.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-04-19 10:59:23 -04:00
Krzysztof Chruscinski
247078e0d8 doc: logging: Add documentation for logging v2
Extended and refactored logging documentation. Added details about
logging v2 and comparison with v1.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-04-19 10:59:23 -04:00
Krzysztof Chruscinski
68f70b32fc tests: logging: Add benchmark test
Added test which benchmarks deferred logging v1 and v2.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-04-19 10:59:23 -04:00
Krzysztof Chruscinski
963d60cec5 logging: Add LOG_PRINTK macro for printing via logging
Added macro which allows to print formatted string using
logging infrastructure.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-04-19 10:59:23 -04:00
Krzysztof Chruscinski
d2f62144c7 tests: logging: Add test for log_msg2
Added suite for log_msg2 macros.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-04-19 10:59:23 -04:00
Krzysztof Chruscinski
f1bb20f6b4 logging: Adapt logger to support both versions
Adapted to be able to switch between v1 and v2.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-04-19 10:59:23 -04:00
Krzysztof Chruscinski
902ccd7235 logging: log_output: Extend to support log_msg2 parsing
Added parsing of log_msg2.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-04-19 10:59:23 -04:00
Krzysztof Chruscinski
f6a40ae183 logging: Add logging v2 implementation for log_msg
Added implementation of log_msg2 which is creating log messages
using cbprintf packaging and storing them in circular ring buffer
(mpsg_pbuf).

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-04-19 10:59:23 -04:00
Krzysztof Chruscinski
ba1aa75c66 logging: Refactor in preparation for logging v2
Refactor and cleanup in preparation for v2.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-04-19 10:59:23 -04:00
Krzysztof Chruscinski
67fade04a0 net: l2: bluetooth: Add cast to forward declared struct
Logging v2 is using _Generic keyword for detecting type of
log message arguments. Apparently, it does not support handling
of pointers to forward declared structures. Added casting to void *.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-04-19 10:59:23 -04:00
Krzysztof Chruscinski
b3c5496159 bluetooth: Add cast to forward declared struct
Logging v2 is using _Generic keyword for detecting type of
log message arguments. Apparently, it does not support handling
of pointers to forward declared structures. Added casting to void *.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-04-19 10:59:23 -04:00
Krzysztof Chruscinski
9c6b159d68 doc: misc: Add documentation for MPSC Packet Buffer
Add documentation for Multi Producer Single Consumer Packet Buffer.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-04-19 10:59:23 -04:00
Krzysztof Chruscinski
345d12e8e0 tests: lib: Add test for mpsc_pbuf
Added suite for multiple producer, single consumer packet buffer.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-04-19 10:59:23 -04:00
Krzysztof Chruscinski
1fd71ca043 lib: os: mpsc_pbuf: Add optional debug features
Added optional debug prints. Logging cannot be used because
mpsc pbuf is used by the logging.

Added option to clear packet memory after allocation. Option is
enabled in Kconfig.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-04-19 10:59:23 -04:00
Krzysztof Chruscinski
3a765f4384 lib: os: Add mpsc (multiple producer, single consumer) packet buffer
Added module for storing variable length packets in a ring buffer.
Implementation assumes multiple producing contexts and single consumer.

API provides zero copy functionality with alloc, commit, claim, free
scheme.

Additionally, there are functions optimized for storing single word
packets and packets consisting of a word and a pointer. Buffer can work
in two modes: saturation or overwriting the oldest packets when buffer
has no space to allocate for a new buffer.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-04-19 10:59:23 -04:00
Krzysztof Chruscinski
fb4d945b82 doc: misc: formatted_output: Add section for cbprintf packaging
Add documentation for cbprintf packaging.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-04-19 10:59:23 -04:00
Vinayak Kariappa Chettimada
41e9493ae1 Bluetooth: controller: Fix missing encryption procedure state check
Fix a missing encryption procedure state check which allowed
out of order receive of START_ENC_RSP PDU, which made the
controller to believe its already in an encryption procedure
in progress state.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-04-19 10:59:01 -04:00
Emil Gydesen
1690f27658 Bluetooth: Audio: Fixes a few minor editorial things in aics.h
Changes
ERRNO => errno
and renames the init/register parameter.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-04-19 10:58:42 -04:00
Maximilian Bachmann
f23a334f6d doc: fix spelling mistake
Fix small spelling mistake

Signed-off-by: Maximilian Bachmann <m.bachmann@acontis.com>
2021-04-19 10:48:50 -04:00
Asbjørn Sæbø
22068d4967 Bluetooth: services: Do not set current object until selected
Do not make the first object added to the object transfer server the
current (=selected object).  This leads to the server having no
current object until one is selected by the client.

This solves a startup issue where the selected callback is not called
by the server if the first object selected by the client happens to be
the same object as the object that was first added to the server.  In
that case, the user of the OTS does not know which object is selected,
and therefore may not be able to supply the correct data later.

Signed-off-by: Asbjørn Sæbø <asbjorn.sabo@nordicsemi.no>
2021-04-19 16:18:16 +02:00
Torsten Rasmussen
3dd65a7663 runners: remove dependencies from runners
Today, there is a build target is added for each runner: flash, debug,
debugserver, attach.

And those runners will have a dependency to Zephyr logical target that
is built before invoking `west <runner>`.

This design has some flaws, mainly that additional dependencies directly
on the target will not be built when running `west <runner>` directly.
That generator expressions cannot be used for the DEPENDS argument.

Instead, the build target `<runner>` will not have any dependencies, and
will raise a build error if a dependency is added to the target.
Due to how `add_dependencies()` work, this must be done as a build time
check, and not configure time check.

`west <runner>` will invoke a build before executing the runner, and
this way ensure the build target is up-to-date, which again removes the
need for a dedicated `west_<runner>_target`.

It also minimizes the risk of developer errors, as developers no longer
need to consider the need for adding additional dependencies.
If a custom target is part of the default `all` build, then it's ensured
to be up-to-date.

Fixes: Issue reported on slack.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2021-04-19 15:35:30 +02:00
Frank Li
f0dbfec5cd boards: mm_swiftio: fix sdcard power issue
In mm_swiftio hardware design, NVCC_SD0 of rt1052 is directly connected
to 3.3V, without using VSELECT control, so 1.8V support needs to be
disabled by no-1-8-v of devicetree.

Signed-off-by: Frank Li <lgl88911@163.com>
2021-04-19 08:25:55 -05:00
Frank Li
42333dc282 driver: usdhc: add option to disable 1.8v
When 1.8V is disabled, sdhc can only
communicate at low speed. But this can
save the external circuit for switching
between 3.3V and 1.8V, which is very
practical in costdown scenarios.

Signed-off-by: Frank Li <lgl88911@163.com>
2021-04-19 08:25:55 -05:00
Peter Bigot
f69a38162a kernel: atomic: consistently use named type for atomic pointer values
There's a typedef for non-pointer values compatible with atomic
non-pointer objects.  Add a similar typedef for pointer values, and
the corresponding macro for initializing atomic pointer types.

This also will simplify replacing the Zephyr atomic API with one
based on C11 atomics, should that be desirable.  C11 atomic pointer
values are not void*.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2021-04-19 15:22:13 +02:00
Peter Bigot
50cf28adb4 samples: boards: nrf: clock_skew: update k_work API
Trivial transformation for a periodic task.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2021-04-19 08:16:13 -05:00
Giulio De Donato
e3a25b3b3a doc: on mac suggesting an alternative procedure for cmake
brew install

Signed-off-by: Giulio De Donato <liuggio@gmail.com>
2021-04-19 14:07:42 +02:00
Paul He
d61f3a7562 samples: metairq_dispatch: use name msgdev.h instead of main.h
Normally main.c file doesn't have a header, beacuse it doesn't need to
be declared to other modules.

And in this sample it makes more sense to use name msgdev.h instead of
main.h as the header file for msgdev.c.

Signed-off-by: Paul He <pawpawhe@gmail.com>
2021-04-19 10:32:39 +02:00
Vinayak Kariappa Chettimada
82925a8c99 Bluetooth: controller: Avoid sizeof to access ULL/LLL struct member
Avoid using sizeof to access ULL and LLL struct members.
Based on the alignment requirements of structures, due to
padding between structure members, use of sizeof of previous
struct member to access next struct member is incorrect.

Continue to use explicitly stored parent pointer to access
ULL context. Combine event header and ULL header so that
the parent pointer point directly to the combined ULL
struct.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-04-19 10:26:38 +02:00
Vinayak Kariappa Chettimada
e395c6ce2c Bluetooth: controller: Fix uninitialized ULL reference count
Fix missing initialization of reference count in
ull_hdr_init function.

This has not caused issues so far, but when the ref member
of the struct ull_hdr if placed in the beginning of a
context that is allocated using mem_acquire function then
first few bytes used would make the ref member to have
uninitialized value when such context is allocated by
mem_acquire. First few bytes are the next pointer and free
count stored by the mem module.

The issue was discovered in subsequent commits that
restructure the ULL context structures.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-04-19 10:26:38 +02:00
Vinayak Kariappa Chettimada
624e003064 Bluetooth: controller: Fix auxiliary scan context release
Fix the auxiliary scan context release to be performed in
the disabled_cb callback after the ULL reference count is
decremented.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-04-19 10:26:38 +02:00
Vinayak Kariappa Chettimada
3a80785947 Bluetooth: controller: Fix connection terminate to happen on event done
Fix conn_cleanup to be performed in the event done. The
regression was introduced in
commit 5412f61ac6 ("Bluetooth: controller: Introduce
separate done memq").

Now that done event is handled asynchronously outside the
handling of the terminate node rx type, it is necessary that
terminate node rx type is generated after the done event.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-04-19 10:26:38 +02:00
Wolfgang Puffitsch
13b4d441b3 Bluetooth: controller: Fix dependency of ISO TX buffer Kconfig
Synchronized Receiver does not require TX buffers.

Signed-off-by: Wolfgang Puffitsch <wopu@demant.com>
2021-04-19 10:22:59 +02:00
Wolfgang Puffitsch
88db0d4b45 Bluetooth: controller: Consolidate ISO role Kconfigs
Consolidate Kconfigs for ISO roles to make compilation guards more
concise. Just introduces aliases, does not change functionality.

Signed-off-by: Wolfgang Puffitsch <wopu@demant.com>
2021-04-19 10:22:59 +02:00
Bob Recny
9f9e2ec26f boards: arm: Add support for EVK-NINA-B3
Add support for u-blox EVK-NINA-B3 which uses the nRF52840.

This board is similar to the nRF52840dk_nrf52840 with
different pin assignments on the header pins and not having
the debug-in and shield SWD headers.

Tested with blinky, button, and Bluetooth peripheral_hr
Corrected permissions
Addressed review comments
Removed arduino_spi

Signed-off-by: Bob Recny <bob.recny@u-blox.com>
2021-04-19 10:22:40 +02:00
Carlo Caione
cd4b01e0bb arm64: Use syscall frame and fix bad syscall handling
This patch is fixing three related problems:

1. When calling a syscall the marshalling function is using the ssf
   parameter as value to be saved in _current->syscall_frame to mark the
   beginning and the end of the syscall. This ssf value is not currently
   being explictly set and instead the syscall code is using whatever
   value is stored in x6 when the syscall is called. If it happens that
   x6 is 0 at the time the syscall is called, this causes the
   z_is_in_user_syscall() function to fail. Fix this passing the ESF as
   value for ssf.

2. Given that in the ssf is now present the ESF, we can fix
   arch_syscall_oops() using the ESF to print a more detailed error
   message with registers dump.

3. When a wrong syscall number is used, handler_bad_syscall() is called.
   This function expects the ID number as first parameter to print the
   error message, fix this.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2021-04-18 22:04:52 -04:00
Maciej Perkowski
484ef6710d twister: Fix memory footprint reporting logic
With the previous logic memory footprint can only be saved in a report
if a given test/sample was fully executed and passed (built and run),
hence build-only tests were not providing these metrics. This commit
modifies the logic so that it is enough to have the build successful
to be able to get the memory footprint.

Signed-off-by: Maciej Perkowski <Maciej.Perkowski@nordicsemi.no>
2021-04-18 21:49:21 -04:00
Maciej Perkowski
73c5594573 twister: Fix ram/rom reporting
The info of rom/ram usage by an application was lost along the
way of data processing in twister. The commit add a line which
pass further these metrices as well.

Signed-off-by: Maciej Perkowski <Maciej.Perkowski@nordicsemi.no>
2021-04-18 21:49:21 -04:00