Commit graph

41161 commits

Author SHA1 Message Date
Martí Bolívar
3852e08126 drivers: spi_ll_stm32: fix COND_CODE_1 usage
The consequent and alternate expressions for COND_CODE_1 must be
enclosed in parentheses, like this:

COND_CODE_1(PREDICATE, (consequent), (alternate))

The parens are missing in exactly one place in the tree. Fix it.

Reported-by: Peter Bigot <peter.bigot@nordicsemi.no>
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-05-29 23:07:19 +02:00
Andy Ross
a343cf9480 kernel/timer: Handle K_FOREVER in k_timer_start()
The possibility of passing K_FOREVER as the initial duration argument
to k_timer_start() wasn't being handled, with the result that the
computed value became an zero timeout (effecitvely treating it as
K_NO_WAIT and firing at the next tick).

This is obviously pathlogical, but it should still do what the code
says it should and wait forever.

Make k_timer_start(..., K_FOREVER, ...) a noop.

Fixes #25820

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2020-05-29 19:59:14 +02:00
Carles Cufi
d29a06f8a8 doc: dev process: Add a note about deprecation mechanisms
Describe how an API can be deprecated, which is via the __deprecated
keyword or by introducing a legacy Kconfig option.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-05-29 18:06:52 +02:00
Jim Luther
ffd15131d2 bluetooth: host: fix unpacked l2cap struct
The bt_l2cap_le_conn_rsp struct in l2cap_internal.h has not been
declared __packed. This can cause alignment problems on some
platforms if the struct is placed on an unaligned address.

A __packed declaration solves this issue by forcing the compiler to
use store instructions that do not required alignment.

Signed-off-by: Jim Luther <jilu@oticon.com>
2020-05-29 17:43:32 +02:00
Vincent Wan
95ac55327b boards: arm: minor update to docs for CC13x2/CC26x2
Add a bit more of an intro to power management support.

Signed-off-by: Vincent Wan <vincent.wan@linaro.org>
2020-05-29 15:05:18 +02:00
Vincent Wan
6084957fb8 doc: release-notes-2.3: add power management for CC13x2/CC26x2
Add support of power management for CC13x2/CC26x2 in release notes.

Signed-off-by: Vincent Wan <vincent.wan@linaro.org>
2020-05-29 15:05:18 +02:00
Vincent Wan
99a9aa4f7d samples: cc13x2_cc26x2: system_off: fix documentation formatting
Fix minor formatting issue in README to fully display console output.

Signed-off-by: Vincent Wan <vincent.wan@linaro.org>
2020-05-29 15:05:18 +02:00
Henrik Brix Andersen
8b5b7fcf8d test: lib: devicetree: add tests for DT_ macros for retrieving PWM period
Add tests for DT_ macros for retrieving the 'period' cell value.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2020-05-29 14:48:12 +02:00
Henrik Brix Andersen
3046e228e7 devicetree.h: pwms: Add DT_ macros for retrieving pwm period
Add DT_ macros for retrieving the value of the 'period' cell for PWM
controllers supporting this cell type.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2020-05-29 14:48:12 +02:00
Francois Ramu
a089e3617d boards: arm: stm32l4r5 unset the LPTIM clock source if enabled
For nucleo_l4r5zi board, the LPTIM clock source is defined
as LSE as default.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2020-05-29 14:13:05 +02:00
Francois Ramu
f30f5fff72 drivers: timer: lptim is [EXPERIMENTAL] for stm32 soc series only
Activation of the LPTIMER is valid for SLEEP MODE only
The choice of the lptim clock source is STM32_LPTIM_CLOCK
set the LSE in first position to have as default value

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2020-05-29 14:13:05 +02:00
Francois Ramu
7545b7888a dts: stm32: timer define a new DT binding for LPTIM
Adds a new LPTIM binding for stm32 soc,
based on the timer binding. This will makes a specific filter
on dt_compat_enabled("stm32,lptim")

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2020-05-29 14:13:05 +02:00
Francois Ramu
992c005ab9 soc: arm: stm32 TICKS value with LPTIM config
This is defining the SYS_CLOCK_TICKS_PER_SEC default value
depending on the LPTIM CLOCK frequency in case of LPTIMER,
to get a TICK value as a divider of the LPTIM clock source.
It gives a better result in formulas when converting
ticks to count unit.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2020-05-29 14:13:05 +02:00
Francois Ramu
7be27b5169 drivers: timer: stm32_lptim fix TICKLESS=n processing
based on PR#25412
Some kernel tests use `CONFIG_TICKLESS_KERNEL=n` with
`CONFIG_SYS_CLOCK_TICKS_PER_SEC=1` to detect when a test runs longer
than 1 second.  These tests break if a tick is announced every time a
timeout occurs.  Only announce if the measured duration since the last
tick is at least the duration of a tick.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2020-05-29 14:13:05 +02:00
Francois Ramu
29ea09ee52 driver: timer: stm32_lptim control the timer duration
This change makes the lptimer running with lower tick periods
and small tick values

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2020-05-29 14:13:05 +02:00
Francois Ramu
fcfcc1d6ea driver: timer: stm32_lptim set_timeout limit values
set the min and max values of the given ticks from 0
to LPTIM_TIMEBASE which is the full register value
In case the timeout is FOREVER, then lptimer is stopped

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2020-05-29 14:13:05 +02:00
Julien D'Ascenzio
3894c6ee50 driver: timer: fix accumulated counter increment
The current value of the counter must not be added to the accumulator.
It will be added when calling z_timer_cycle_get_32.

