Commit graph

7457 commits

Author SHA1 Message Date
Emil Gydesen
87df76c7f7 Bluetooth: ISO: Improved text for setting ISO data paths
Improved the documentation for the ISO data paths, as well
as making the bt_iso_setup_data_path function a bit more
clear.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-05-03 11:59:25 +02:00
Tommie Skriver
7fac6a1bfd kernel: atomic: possibility of arch specific implementation
For non-specified archs, including those out-of-tree, the possibility to
use a specific implementation has been reintroduced.

CONFIG_ATOMIC_OPERATIONS_ARCH must be selected to utilize this.

Signed-off-by: Tommie Skriver <tosk@demant.com>
2021-05-03 11:57:46 +02:00
Nicolas Pitre
f1f63dda17 arm64: FPU context switching support
This adds FPU sharing support with a lazy context switching algorithm.

Every thread is allowed to use FPU/SIMD registers. In fact, the compiler
may insert FPU reg accesses in anycontext to optimize even non-FP code
unless the -mgeneral-regs-only compiler flag is used, but Zephyr
currently doesn't support such a build.

It is therefore possible to do FP access in IRS as well with this patch
although IRQs are then disabled to prevent nested IRQs in such cases.

Because the thread object grows in size, some tests have to be adjusted.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2021-05-03 11:56:50 +02:00
Nicolas Pitre
a82fff04ff arm64: implement exception depth count
Add the exception depth count to tpidrro_el0 and make it available
through the arch_exception_depth() accessor.

The IN_EL0 flag is now updated unconditionally even if userspace is
not configured. Doing otherwise made the code rather hairy and
I doubt the overhead is measurable.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2021-05-03 11:56:50 +02:00
Erwan Gouriou
675990c5e1 include/drivers/clock_control: stm32: Bits for H7 dts clock config
Add required macros to introduce dts based clock_control driver
configuration on stm32h7 devices.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-05-03 10:56:05 +02:00
Jordan Yates
bbd53dcde0 lorawan: port oriented downlink callbacks
Add downlink callbacks on a per-port basis. A single message will be
handled as many times as users have registered matching ports. Callbacks
will also be run on "meta" downlink packets on port 0, such as confirmed
uplink acknowledgements.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-04-30 13:05:10 -05:00
Jordan Yates
6e9500852a lorawan: minor formatting fixes
Fix a typo, remove a stray semicolon, convert a tab to a space.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-04-30 13:05:10 -05:00
Jordan Yates
a0909ac00b linker: stm32f0: move ram vector table to snippets
Move the STM32F0 specific ram vector table sections into a dedicated
linker snippet included by the new `SRAM_VECTOR_TABLE` symbol.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-04-30 15:16:02 +02:00
Jordan Yates
318ee971c5 boards: stm32f0: explicit RAM vector table control
Add a new Kconfig symbol that explicitly controls whether the vector
table should be placed in RAM. This eliminates the side effect of
`IS_BOOTLOADER` controlling vector table location. Making the condition
a positive assertion also allows the config to be used in CMakeLists
conditions (`zephyr_linker_sources_ifdef()`, etc).

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-04-30 15:16:02 +02:00
Daniel Leung
0ab8dc4d49 interrupt_controller: loapic: remove duplicate identifier
LOAPIC_TIMER is defined twice with same value, so remove one.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-04-29 21:09:54 -04:00
Erwan Gouriou
255c64bb94 include/drivers: clock_control: Add support for STM32WL bindings
Add support for STM32WL clocks bindings.

Additionally fix a spot where STM32WB was missing.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-04-29 16:41:26 +02:00
Erwan Gouriou
24969e8ab2 include/drivers: clock_control: Minor clean up on stm32 header
Reorder few lines for better readability.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-04-29 16:41:26 +02:00
Erwan Gouriou
8949f9b607 include/drivers: clock_control: Add support for STM32F7 bindings
Add support for STM32F7 clocks bindings.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-04-29 16:41:26 +02:00
Erwan Gouriou
276bcd724e include/drivers: clock_control: Add support for STM32L0 bindings
Add support for STM32L0 clocks bindings.

Also, add a small tweak to SYSCLK selection to factorize some lines.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-04-29 16:41:26 +02:00
Erwan Gouriou
68a29fc26d include/drivers: clock_control: Add support for STM32F2 bindings
Add support for STM32F2 clocks bindings.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-04-29 16:41:26 +02:00
Erwan Gouriou
0710aa69c3 include/drivers/clock_control: stm32: Update for F0/F3/G0/G4 support
Update macros for STM32F0/F3/G0/G4 clock configuration.
Additionally update matching drivers.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-04-29 16:41:26 +02:00
Erwan Gouriou
755d09e149 include/drivers/clock_control: stm32: Update for STM32F1 support
Add missing macros fro STM32F1 clock configuration

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-04-29 16:41:26 +02:00
Robert Lubos
0d1577f7fe net: lwm2m: Add API function to delete object instance
Since the API already has a function to create an LwM2M object instance,
it makes sense to add a corresponding delete funtion, allowing the
application to delete created objects.

