Commit graph

42803 commits

Author SHA1 Message Date
Gerson Fernando Budke 29544a1ceb updatehub: Move from lib to subsys:mgmt folder
Zephyr introduced subsys/mgmt folder for MCU management. Move UpdateHub
to this newly and dedicated space.

Signed-off-by: Gerson Fernando Budke <gerson.budke@ossystems.com.br>
2020-08-03 16:33:06 +02:00
Maureen Helm 6364338815 boards: arm: Fix incorrect Kconfig dependencies for FXAS21002_DRDY_INT1
The fxas21002 sensor driver defines the Kconfig symbol
FXAS21002_DRDY_INT1 to depend on FXAS21002_TRIGGER, but the warp7_m4
board defconfig was incorrectly overriding it to depend on FXAS21002.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2020-08-03 13:52:24 +02:00
Maureen Helm 700d08e0f5 boards: arm: Fix incorrect Kconfig dependencies for FXOS8700_DRDY_INT1
The fxos8700 sensor driver defines the Kconfig symbol FXOS8700_DRDY_INT1
to depend on FXOS8700_TRIGGER, but several board defconfigs were
incorrectly overriding it to depend on FXOS8700.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2020-08-03 13:52:24 +02:00
Alexandre Bourdiol 2f6beb31d4 boards: arm: nucleo_g474re: add device tree rng okay
Tested with tests/drivers/entropy

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2020-08-03 13:52:04 +02:00
Maureen Helm 22b512ef0e boards: arm: Fix broken link in lpcxpresso55s16 board doc
Fixes a broken link to the lpc55s16 soc user manual.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2020-08-03 13:51:42 +02:00
Mahesh Mahadevan 59b045e6a4 MXRT600: Update defconfig SYS_CLOCK value
The power API for this platform is available in binary form
which cannot be included inside Zephyr. This platform is running
at the slower default speed till we have a way to call the power
API's to raise the core voltages.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2020-08-03 13:50:32 +02:00
chao an 9e64d379f0 Bluetooth: Mesh: configurable advertiser stack size
Add a configurable Kconfig option for advertiser thread stack size

Change-Id: Ia59a03311706de929d1833fa46cff66652620e7a
Signed-off-by: chao an <anchao@xiaomi.com>
2020-08-03 13:50:21 +02:00
Rihards Skuja 4a16095e8a drivers: sensor: nrf5: only assert on errors
After changes made in ff089217cb, clock control release can now return
non-negative values on success.

Signed-off-by: Rihards Skuja <rihardssk@mikrotik.com>
2020-08-03 13:50:08 +02:00
Krzysztof Chruscinski e4d14e8516 drivers: serial: nrf_uart: Improve detection of late uart_rx_buf_rsp
Removed potential race condition between uart being disabled and
rx_buf_rsp call.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2020-08-03 13:49:57 +02:00
Krzysztof Chruscinski b5c6e2f263 drivers: serial: nrf_uarte: Detect late uart_rx_buf_rsp call
Added detection of uart_rx_buf_rsp call which happend to late when
uart is already disabled.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2020-08-03 13:49:57 +02:00
Krzysztof Chruscinski 2891256b67 drivers: serial: Add error code to uart_rx_buf_rsp
API did not cover a case when uart_rx_buf_rsp is called when receiver
is already disabled. It may happen if uart_rx_buf_rsp is called too
late and active transfer is already finished. In that case -EACCES is
returned.

Some implementations already returned that error in that case.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2020-08-03 13:49:57 +02:00
Andrei Emeltchenko fb44188ebb west: sign: Move imgtool specific docs to appropriate place
Move documentation specific to imgtool to appropriate place.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2020-08-03 13:49:17 +02:00
Andrei Emeltchenko 51182ab881 west: sign: Add rimage signing tool documentation
Add documentation specific to rimage signing tool.