Signed-off-by: Julien D'Ascenzio <julien.dascenzio@paratronic.fr>
2020-05-29 14:13:05 +02:00
Francois Ramu
b0081d1f38 driver: timer: stm32_lptim: tickless mode without a compilation flag
In the timeout function, remove the compilation flag
and use the macro instead.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2020-05-29 14:13:05 +02:00
Julien D'Ascenzio
b976e76866 driver: timer: stm32_lptim: fix hang when no tickless
When the tickless kernel isn't used, we don't want to wait for ARROK.
This wait can be endless.

Signed-off-by: Julien D'Ascenzio <julien.dascenzio@paratronic.fr>
2020-05-29 14:13:05 +02:00
Julien D'Ascenzio
e20d7890ef driver: timer: stm32_lptim: fix autoreload value
Autoreload value must be decrement by one

Signed-off-by: Julien D'Ascenzio <julien.dascenzio@paratronic.fr>
2020-05-29 14:13:05 +02:00
Vinayak Kariappa Chettimada
ba487feb0f Bluetooth: controller: split: Workaround nRF52832 CCM overrun
Implemented an intermediate decrypt buffer to cover the CCM
overrun under CRC error conditions. The workaround is
applicable to nRF52832 SoC only, which is missing the
MAXPACKETSIZE register in the NRF_CCM peripheral.

Fixes #21107 for nRF52832 SoC.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-05-29 13:12:28 +02:00
Stephanos Ioannidis
90f18b2127 doc: Add ARM release notes for v2.3
This commit adds the ARM release notes for the v2.3 release.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2020-05-29 13:12:14 +02:00
Ioannis Glaropoulos
f0a09ac32d doc: release notes: add release notes entries for ARM Cortex-M
Zephyr v2.3 release notes content for ARM Cortex-M architecture.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2020-05-29 13:12:14 +02:00
Jukka Rissanen
bc40177020 net: ipv6: RA prefix option length not checked
The Router Advertisement can have prefix option. It's length
is 4 but the code did not check that which meant that we could
accept malformed packet. See RFC 4861 chapter 4.6.2 for details.

Fixes #25694

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-05-29 13:11:48 +02:00
Torsten Rasmussen
8d3e822e79 cmake: resolved list issue when parsing shield list
Fixes: #25656

The commit a8e90cbfb3 improved handling of
shields. Unfortunately it pops items from the SHIELD variable which
works well if SHIELD is a CMake ;-separated list, but if the list is
a space separated list, as may be provided by the user, then this
principle fails as reported in #25656.

This is fixed by keeping improved behaviour, while popping from an
alternative SHIELD-NOTFOUND list instead.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2020-05-29 13:11:17 +02:00
Marc Herbert
3a04536487 doc,cmake: make find_package(Zephyr...) REQUIRED
This provides a better error message when building with CMake and
forgetting ZEPHYR_BASE or not registering Zephyr in the CMake package
registry. See parent commit for more details (split from parent for
better readability).

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2020-05-29 10:47:25 +02:00
Marc Herbert
2cd51a33ce samples: make find_package(Zephyr...) REQUIRED
This provides a better error message when building with CMake and
forgetting ZEPHYR_BASE or not registering Zephyr in the CMake package
registry. See parent commit for more details (split from parent for
better readability).

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2020-05-29 10:47:25 +02:00
Marc Herbert
debade9121 tests: make find_package(Zephyr...) REQUIRED
... because it is (required).

