Commit graph

7985 commits

Author SHA1 Message Date
Meng xianglin
f039cc44a1 pm: refine defination of pm_dump_debug_info()
Provide dummy implementation of pm_dump_debug_info() as a
static inline function in pm.h.

Signed-off-by: Meng xianglin <xianglinx.meng@intel.com>
2021-08-19 10:19:24 -04:00
Pavel Vasilyev
0e9d668970 Bluetooth: Mesh: Add API to discard subscription in vendor model
This commit adds missing API that allows to discard the Subscription
List of a vendor model.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2021-08-19 10:19:02 -04:00
Pavel Vasilyev
538f97f737 Bluetooth: Mesh: Clarify name length in bt_mesh_model_data_store
Name length can't be longer than 8 bytes. This needs to be clarified
in the bt_mesh_model_data_store() documentation.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2021-08-19 10:19:02 -04:00
Piotr Pryga
6a848ec91b Bluetooth: controller: Add LE features for CTE req and resp
Add features: connection CTE request, connection CTE response
and receiving constant tone extensions; to HCI and features
supported by controller.
The features are not enabled yet.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2021-08-18 20:11:10 -04:00
Yong Cong Sin
eaa29d9d71 subsys/mgmt/hawkbit: Prevent multiple instances of hawkbit_probe
Use a semaphore to prevent the hawkbit_probe from running more than once
at the same time since it reset the hawkbit context on entry and will
affect other running instance.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2021-08-18 20:10:21 -04:00
Dino Li
7c2dfc1558 riscv: linker: correct _image_rom_size symbol info
This makes the _image_rom_size provide correct actual ROM image size.

Signed-off-by: Dino Li <Dino.Li@ite.com.tw>
2021-08-18 15:40:49 -04:00
Jim Shu
e3fe63a221 arch: riscv: remove unneeded context switch to gp register
RISC-V global pointer (GP) register is neither caller nor callee
register, and it's a constant value in the single ELF file. Thus, we
don't need to save/restore GP at ISR enter/exit. Remove it to optimize
context switch performance.

Signed-off-by: Jim Shu <cwshu@andestech.com>
2021-08-18 05:18:55 -04:00
Daniel Leung
8530cfa76d kernel: mark z_current_get() as const
In commit 00f95032938e1387126f453b64f8c479987ca16e to make
k_current_get() work without syscall, a new z_current_get()
was introduced since there are times when thread local
storage has not been initialized. However, this was not
marked with const attribute the same as k_current_get().
This may result in slower compiled code as each call to
z_current_get() may actually need to go through the whole
function call process instead of reusing the result from
previous call in the same scope. So add const attribute
to z_current_get() to restore the old behavior.

Fixes #37460

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-08-18 05:18:01 -04:00
Jordan Yates
93b4dbcc19 lora: lora_send blocks until completion
Change the behaviour of `lora_send` to block until the transmission
completes. The current asynchronous behaviour is exposed through the
new function `lora_send_async`. This naming convention brings LoRa in
line with other asynchronous subsystems.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-08-18 05:16:46 -04:00
Mahesh Mahadevan
f28672a448 drivers: clock_control: Update LPC clock driver for USDHC
Add support to get USDHC clock frequency

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2021-08-17 17:53:31 -04:00
Fabio Baltieri
7f36f90167 kernel: drop unused priority related definitions
There are no reference for either K_NUM_PRIORITIES or
K_NUM_PRIO_BITMAPS, with the former being dropped in:

  1acd8c2996 kernel: Scheduler rewrite

Dropping both of these, and also the two comments about extra priorities
taking extra RAM space, as those do not seem to apply either.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2021-08-17 17:52:17 -04:00
Krzysztof Chruscinski
58942f3f13 lib: os: ring_buffer: Fix race condition
Ring buffer claims that no synchronization is needed
when there is a single producer and single consumer.
However, recent changes have broken that promise since
indexes rewind mechanism was modifing head and tail
when consuming. Patch fixes that by spliting rewinding
of indexes so that producer rewinds tail only and
consumer rewinds head.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-08-17 19:52:08 +02:00
Vinayak Kariappa Chettimada
fc784a6406 Bluetooth: Add define for Extended Scannable Advertising parameters
Add a helper define for Extended Scannable Advertising
Parameters.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-08-17 17:36:19 +02:00
Andrei Emeltchenko
252ad12fe5 edac: ibecc: Fix return error type
Fix return error type.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2021-08-17 17:21:50 +02:00
Robert Szczepanski
fceb5a1c44 drivers: video: add more camera control IDs
Add more camera control IDs for cameras with more capabilities.

