Commit graph

15409 commits

Author SHA1 Message Date
Krzysztof Chruscinski
154ca8526c logging: Use runtime packaging in immediate mode
Always use runtime packaging in immediate mode. Removing attempt to
package on stack if possible. It would be done only to speed up
logging but that is not a requirement in immediate mode where
packaging time is fractional compared to backend processing. Using
runtime packaging also reduces stack usage in the context which calls
log message.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-02-22 14:44:11 +01:00
Ederson de Souza
827d07abbc net: Fix macro for XCC
NET_SOCKET_GET_NAME macro adds some extra parenthesis that, on XCC (based
on GCC 4.2) ends up in the generated assembly, thus causing `as` to error
with:

  Error: junk at end of line, first unrecognized character is `('

It appears that the parenthesis are actually concatenated to the
generated name for identifier. This patch just removes them.

Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
2022-02-21 22:17:27 -05:00
Andy Ross
73453a39d1 arch: Add IRQ_OFFSET_NESTED feature
The x86 and xtensa implementations of irq_offload() invoke synchronous
interrupts on the local CPU, and are therefore safe to use from within
an interrupt context.  This is a cheap and portable way to exercise
nested interrupts, which are otherwise highly platform-dependent to
test.  Add a kconfig to signal the capability.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2022-02-21 22:10:03 -05:00
Daniel Leung
cb929597cd bluetooth: remove @return doc for void functions
For functions returning nothing, there is no need to document
with @return, as Doxgen complains about "documented empty
return type of ...".

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-02-21 22:07:44 -05:00
Daniel Leung
697baef0b1 kernel: remove @return doc for void functions
For functions returning nothing, there is no need to document
with @return, as Doxgen complains about "documented empty
return type of ...".

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-02-21 22:07:44 -05:00
Lingao Meng
2cf069df6b Bluetooth: Mesh: Opt ram of transport segment message
As use for simple message with no-segment send or receive.

This will be useful for ram-resource-constrained device.
such as bbc-microbit-v1.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2022-02-21 22:06:38 -05:00
Juha Heiskanen
3e04783bbb net: lwm2m: LwM2M Portfolio object id support
Added support for Portfolio object support because LwM2M v1.1 conformance
test requirement that. This object is only for conformance test purposing.

Signed-off-by: Juha Heiskanen <juha.heiskanen@nordicsemi.no>
2022-02-21 22:02:44 -05:00
Aleksander Wasaznik
299fac833b Bluetooth: Host: Settings: Handle extra settings_load before bt_enable
Before this change, enabling CONFIG_BT_SETTINGS and calling
settings_load(), but delaying / not calling bt_enable would trigger an
assertion error due to a timeout. The fault is that the settings load
handler for the Bluetooth host assumes bt_enable has already been called
and sends HCI commands to the controller. This times out if HCI is not
running.

The fix is to skip loading Bluetooth settings before bt_enable. The doc
is updated to guide the user on how to enable Bluetooth after settings
have been loaded before.

Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
2022-02-21 22:02:34 -05:00
Gerard Marull-Paretas
01bc8f7dd9 drivers: uart: remove uart_device_config
This structure is no longer used by drivers. Instead, each driver is
responsible to define the required fields and the types that are needed.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-02-21 22:02:23 -05:00
Carlo Caione
18ffcdcf74 linker: Introduce zephyr,memory-region compatible
Introduce a new "zephyr,memory-region" compatible to be used when a new
memory region must be created in the linker script from the devicetree
nodes using the compatible.

Remove also the LINKER_DT_REGION_FROM_NODE macro and add a new
LINKER_DT_REGIONS macro to cycle through all the compatible regions.

In the same PR modify the DTS files and the linker scripts.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2022-02-21 22:02:04 -05:00
Dino Li
36164c29c1 espi: it8xxx2: enable configuration of Chromebook
This enables the below configuration so the AP and EC are able to
communicate over eSPI:

CONFIG_ESPI_PERIPHERAL_EC_HOST_CMD
CONFIG_ESPI_PERIPHERAL_ACPI_SHM_REGION
CONFIG_ESPI_PERIPHERAL_CUSTOM_OPCODE

Signed-off-by: Dino Li <Dino.Li@ite.com.tw>
2022-02-21 22:01:48 -05:00
Dino Li
f3c1acaeea riscv: linker: move snippets-ram-sections.ld to ram start
This align the RISC-V linker script with ARM linker script.
(The snippets-ram-sections.ld is included first inside the
RAMABLE_REGION)

Signed-off-by: Dino Li <Dino.Li@ite.com.tw>
2022-02-21 22:01:48 -05:00
Ryan Erickson
cdff607d74 modem: hl7800: Make sleep mode configurable
Allow application to choose between 3 different low power levels of modem.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2022-02-21 21:57:52 -05:00
Marc Herbert
4990001013 lib/os: clarify that the winstream object does not track reads
Clarify that the reader MUST track the last sequence number read and
that the 'start' offset is not involved in that.

Some pre-conceptions + the sentence "the current state of the stream"
threw me off for a while. Thanks Andy for explaining this to me.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-02-21 20:59:48 -05:00
Tom Burdick
e8389f2f53 dma: intel_adsp: Reduce irq setup code
Makes the IRQ_CONNECT macro statically declarable for Xtensa (nothing
prevented it except its structuring). Allows for IRQ_CONNECT usage
on a xtensa only platform to be declared statically avoiding the
fluff of setting up and enabling irqs for cavs gpdma.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2022-02-21 20:59:08 -05:00
Carlo Caione
c5894df5ec pm: Change parameters of pm_power_state_{set,exit_post_ops}
Just pass state and substate_id instead of the whole info structure
pointer.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2022-02-21 20:58:01 -05:00
Carlo Caione
11f1dd2370 pm: Reference pm_state_info only by pointer
It's unnecessary to move the pm_state_info around by value, just use a
pointer.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2022-02-21 20:58:01 -05:00
Immo Birnbaum
ba4e7a8044 linker: add OCM data/bss sub-section start/end markers
Add the extern declarations for the data and bss sub-section start and
end markers for memory of type OCM, so that the bss section within the
OCM memory can be properly zeroed at boot time.

Signed-off-by: Immo Birnbaum <Immo.Birnbaum@weidmueller.com>
2022-02-21 20:53:44 -05:00
Carlo Caione
160dc83f5b arm: mpu: Add missing RAM NOCACHE region define
Add missing define for a non-cacheable RAM region for MPU.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2022-02-21 20:53:04 -05:00
Henning Fleddermann
7eb25df526 net: lib: lwm2m: add lwm2m_engine_is_observed function
add helper function to check wether a specific lwm2m
path is observed

Signed-off-by: Henning Fleddermann <henning.fleddermann@grandcentrix.net>
2022-02-21 20:50:52 -05:00
Emil Gydesen
24bca9b27b Bluetooth: Host: Avoid address copy for PA list
Avoids copying the address and assigning the SID if the
PA list is used, as the values are ignored by the
controller, and thus there is no reason to copy
or assign the values.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-02-21 20:50:22 -05:00
Krzysztof Chruscinski
df9b8721e2 logging: Prevent multiple arguments evaluation
Logging v2 is utilizing complex preprocessing operations to
prepare message at compile time. Multiple operations are peformed
on log message arguments. However, it is expected that argument
will be evaluated only once (e.g. it can be a call to a function
with side effects). Adding additional layer which creates copies
of user arguments on stack and passes them to further processing.

Updated test for log_msg2 which is using internal macro which
got renamed.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-02-21 20:41:17 -05:00
Krzysztof Chruscinski
81ce6db313 logging: Add common api for getting memory usage
Logging v2 did not support getting memory usage data. Adding this
support by creating common api for getting current and maximum
usage. Tracking of maximum usage is optional and can be enabled
using CONFIG_LOG_MEM_UTILIZATION.

Updated shell command to use common API.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-02-21 20:41:17 -05:00
Krzysztof Chruscinski
5c8cc1aa8f lib: os: mpsc_pbuf: Add usage tracking
Add API to fetch current buffer usage. Add option to track
maximum buffer usage and API to fetch that value.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-02-21 20:41:17 -05:00
Andrei-Edward Popa
9aadd76cbd include: dt-bindings: pinctrl: added I2C macros for Raspberry Pi Pico
added I2C pin macros for pinctrl of Raspberry Pi Pico board

Signed-off-by: Andrei-Edward Popa <andrei_edward.popa@upb.ro>
2022-02-21 19:42:07 -05:00
Yuriy Vynnychek
17e6d1c6c1 include: dt-bindings: b91_pinctrl: new pinctrl driver support
Added basic support for new pinctrl driver.

Signed-off-by: Yuriy Vynnychek <yura.vynnychek@telink-semi.com>
2022-02-21 19:41:44 -05:00
Herman Berget
4c980233af Bluetooth: Host: Add L2CAP collision mitigation test
Tests that when a collision happens, the connection attempt is retried
and that it succeeds.

Signed-off-by: Herman Berget <herman.berget@nordicsemi.no>
2022-02-21 19:40:42 -05:00
Herman Berget
8b46aaaf69 Bluetooth: Add common BT_CONN_INTERVAL_TO_MS macro
The same macro was defined in multiple places.

Signed-off-by: Herman Berget <herman.berget@nordicsemi.no>
2022-02-21 19:40:42 -05:00
Emil Gydesen
6c3a8ee556 Bluetooth: Buf: Add missing support for ISO timestamp size
The BT_BUF_ISO_SIZE macro was using BT_HCI_ISO_DATA_HDR_SIZE
which does not account for the optional timestamp value in
the header. Changed to use BT_HCI_ISO_TS_DATA_HDR_SIZE.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-02-21 19:40:02 -05:00
Henrik Brix Andersen
1f57e73730 canbus: isotp: ensure consecutive frames are sent in FIFO order
Ensure that ISO-TP Consecutive Frames (CF) are sent in
FIFO/chronological order.

In order to ensure this, we can only have one CF queued in the CAN
controller TX mailboxes at a time, since transmit order for mailboxes
with the same CAN-ID (priority) is hardware specific.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-02-21 19:37:35 -05:00
Henrik Brix Andersen
fc5f792ec8 drivers: can: document behavior when multple frames are queued for tx
Document the expected CAN controller driver behavior when multiple CAN
frames are queued for transmission.

Fixes: #26541

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-02-21 19:37:35 -05:00
Krzysztof Chruscinski
29407a4859 lib: os: cbprintf: Fix clang guard for _Generic support
Clang introduced _Generic support in 3.0 but it was buggy until
3.8. Updated guard to not use _Generic in clang < 3.8.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-02-18 10:38:23 -05:00
Yuval Peress
43dd84b366 pm: Fix unused-parameter warnings
Add various `ARG_UNUSED` to avoid warnings.

Signed-off-by: Yuval Peress <peress@google.com>
2022-02-15 13:07:03 -05:00
Xabier Marquiegui
52be66919e net: gptp: convert clock sync ratio from float to double
Using clock sync ratio as double instead of float improves
synchronization smoothness

Signed-off-by: Xabier Marquiegui <xmarquiegui@ainguraiiot.com>
2022-02-11 10:03:05 -06:00
Jordan Yates
e46be31600 net: buf: remove gcc dependency
Placing a struct with a flexible array member inside another struct not
as the last member is a GCC only extension. The offending macro is only
used to allocate enough space sufficient for a `struct net_buf`.
Therefore the dummy type declaration can simply use a byte array of the
same size as a `struct net_buf`, instead of the `struct net_buf` itself.

Fixes #42586.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-02-09 22:13:56 -05:00
Maureen Helm
f60f034c07 Revert "logging: Prevent multiple arguments evaluation"
This reverts commit 3f56567b08 which
caused build failures with the XCC toolchain on all samples and tests,
as well as a runtime failure with the nrf52_bsim board on
tests/bluetooth/bsim_bt/bsim_test_mesh.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2022-02-08 17:02:48 -05:00
Georgij Cernysiov
8a4b078c85 include: drivers: clock_control: stm32: fix xtpre
Correct DT property to set correct STM32_PLL_XTPRE value.
The driver bindings defined `xtpre` instead of used `xtre`
in the `DT_PROP` macro.
That allows to use F1 PLL clock with division by 2.

Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
2022-02-08 10:20:53 -05:00
Bradley Bolen
643084de0b arch: arm: core: aarch32: Use cmsis functions
These functions help the code to be more self-documenting.  Use them to
make the code's intent clearer.

Signed-off-by: Bradley Bolen <bbolen@lexmark.com>
2022-02-08 07:35:43 -05:00
Krzysztof Chruscinski
3f56567b08 logging: Prevent multiple arguments evaluation
Logging v2 is utilizing complex preprocessing operations to
prepare message at compile time. Multiple operations are peformed
on log message arguments. However, it is expected that argument
will be evaluated only once (e.g. it can be a call to a function
with side effects). Adding additional layer which creates copies
of user arguments on stack and passes them to further processing.

Updated test for log_msg2 which is using internal macro which
got renamed.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-02-08 07:32:43 -05:00
Henning Fleddermann
3018279c30 net: lib: lwm2m: make pathstr parameter const correct
many functions in the lwm2m librarys api take a pathstr argument
that is never written to, so make it const

Signed-off-by: Henning Fleddermann <henning.fleddermann@grandcentrix.net>
2022-02-08 07:27:30 -05:00
Maureen Helm
5b2e447751 sys: heap_listener: Fix initializers for XCC toolchain
XCC (which is based on GCC 4.2) needs the initializer of one of the
union elements to be enclosed in brackets.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2022-02-07 10:50:12 -05:00
Erwan Gouriou
a775606ae9 include: devicetree.h: Remove deprecated macros
These macros were deprecated in V2.6.0 release.
Remove them now.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-02-05 06:26:25 -05:00
Erwan Gouriou
d5b8af024b include/devicetree: dma.h: Remove deprecated macros
These macros were deprecated in V2.6.0 release.
Remove them now.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-02-05 06:26:25 -05:00
Erwan Gouriou
9e36486df4 include/devicetree: io-channels.h: Remove deprecated macros
These macros were deprecated in V2.6.0 release.
Remove them now.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-02-05 06:26:25 -05:00
Erwan Gouriou
45c53e9508 include/devicetree: pwms.h: Remove deprecated macros
These macros were deprecated in V2.6.0 release.
Remove them now.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-02-05 06:26:25 -05:00
Erwan Gouriou
0a32afdd75 include/devicetree: clocks.h: Remove deprecated macros
These macros were deprecated in V2.6.0 release.
Remove them now.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-02-05 06:26:25 -05:00
Carles Cufi
7f6524949a lib: os: crc: Rework the crc16() implementation
As described in #42403, there was an issue with the existing crc16_ansi()
implementation, since it was not calculating the CRC-16-ANSI (aka
CRC-16-MODBUS). This is because the  existing crc16() function only
supported non-reflected input and output (and the CRC-16-ANSI requires
reflection on both) and also it did not seem to support correctly inial
seeds different from 0x0000 (and, again, the CRC-16-ANSI requires 0xffff
as an initial seed).

This commit replaces the existing crc16() with a functional pair,
crc16() and crc16_reflect(), that also work with any poly, any initial seed
and allow to select whether reflection is performed.
It also adapts crc16_ansi() so that it actually returns the correct CRC.

Fixes #42403.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2022-02-04 12:33:22 -05:00
Carles Cufi
2a5051f369 include: sys: crc: Clarify documentation of two crc functions
The crc16_ccitt and crc16_itu_t functions' documentation could lead to
slight misunderstandings because of the fact that, although they bear
those names, those functions are actually able to compute CRCs that bear
other names, depending on the inital seed provided and an optional XOR
on the result.
In order to avoid confusion, document thoroughly with links to the
standard reveng page that lists all existing CRCs.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2022-02-04 12:33:22 -05:00
Martí Bolívar
baf2e7f3c5 api: gpio: add missing member docstrings for gpio_dt_spec
This makes the breathe output for this type useful.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2022-02-04 11:20:46 +01:00
Daniel Leung
e2f109456c lib/os: cbprintf_packaged: add ability to use external formatter
This adds to the cbprintf_packaged library to allow external
formatters to be used by the way of callback. This will allow
logging backends to use their own formatter for output if
needed.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-02-04 11:14:55 +01:00