Additionally, for the remote delete set the Registration Update trigger
only when not in bootstrap mode.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2021-04-29 09:51:54 -04:00
Keith Short
e7a9775cca adc: Move ADC acquisition time macros
Move the ADC acquisition time macros so that they can be utiliized by
devicetrees.

Signed-off-by: Keith Short <keithshort@google.com>
2021-04-29 09:50:18 -04:00
Krzysztof Chruscinski
a1829cf235 irq_offload: Remove ifdef from the api
Removed #ifdef that guarded irq_offload API.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-04-29 14:50:35 +02:00
Krzysztof Chruscinski
c482a572d4 kernel: heap: Add support for CONFIG_MULTITHREADING=n
Ensure that k_heap is not attempt to block the thread when
timeout is set and space cannot be allocated.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-04-29 14:50:35 +02:00
Krzysztof Chruscinski
3b4b7c3a37 kernel: mem_slab: Add support to no multithreading
Mem_slab supports allocation with timeout which blocks the context
if no slab is available. Updated to treat every timeout as K_NO_WAIT
when multithreading is disabled.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-04-29 14:50:35 +02:00
Marcin Niestroj
71c31c45c7 net: dns: add dns_resolve_reconfigure() API
So far there was no dedicated mechanism for replacing DNS servers with
new list. Add dns_resolve_reconfigure() API that allows to achieve that
in a thread-safe manner.

Introduce 3rd state in DNS context lifetime by converting from 'bool
is_used' to 'enum dns_resolve_context_state state'. This new
DEACTIVATING state allows to mark a DNS context as busy and safely close
context without holding lock. Closing DNS context with released lock
prevents deadlock in case net_context_close() has to synchronize with a
separate thread executing handler passed to net_context_recv() (which is
the case for example with ESP-AT WiFi driver).

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2021-04-29 08:00:09 -04:00
Jukka Rissanen
a1c4952dfd net: ipv4: Add IGMPv2 support
Add Internet Group Management Protocol v2 support, see RFC 2236
for details.

Fixes #2336

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2021-04-29 14:49:55 +03:00
Jukka Rissanen
d28e64c602 net: stats: Add IGMP statistics support
Collect IPv4 IGMP sent/received/dropped statistics.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2021-04-29 14:49:55 +03:00
Jukka Rissanen
e5043f5a7f net: if: Add IPv4 multicast address join/leave functions
Allows caller to mark IPv4 multicast address to be used or not.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2021-04-29 14:49:55 +03:00
Gerard Marull-Paretas
cc6c9086de pm: deprecate device_pm_control_nop
All in-tree usage has been replaced with `NULL`, so flag it as
deprecated.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-04-28 20:40:00 -04:00
Gerard Marull-Paretas
29733a8692 drivers: gpio: gpio_mmio32: remove usage of device_pm_control_nop
Replace usage of deprecated device_pm_control_nop with NULL.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-04-28 20:40:00 -04:00
Gerard Marull-Paretas
93774a4f84 net: remove references to device_pm_control_nop
Remove it from docstrings.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-04-28 20:40:00 -04:00
Gerard Marull-Paretas
39d3d397ae power: provide old reboot header for compatibility
Make out-of-tree applications transition easier by providing the same
header as before pointing to the new one. Once Zephyr modules are also
migrated this header should produce a deprecation warning if included.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-04-28 20:34:00 -04:00
Gerard Marull-Paretas
f163bdb280 power: move reboot functionality to os lib
Reboot functionality has nothing to do with PM, so move it out to the
subsys/os folder.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-04-28 20:34:00 -04:00
Erwan Gouriou
6f27412c5e include/drivers/clock_control: stm32: Fixup to ensure backward compat
In order to ensure backward compatibility, use the dts config
only if nodes have prop "clocks".

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-04-28 16:43:51 -04:00
Erwan Gouriou
15130c9a1f include/drivers/clock_control: stm32: Fix typo in LSE definition
Fix typo to enjoy expected LSE setting

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-04-28 16:43:51 -04:00
Daniel Leung
a5ab1a7518 logging: add support for dictionary based logging
This adds dictionary based logging support. Dictionary based
logging is binary based where one big difference is that
static strings are stored as pointers instead of the whole
string. This results in reduced space requirements for
storing log messages in certain scenairos.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-04-28 22:25:42 +02:00
Daniel Leung
2bd871df2a sparc: add _image_rodata_start/end to linker script
This adds the _image_rodata_start and _image_rodata_end
symbols to SPARC's arch linker script.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-04-28 22:25:42 +02:00
Daniel Leung
b23784bf7e nios2: add _image_rodata_start/end to linker script
This adds the _image_rodata_start and _image_rodata_end
symbols to NIOS2's linker script.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-04-28 22:25:42 +02:00
Gerard Marull-Paretas
9de14e8596 kernel: flag isr-ok functions using funcprops
Replace old notes marking ISR safe functions with the recently
introduced funcprops.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-04-28 14:32:39 -04:00
Krzysztof Chruscinski
e5eb1b179d lib: os: cbprintf: Suppress coverity false positive
Coverity is complaining about sizeof(v + 0) and it is used
here intentionally to promote variable. Added comment that should
suppress this error in the future.