Signed-off-by: Robert Szczepanski <rszczepanski@antmicro.com>
2021-08-17 09:18:38 -04:00
Robert Szczepanski
69cc20bb17 drivers: video: add JPEG pixel format
Add JPEG pixel format needed for cameras with JPEG
compression capability.

Signed-off-by: Robert Szczepanski <rszczepanski@antmicro.com>
2021-08-17 09:18:38 -04:00
Bradley Bolen
d91e4a52de include: toolchain: Add LOG2CEIL macro
This macro is referenced by most of the architecture linker scripts, yet
it is only defined in the Metaware toolchain linker header.

Signed-off-by: Bradley Bolen <bbolen@lexmark.com>
2021-08-17 06:06:33 -04:00
Bradley Bolen
03f951c4f6 arch: arm: cortex_r: Move kobject text
Move the kobject text area to be at the beginning of the text section to
match Cortex-M.

Signed-off-by: Bradley Bolen <bbolen@lexmark.com>
2021-08-17 06:06:33 -04:00
Bradley Bolen
ef50545808 arch: arm: cortex_r: Add userspace support for non-XIP builds
When running non-XIP, userspace threads need to be able to read .text in
order to execute code.  Cortex-R needs to setup an MPU entry to allow
this, but it must be aligned to a power of 2.  The linker scripts for
other archs follow this same pattern of aligning the location counter,
but outside of an input section.  The linker ignores this and places the
next input section at the LMA of the end of the previous input section.
Avoid this problem by make RODATA the last ROM section.  The MPU_ALIGN
can be moved inside the RODATA input section and correctly pad the
entire ROM section out to a power of 2 boundary.

_image_rom_end_order contains the power of 2 alignment which allow the
soc to set the MPU configuration statically based on the size of the ROM
sections instead of having to do it dynamically.

Signed-off-by: Bradley Bolen <bbolen@lexmark.com>
2021-08-17 06:06:33 -04:00
Bradley Bolen
ff1a5e7858 arch: arm: cortex_r: Add ARCH_EXCEPT macro
With the addition of userspace support, Cortex-R needs to use SVC calls
to handle oops exceptions.  Add that support by defining ARCH_EXCEPT to
do a svc call.

Signed-off-by: Bradley Bolen <bbolen@lexmark.com>
2021-08-17 06:06:33 -04:00
Bradley Bolen
65dcab81d0 arch: arm: cortex_r: Do not use user stack in svc/isr modes
The user thread cannot be trusted so do not use the stack pointer it
passes in.  Use the thread's privilege stack when in privileged modes to
make sure a user thread does not trick the svc/isr handlers into writing
to memory it should not.

Signed-off-by: Bradley Bolen <bbolen@lexmark.com>
2021-08-17 06:06:33 -04:00
Phil Erwin
e0bed3b989 arch: arm: cortex_r: Add MPU and USERSPACE support
Use Cortex-M code as a basis for adding MPU support for the Cortex-R.

Signed-off-by: Phil Erwin <phil.erwin@lexmark.com>
2021-08-17 06:06:33 -04:00
Michael Zimmermann
5e7ef8be5a json: fix parsing first array-array element
Previously, the first element inside the array-array didn't contain the
decoded data.

Signed-off-by: Michael Zimmermann <sigmaepsilon92@gmail.com>
2021-08-16 15:11:20 -04:00
Kumar Gala
ed76b915cb pm: device: Fix if devicetree 'wakeup-source' prop isnt defined
Its possible that a dts binding doesn't inherit from base.yaml and
thus doesn't have `wakeup-source` defined.  To handle these cases
use DT_PROP_OR() which can deal with a property not existing at
all.