Fixes #26596

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2020-08-03 13:49:17 +02:00
Andrew Boie 8b531aa996 canbus: use kernel stacks
These threads don't run in user mode, save some memory
if userspace is enabled.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-08-02 10:50:12 -04:00
Marcin Niestroj 4137d3380f net: ppp: select RING_BUFFER via Kconfig
PPP implementation uses ring_buffer API, but RING_BUFFER Kconfig option
was not selected so far. This resulted in linker errors about undefined
reference to `ring_buf_get_claim' and 'ring_buf_put'.

Add missing RING_BUFFER selection via Kconfig, so PPP driver is properly
built.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-08-01 08:13:50 -04:00
Andrew Boie c0d3ed0d1c net: use kernel stacks
These threads don't run in user mode, save some memory if
userspace is enabled.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-08-01 08:13:15 -04:00
Andrew Boie 5a137998bf shell: SHELL_DEFINE() create kernel stacks
These shell threads run in supervisor mode.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-08-01 08:12:47 -04:00
Andrew Boie 99c211dbc6 shell: fix irq stack extern declaration
This is a kernel stack now.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-08-01 08:12:47 -04:00
Carles Cufi 244f826e3c cmake: remove _if_kconfig() functions
This set of functions seem to be there just because of historical
reasons, stemming from Kbuild. They are non-obvious and prone to errors,
so remove them in favor of the `_ifdef()` ones with an explicit
`CONFIG_` condition.

Script used:

git grep -l _if_kconfig | xargs sed -E -i
"s/_if_kconfig\(\s*(\w*)/_ifdef(CONFIG_\U\1\E \1/g"

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-08-01 12:35:20 +02:00
Vinayak Kariappa Chettimada dc48999ee1 Bluetooth: controller: Fill event counter in sync info
Fill the referenced event counter of the Periodic
Advertising SYNC_IND PDU into the sync info struct in the
Common Extended Advertising Header Format.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-07-31 19:04:23 +02:00
Jordan Yates 8896da1d60 drivers: serial: uart_nrfx_uarte: init cleanup rx
When `CONFIG_UART_ASYNC_API` is enabled, cleanup any pending synchronous
receptions at initialization time. Pending receptions are present when
this driver is used with the default mcuboot application.

When `CONFIG_UART_ASYNC_API` is not enabled, RX is always enabled by
this driver. As mcuboot does not use the async API, and does not cleanup
the UART driver before jumping to the next application, that application
boots with RX still enabled. This results in a 500uA increase in current
consumption.

Fixes #26555

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2020-07-31 18:47:55 +02:00
Carles Cufi 6b9ea24b1d manifest: Update MCUBoot revision
Commit 135b5ce860 was mistakenly merged with a reference to a Pull
Request instead of a SHA. Correct this so that it references a real SHA.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-07-31 18:32:44 +02:00
Jukka Rissanen dea5b74a2c net: Separate net_pkt priority from traffic class
User can always set the network packet priority as it is not
related to traffic class.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-07-31 18:11:51 +02:00
Alexandre Bourdiol 8978071334 STM32H7: manage Dual core boot whatever option bytes configuration
Manage Dual core boot automatically whatever Option Bytes
configuration.
No more need of KConfig STM32H7_DUAL_CORE_BOOT to match
Option Bytes.

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2020-07-31 11:09:18 -05:00
Eug Krashtan a6ea1cffc9 boards: dts: Fix broken link in comment
Update broken hyperlink in comment to current location

Signed-off-by: Eug Krashtan <eug.krashtan@gmail.com>
2020-07-31 09:00:32 -05:00
Carles Cufi c200b1c5e6 mgmt: Move mcumgr into its own folder
In order to be able to add more entries under 'subsys/mgmt', move the
current contents of it, which relate exclusively to MCUMgr, to its own
folder.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-07-31 08:46:53 -05:00
Mahesh Mahadevan 209084e745 MXRT600: Add I2C support
Enable I2C access to FXOS7000 sensor on the mxrt685_evk board

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2020-07-31 08:23:20 -05:00
Jakub Rzeszutko b83e4224e0 shell: correct build-in commands definition
The definition of the help command has been changed
so that it does not accept the arguments.
Thanks to this it cannot be marked by the "select" command.

Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordisemi.no>
2020-07-31 11:54:34 +02:00
Jakub Rzeszutko 5aaac4b72e shell: update select command help message
Added information that a command must accept arguments to be selected.

Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordisemi.no>
2020-07-31 11:54:34 +02:00
Jakub Rzeszutko e76cd05e18 shell: fix select command
If the command buffer is empty the shell was trying to read a string
from a random memory location. Added a condition checking "argc" value
when the select command is executed.

Fixes: #27227

Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordisemi.no>
2020-07-31 11:54:34 +02:00
Andrew Boie e90873f290 tests: thread_stack: armv8 without SPLIM
Need to test MPU guards on ARMv8.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-07-30 21:11:14 -04:00
Andrew Boie 8067127a6f tests: thread_stack: enforce identities
There are predictable relationships between the actual size
of a stack object, the return value of K_*_STACK_SIZEOF() macros,
and the original size passed in when the stack was declared.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-07-30 21:11:14 -04:00
Andrew Boie 5bd9afe484 doc: porting: add stack object details
Explain best practices for defining stack object macros.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-07-30 21:11:14 -04:00
Andrew Boie b4ce7a77c6 kernel: sys_workq thread stack is kernel-only
The system workqueue is a kernel thread that doesn't run
in user mode.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-07-30 21:11:14 -04:00
Andrew Boie 0c297461c5 kernel: idle thread stacks are kernel-only
The idle thread(s) always run in supervisor mode.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-07-30 21:11:14 -04:00
Andrew Boie 8b4b0d6264 kernel: z_interrupt_stacks are now kernel stacks
This will save memory on many platforms that enable
user mode.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-07-30 21:11:14 -04:00
Andrew Boie 8ce260d8df kernel: introduce supervisor-only stacks
These stacks are appropriate for threads that run purely in
supervisor mode, and also as stacks for interrupt and exception
handling.

Two new arch defines are introduced:

- ARCH_KERNEL_STACK_GUARD_SIZE
- ARCH_KERNEL_STACK_OBJ_ALIGN

New public declaration macros:

- K_KERNEL_STACK_RESERVED
- K_KERNEL_STACK_EXTERN
- K_KERNEL_STACK_DEFINE
- K_KERNEL_STACK_ARRAY_DEFINE
- K_KERNEL_STACK_MEMBER
- K_KERNEL_STACK_SIZEOF

If user mode is not enabled, K_KERNEL_STACK_* and K_THREAD_STACK_*
are equivalent.

Separately generated privilege elevation stacks are now declared
like kernel stacks, removing the need for K_PRIVILEGE_STACK_ALIGN.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-07-30 21:11:14 -04:00
Andrew Boie c7f33a7759 tests: thread_stack: show carveout, unused space
Currently for informational purposes, although we do check that
the carveout is smaller than the stack_size.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-07-30 21:11:14 -04:00
Andrew Boie 7151947c07 tests: thread_stack: dump IRQ stack information
Purely for informational purposes.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-07-30 21:11:14 -04:00
Andrew Boie 7111f162b8 tests: thread_stack: strengthen access check
thread->stack_info is now much more well maintained. Make these
tests that validate that user mode has no access just outside
the bounds of it, instead of the entire object.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-07-30 21:11:14 -04:00
Andrew Boie f856d0cf40 tests: move stacks testing to its own application
Most of these checks can be performed on non-userspace
supporting platforms.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-07-30 21:11:14 -04:00
Andrew Boie 59a75dd3a8 arches: centralize noinit linker defintiions
This had been copy-pasted between linker scripts, create
a central header for it.

The linker scripts for xtensa and posix have very different
structure and have been left alone.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-07-30 21:11:14 -04:00
Andrew Boie 1331a83905 tests: userspace: enforce sub-stacks are aligned
Check that the base of every stack object is properly
defined. This can get messed up if K_THREAD_STACK_ARRAY_DEFINE
isn't specified properly.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-07-30 21:11:14 -04:00
Andrew Boie e4cc84a537 kernel: update arch_switch_to_main_thread()
This now takes a stack pointer as an argument with TLS
and random offsets accounted for properly.

Based on #24467 authored by Flavio Ceolin.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-07-30 21:11:14 -04:00
Andrew Boie d538f098a7 thread_stack: clarify Z_THREAD_STACK_BUFFER docs
Make it clear that this just returns a pointer past the
reserved area.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-07-30 21:11:14 -04:00
Andrew Boie 82b5940fa0 kernel: clarify k_thread_create() docs
Thread objects were moved out of the stack a long time ago.

Replacing this incorrect information is some clarification
on acceptable size values to pass in.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-07-30 21:11:14 -04:00
Andrew Boie b0c155f3ca kernel: overhaul stack specification
The core kernel computes the initial stack pointer
for a thread, properly aligning it and subtracting out
any random offsets or thread-local storage areas.
arch_new_thread() no longer needs to make any calculations,
an initial stack frame may be placed at the bounds of
the new 'stack_ptr' parameter passed in. This parameter
replaces 'stack_size'.

thread->stack_info is now set before arch_new_thread()
is invoked, z_new_thread_init() has been removed.
The values populated may need to be adjusted on arches
which carve-out MPU guard space from the actual stack
buffer.

thread->stack_info now has a new member 'delta' which
indicates any offset applied for TLS or random offset.
It's used so the calculations don't need to be repeated
if the thread later drops to user mode.

CONFIG_INIT_STACKS logic is now performed inside
z_setup_new_thread(), before arch_new_thread() is called.

thread->stack_info is now defined as the canonical
user-accessible area within the stack object, including
random offsets and TLS. It will never include any
carved-out memory for MPU guards and must be updated at
runtime if guards are removed.

Available stack space is now optimized. Some arches may
need to significantly round up the buffer size to account
for page-level granularity or MPU power-of-two requirements.
This space is now accounted for and used by virtue of
the Z_THREAD_STACK_SIZE_ADJUST() call in z_setup_new_thread.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-07-30 21:11:14 -04:00
Andrew Boie d4b6226aa9 thread_stack: add Z_THREAD_STACK_SIZE_ADJUST()
Define a macro which takes as input a requested stack buffer
size, and returns the size of the stack object needed to
contain it.

An optional architecture interface is provided, though many
arches will be fine with the default implementation.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-07-30 21:11:14 -04:00
Andrew Boie 27c8aadf94 thread_stack: move up K_THREAD_STACK_RESERVED defn
Some forthcoming macros will need this. This may now
be individually defined by arch code instead of hanging
off of ARCH_THREAD_STACK_DEFINE.

Some additional details added to the documentation string.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-07-30 21:11:14 -04:00
Andrew Boie 0cb1f07c6f thread_stack: z_stack_ptr_align() as function
This can be in inline function, which gains us some
type safety.

Temporarily define Z_STACK_PTR_ALIGN() in terms of it,
slated for removal once some other changes land.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-07-30 21:11:14 -04:00