Note that this macro will be used in all log messages so without
solving it before logging v2 is merged there will be a flood of
errors.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-04-28 20:06:20 +02:00
Gerard Marull-Paretas
6a6ebcec11 drivers: gpio: extend struct gpio_dt_spec initializers
Extend the number of available initializers for the `struct
gpio_dt_spec` with:

- GPIO_DT_SPEC_GET_BY_IDX(): allows initialization from a specific index
- GPIO_DT_SPEC_INST_GET_BY_IDX(): instance version of
  GPIO_DT_SPEC_GET_BY_IDX()
- GPIO_DT_SPEC_INST_GET(): instance version of GPIO_DT_SPEC_GET()

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-04-28 18:17:23 +02:00
Jennifer Williams
be916e04ea include: sys: time_units: fix missing final else
z_tmcvt() was missing final else statement in the
if else if construct. This commit removes the
else if in this small structure to comply with
guideline 15.7.

Signed-off-by: Jennifer Williams <jennifer.m.williams@intel.com>
2021-04-27 17:31:59 -04:00
Gerard Marull-Paretas
3daf9f2d97 net: remove usage of device_pm_control_nop
If device PM is not implemented just use NULL.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-04-27 16:28:49 -04:00
Gerard Marull-Paretas
bfce935caf power: remove device_pm_control_nop function
Devices that do not require PM should just use NULL.
`device_pm_control_nop` is still kept as an alias to NULL untill all
in-tree usage is replaced with NULL.

Code relying on device_pm_control function now returns -ENOTSUP
(equivalent to calling device_pm_control_nop).

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-04-27 16:28:49 -04:00
Hou Zhiqiang
0700a24276 devicetree: Add DT_FOREACH_CHILD_STATUS_OKAY macro
The macro only iterates the enabled child nodes and invokes
provided macro for each node.

Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
2021-04-27 13:32:55 -04:00
Daniel Leung
1117169980 kernel: generate placeholders for kobj tables before final build
Due to the use of gperf to generate hash table for kobjects,
the addresses of these kobjects cannot change during the last
few phases of linking (especially between zephyr_prebuilt.elf
and zephyr.elf). Because of this, the gperf generated data
needs to be placed at the end of memory to avoid pushing symbols
around in memory. This prevents moving these generated blocks
to earlier sections, for example, pinned data section needed
for demand paging. So create placeholders for use in
intermediate linking to reserve space for these generated blocks.
Due to uncertainty on the size of these blocks, more space is
being reserved which could result in wasted space. Though, this
retains the use of hash table for faster lookup.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-04-27 13:32:00 -04:00
Daniel Leung
c3711b3446 kernel: change metadata for priv_stacks to const
The metadata array for priv_stacks doesn't change and
can be marked const so this can put in ROM.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-04-27 13:32:00 -04:00
Peter Bigot
707dc22fb0 kernel: fix error in synchronous work cancellation return value
The return value is documented to be true if the work was pending, but
the implementation returned true only if the work was actually running
(i.e. the caller had to wait).  It should also return true if
scheduled or submitted work was cancelled.

Note that this means the return value cannot be used to determine
whether the call slept.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2021-04-27 13:28:45 -04:00
Robert Lubos
afaf52af66 net: trickle: Do not initialize a work item from its handler
Initializing a work item from its handler will destroy the content of
the kernel structures used to process the work item. This can lead to a
system crash for example when the delayed work is being rescheduled when
the previous run is already queued for processing but not yet executed.

Fix this by initializing the work item once during trickle timer
creation and moving the logic, previously achieved by switching the work
handler, into the new work handler.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2021-04-27 19:48:16 +03:00
Krzysztof Chruscinski
2115964929 logging: Fix casting related C++ warnings
Fixed C++ warnings coming from implicit casting.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-04-27 08:48:03 -05:00
Krzysztof Chruscinski
d863b93516 lib: os: cbprintf: Prevent using _Generic in C++
Add guard to not use C11 specific feature when in C++.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-04-27 08:48:03 -05:00
Krzysztof Chruscinski
1f3758ff9e logging: Macro cleanup to fix cpp warnings
Cleanup to fix warnings coming from c++ compilation.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-04-27 08:48:03 -05:00