Fixes #37676

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-08-16 15:00:26 -04:00
Gerson Fernando Budke
a54fa4eb8e arch: riscv: common: linker: Add itcm & dtcm sections
The current riscv linker script don't have sections for
Data & Instruction Tightly Coupled Memory.  Add itcm and
dtcm sections to make it available.  All sections were
8 byte align to keep compatible with rv64 SoCs.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2021-08-14 20:27:52 -04:00
Evgeniy Paltsev
5d2be3d085 ARC: MWDT: workaround for double clockid_t definition
Don't define clockid_t in Zephyr in case of ARC MWDT libc
is used as ARC MWDT libc provides clockid_t.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Evgeniy Paltsev <PaltsevEvgeniy@gmail.com>
2021-08-13 13:43:19 -05:00
Evgeniy Paltsev
8097989a01 ARC: MWDT: workaround paddr_t defined in both Zephyr and toolchain
MWDT provides paddr_t type and it conflicts witn Zephyr definition:
- Zephyr defines paddr_t as a uintptr_t
- MWDT defines paddr_t as a unsigned long
This causes extra warnings. However we can safely define
paddr_t as a unsigned long for the case when MWDT toolchain is used as
they are both unsighned, have same size and aligning.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Evgeniy Paltsev <PaltsevEvgeniy@gmail.com>
2021-08-13 13:43:19 -05:00
Evgeniy Paltsev
e0a9a93cb5 ARC: MWDT: workaround missing ssize_t definition
ARC MWDT don't provide ssize_t type which is used in Zephyr.
Define ssize_t for ARC MWDT toolchain.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Evgeniy Paltsev <PaltsevEvgeniy@gmail.com>
2021-08-13 13:43:19 -05:00
Evgeniy Paltsev
a5788ff12d ARC: LIB: MWDT: add stdout hooks, timespec header
ARC MWDT toolchain misses stdout hooks implementation and
itimerspec structure in timespec header. Let's add them in
arcmwdt compatibility layer.

The implementation was inspired by libc-hooks.c for NEWLIB.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Evgeniy Paltsev <PaltsevEvgeniy@gmail.com>
2021-08-13 13:43:19 -05:00
Christoph Thurnheer
ef97121d74 lib: os: add gcc noreturn attribute for sys_reboot
sys_reboot doesn't return so mark it with noreturn

Signed-off-by: Christoph Thurnheer <c.thurnheer@gmx.ch>
2021-08-13 07:32:51 -04:00
Fabio Baltieri
171739d06e toolchain: deprecate the Z_ iterables api
Switch the actual API implementation to the external API and mark the
internal ones as __DEPRECATED_MACRO.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2021-08-12 17:47:04 -04:00
Fabio Baltieri
f88a420d69 toolchain: migrate iterable sections calls to the external API
This migrates all the current iterable section usages to the external
API, dropping the "Z_" prefix:

Z_ITERABLE_SECTION_ROM
Z_ITERABLE_SECTION_ROM_GC_ALLOWED
Z_ITERABLE_SECTION_RAM
Z_ITERABLE_SECTION_RAM_GC_ALLOWED
Z_STRUCT_SECTION_ITERABLE
Z_STRUCT_SECTION_ITERABLE_ALTERNATE
Z_STRUCT_SECTION_FOREACH

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2021-08-12 17:47:04 -04:00
Krzysztof Kopyściński
00bfac00ae Bluetooth: gatt: Add option to read multiple without variable length
Currently, with EATT enabled, when bt_gatt_read is called with multiple
handles first it'll try to use gatt_read_mult_vl, and if it fails
gatt_read_mult will be used to try again. Add option to skip
the gatt_read_mult_vl and use gatt_read_mult right away. This is needed
by tests that expect BT_ATT_OP_READ_MULT_REQ but support variable
lenght, thus don't return BT_ATT_ERR_NOT_SUPPORTED.

Removed fallback from read multiple vl to read multiple on
BT_ATT_ERR_NOT_SUPPORTED error.

This was affecting:
GATT/CL/GAR/BV-05-C, GATT/CL/GAR/BI-18-C, GATT/CL/GAR/BI-19-C,
GATT/CL/GAR/BI-20-C, GATT/CL/GAR/BI-21-C, GATT/CL/GAR/BI-22-C

Signed-off-by: Krzysztof Kopyściński <krzysztof.kopyscinski@codecoup.pl>
2021-08-12 11:07:08 -04:00
Ryan Erickson
e4dc8ed26b logging: Add log mem shell command
Add log mem shell command to determine memory pool
usage of logging system.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2021-08-12 11:06:32 -04:00
Andrew Hedin
b52ad8f3e1 logging: Add strdup current use to shell cmd
Add the number of strdup buffers currently in use to the
`log strdup_utilization` shell command.

Signed-off-by: Andrew Hedin <andrew.hedin@lairdconnect.com>
2021-08-12 11:06:32 -04:00
Kai Vehmanen
7d1f133107 sys: util: fix compilation with XCC
Xtensa XCC does not like C99 style declarations in for
loops.

Fixes: 268f9bf163 ("nuvoton: battery-backed ram")
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2021-08-12 09:17:14 -05:00
Scott Worley
2574d9848a Microchip: MEC172x: Add macro to encode ECIA GIRQ information
Add a macro for encoding interrupt source information: GIRQ number,
GIRQ bit position, GIRQ aggregated NVIC connection, and source
direct NVIC connection.