This makes a difference when building with CMake and forgetting
ZEPHYR_BASE or not registering Zephyr in the CMake package registry.

In this particular case, REQUIRED turns this harmless looking log
statement:

-- Could NOT find Zephyr (missing: Zephyr_DIR)
-- The C compiler identification is GNU 9.3.0
-- The CXX compiler identification is GNU 9.3.0
-- Check for working C compiler: /usr/bin/cc
-- ...
-- ...
-- ...
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at CMakeLists.txt:8 (target_sources):
  Cannot specify sources for target "app" which is not built by
  this project.

... into this louder, clearer, faster and (last but not least) final
error:

CMake Error at CMakeLists.txt:5 (find_package):
  Could not find a package configuration file provided by "Zephyr" with
  any of the following names:

    ZephyrConfig.cmake
    zephyr-config.cmake

  Add the installation prefix of "Zephyr" to CMAKE_PREFIX_PATH or set
  "Zephyr_DIR" to a directory containing one of the above files.  If
  "Zephyr" provides a separate development package or SDK, be sure it
  has been installed.

-- Configuring incomplete, errors occurred!

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2020-05-29 10:47:25 +02:00
Andrew Boie
32ebe3cd24 x86: 32-bit: allow direct ISRs only with !KPTI
This doesn't work as expected with kernel page table isolation
turned on, and fixing it would likely lose any latency benefits
that direct ISRs are supposed to provide.

For now, just prevent these macros from being defined if KPTI
is turned on, like other arches that do not implement this
feature.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-05-29 10:46:00 +02:00
Tomasz Bursztyka
549cfff6c9 device: Rephrase data parameter documentation
This parameter points to the driver instance private data, and not to
its configuration data, which one is set via cfg_info parameter.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-05-29 10:42:07 +02:00
Tomasz Bursztyka
794665e75b gpio: Fix header comments
There is no device config structure anymore, and
s/decleration/declaration

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-05-29 10:42:07 +02:00
Martí Bolívar
af40c99fac doc: release notes update for devicetree
I believe the devicetree documentation for the release is in good
enough shape now. Add a few more links to the release notes to provide
users with more hints for adapting to the new API.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-05-28 22:12:38 +02:00
Martí Bolívar
e4a761cffe devicetree: add migration guide documentation and tests
Add test cases that verify various bits and pieces of the legacy
devicetree macros match the new APIs.

Writing these test cases without giving rise to deprecated macro
warnings which might break people's CI if they build with -Werror
requires turning off the __WARN() generation in
devicetree_legacy_unfixed.h. The entire file is deprecated at this
point and must be explicitly enabled with an opt-in Kconfig option, so
there isn't any harm in doing this.

Nevertheless, take a minimally invasive approach to avoiding __WARN()
generation in gen_legacy_defines.py, to avoid the possibility of
breakage. This code is basically frozen anyway, so hacks like this
won't cause maintainability problems since it isn't being actively
maintained.

Use the new tests as fodder for a migration guide from the old API in
the documentation.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-05-28 22:12:38 +02:00
Martí Bolívar
f1808c4a80 tests: move lib/devicetree to lib/devicetree/api
This is preparation for an additional test suite specifically for the
legacy API which will be added next.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-05-28 22:12:38 +02:00
Martí Bolívar
e5418ff5bf doc: devicetree: update binding-template.yaml
Remove some deprecated or obsolete functionality:

- the 'title:' key is now deprecated
- more than 2 levels of child-binding are now supported

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-05-28 22:12:38 +02:00
Martí Bolívar
930c5807d5 tests: devicetree: test great-grandchild bindings
At some point, "child-binding:" apparently only worked up to 2 levels
deep. That's not the case anymore, but add a regression test to make
sure that doesn't break. 3 levels deep ought to be enough for anyone.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-05-28 22:12:38 +02:00
Jukka Rissanen
71686dde4b net: ipv6: Do not add same prefix multiple times to timer list
Make sure that we do not add same IPv6 prefix, received from RA,
multiple times to prefix timer list. This avoids possible
denial-of-service issue if we receive suitably crafted RA packet.

Fixes #25698

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-05-28 17:49:03 +02:00
Andrzej Puzdrowski
48af970339 tests/subsys/settings/functional/nvs: add nrf52xx configuration
Added configuration which allows to run test-suite
on nrf52840dk_nrf52840 and nrf52dk_rf52832 boards.

fixes #25701

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2020-05-28 17:11:12 +02:00
Andrew Fernandes
4653b4e63f logging: set 'log_backend_rtt:panic_mode' before 'log_backend_std_panic'
Set 'log_backend_rtt:panic_mode' before calling 'log_backend_std_panic',
because otherwise the RTT backend behaves as if the system is NOT
panicking and tries to do asynchronous writes via RTT_LOCK/UNLOCK.

Signed-Off-By: Andrew Fernandes <andrew@fernandes.org>
2020-05-28 11:45:42 +02:00
Ioannis Glaropoulos
79ff37b9cc tests: kernel: stackprot: increase Main stack size for this test
Increase the main thread stack size for this test
to 2048; this increase prevents stacking errors in
the main thread, in several Cortex-M platforms.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2020-05-28 10:31:05 +02:00
Anas Nashif
7818597da3 doc: make statement about version bold
Make that top paragraph bold to indicate the version being viewed is for
master.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-05-28 10:30:38 +02:00
Anas Nashif
517ee9172f doc: add a header to all pages about development version
Add a header to all pages indicating the documentation is for the
development version of Zephyr.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-05-28 10:30:38 +02:00
Vincent Wan
002de4decf drivers: spi: cc13xx_cc26xx: set power config based on SPI base addr
The power configuration is dependent on which SPI is physically used.
In order to allow DT_INST_FOREACH_STATUS_OKAY() to iterate through
instances without the assumption that index 0 corresponds to SPI0
(which would be incorrect in the case when only SPI1 is enabled),
we need to check the base address to identify which SPI is being dealt
with.

Fixes #25673

Signed-off-by: Vincent Wan <vincent.wan@linaro.org>
2020-05-28 10:30:14 +02:00
Andrew Boie
6af9793f0c kernek: don't allow mutex ops in ISRs
Mutex operations check ownership against _current. But in an
ISR, _current is just whatever thread was interrupted when the
ISR fired. Explicitly do not allow this.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-05-28 01:38:05 +02:00
Andrew Boie
4cdaa71444 tests: userspace: check TLS location
Ensure that the TLS region is within the stack object.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-05-27 19:48:27 +02:00
Ioannis Glaropoulos
9d8111c88f arch: arm: cortex-m: fix placement of ARMv7-M-related MPU workaround
The workaround for ARMv7-M architecture (which proactively
decreases the available thread stack by the size of the MPU
guard) needs to be placed before we calculate the pointer of
the user-space local thread data, otherwise this pointer will
fall beyond the boundary of the thread stack area.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2020-05-27 19:48:27 +02:00
Piotr Zierhoffer
84e54ee92e doc: release-notes-2.3: Add ADXL345 mention
A 3-axis accelerometer from Analog Devices.

Signed-off-by: Piotr Zierhoffer <pzierhoffer@antmicro.com>
2020-05-27 19:39:14 +02:00
Piotr Zierhoffer
1fcebf8057 doc: release-notes-2.3: Add RISC-V-related changes
Mostly related to rv32m1_vega updates, and some generic RISC-V
improvements.

Signed-off-by: Piotr Zierhoffer <pzierhoffer@antmicro.com>
2020-05-27 19:39:14 +02:00
Alexandre Bourdiol
3152a0d567 tests: kernel: mem_protect: syscalls: configurable faulty address
On nucleo_f429zi and nucleo_f207zg boards,
0xFFFFFFF0 is not a faulty address.
Instead we can use 0x0FFFFFFFF.

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2020-05-27 19:29:03 +02:00
Trond Einar Snekvik
a385873336 Bluetooth: Mesh: Fail init on model init error
Adds propagation of error returns from the model init callbacks in
Access, and removing any other checks for successful init in the
foundation models.

Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
2020-05-27 18:45:18 +02:00