Signed-off-by: Scott Worley <scott.worley@microchip.com>
2021-08-11 19:44:45 -04:00
Flavio Ceolin
8eceeee798 pm: device: Add wakeup source API
Introduce a new API to allow devices capable of wake up the system
register themselves was wake up sources. This permits applications to
select the most appropriate way to wake up the system when it is
suspended.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-08-11 19:39:13 -04:00
Flavio Ceolin
a245ed2a87 pm: device: Change atomic flags type
Just using a simple atomic for flags instead of using an array.

While is neat using ATOMIC_DEFINE for future proof. The reality is
that it brings some problem for the wakeup source implementation
that needs to statically initialize it during the device definition.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-08-11 19:39:13 -04:00
Krzysztof Chruscinski
2aa1247998 lib: os: ring_buffer: Clarify macro description
Description was falsely static that macros statically creates
the ring buffer objects. Clarify description since variables
are not static.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-08-11 11:15:11 -04:00
Lingao Meng
23a9594944 Bluetooth: Add connect event structure to zsector
Add an optional version for connection events
to save some memory.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2021-08-11 13:42:28 +02:00
Christopher Friedt
5c7f395f8f Revert "include: driver: sensor: add tank level channel in units of percent"
This reverts commit f51aec4307.

Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>
2021-08-10 09:44:48 -05:00
Evgeniy Paltsev
497cb2e587 CPP: fix static objects init for MWDT toolchain
The constructors of static objects are stored in ".ctors"
section. In case of MWDT toolchain we have incompatible
".ctors" section format with GNU toolchain. So let's use
initialization code provided by MWDT instead of Zephyr one
in case of MWDT toolchain usage.

As it is done for GNU toolchain We call constructors of
static objects but we don't call destructors for them.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Evgeniy Paltsev <PaltsevEvgeniy@gmail.com>
2021-08-09 22:47:22 -04:00
Henrik Brix Andersen
13696f709e drivers: sensor: add hysteresis attribute
Add sensor API hysteresis attribute. This attribute allows for
configuring trigger threshold hysteresis values.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2021-08-09 19:50:29 -04:00
Nick Ward
f51aec4307 include: driver: sensor: add tank level channel in units of percent
Provides an enum for tank level sensor drivers.

Signed-off-by: Nick Ward <nick.ward@setec.com.au>
2021-08-09 16:24:50 -04:00
Carles Cufi
148005bfe1 arch: aarch32: Add build asserts for IRQ priority range
Figuring out what the lowest possible priority in platforms where
CONFIG_ZERO_LATENCY_IRQS is supported is not possible before the Kconfig
tree is built and resolved. In order to make the user's life easier,
abort the build if IRQ_CONNECT() is called with an invalid (i.e. too
low) priority.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2021-08-09 13:04:28 -04:00
Jordan Yates
abdd61c3e9 lora: fix lora_recv parameter description
The timeout parameter for `lora_recv` is no longer a millisecond value
but a standard `k_timeout_t` value.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-08-08 04:19:27 -04:00
Dino Li
91ba039381 riscv: linker: add support for FLASH_LOAD_OFFSET
This allows board to re-configure ROM_BASE address while building
firmware image.

For example, a board need to build two firmware images. And the images
are put into one flash and required to work independent:

config FLASH_LOAD_OFFSET
    default 0 if FIRST_IMAGE
    default 0x80000 if SECOND_IMAGE

Signed-off-by: Dino Li <Dino.Li@ite.com.tw>
2021-08-07 20:37:01 -04:00
Evgeniy Paltsev
42da43bd72 ARC: reuse ARConnect header for ARCv3
ARCv3 has ARConnect implementation similar to ARCv2, so
use existing ARConnect header for ARCv3 as well.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Evgeniy Paltsev <PaltsevEvgeniy@gmail.com>
2021-08-07 20:36:23 -04:00
Yuval Peress
268f9bf163 nuvoton: battery-backed ram
Add bindings and entry for the battery-backed ram in the nuvoton
npcx. This commit is an upstream port of
https://source.chromium.org/chromiumos/chromiumos/codesearch/+/main:src/platform/ec/zephyr/dts/bindings/cros_bbram/nuvoton,npcx-cros-bbram.yaml;l=1;drc=e9af813c36b7b411bf2a01cbc1b09d5fdec49b8a

Along with a bit of cleaning up and an emulator.

Signed-off-by: Yuval Peress <peress@chromium.org>
2021-08-07 20:32:33 -04:00