Commit graph

44393 commits

Author SHA1 Message Date
Jukka Rissanen
a95ae6712f net: tcp2: Access k_work in k_delayed_work using field name
Instead of casting k_delayed_work directly to k_work, use the
k_work field name. This avoids warnings from Coverity and
allows the code to work even if the k_delayed_work fields are
re-ordered in the future.

Coverity-CID: 214346
Fixes #28659

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-09-24 13:29:13 -05:00
Alexandre Bourdiol
74be161694 tests: kernel: timer: timer_api: reorder test_timer_remaining step
Move init_timer_data() out of k_usleep() tick alignment.
Compute rem_ticks just after busy_wait_ms() to avoid slew
due to 'now' and 'rem_ms' computations.
With slow CPU 32MHz: -2 Ticks.

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2020-09-24 13:26:27 -05:00
Alexandre Bourdiol
4133cb5f72 tests: kernel: timer: timer_api: tick align for test_timer_k_define
Insert k_usleep(1) just before k_timer_start()
to guaranty tick alignment for step "test_timer_k_define"

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2020-09-24 13:26:27 -05:00
Daniel Leung
e37f819da7 samples: cmsis_rtos_v1: philosophers: skip up_squared
The up_squared board suffers the same issue as qemu_x86_64
where a bigger stack is needed but CMSIS has a limit on
how big the stack can be. This results in stack overflow.

So exclude up_squared in samples.yaml.

Fixes #28552

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2020-09-24 13:20:32 -05:00
Alexandre Bourdiol
f6bc89cc4c boards: arm: b_l4s5i_iot01a: leds are active high
See schematics of the board: MB1297
both user leds LD1 and LD2 are active high.

Fixes #28665

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2020-09-24 13:13:13 -05:00
Daniel Leung
2c47c489e8 tests: portability/cmsis_rtos_v2: skip up_squared
The up_squared board suffers the same issue as qemu_x86_64
where a bigger stack is needed but CMSIS has a limit on
how big the stack can be. This results in stack overflow
on one of the test.

Also, the thread API tests are not designed with SMP in mind.
The osThreadGetCount() would return a value smaller than
expected. This function only counts queued threads, where with
SMP, there are more CPUs running threads and thus fewer queued
ones.

So exclude up_squared from the test.

Fixes #27571

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2020-09-24 13:09:46 -05:00
Andrzej Puzdrowski
ed76723347 include/storage/flash_map: describe return values of flash_area_open()
This patch adds description for possible flash_area_open()
return values.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2020-09-24 19:21:48 +02:00
David Leach
b94dbc569e test: power: Remove frdm_k64f platform from allowed list
Removing frdm_k64f from the allowed list of platforms to test.
Power management support has not been added and/or verified for
frdm_k64f platform yet.

Fixes: #27821

Signed-off-by: David Leach <david.leach@nxp.com>
2020-09-24 10:46:19 -05:00
Vinayak Kariappa Chettimada
222dca5598 Bluetooth: controller: Fix redundant PDU transmission
Fix the redundant PDU transmission when the new Tx PDU
buffer is enqueued after MD bit value of zero was
transmitted previously in a connection event.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-09-24 17:27:00 +02:00
Vinayak Kariappa Chettimada
1c3659519f Bluetooth: controller: nRF53x: Fix missing sw_switch clear DPPI config
Fix missing sw_switch timer clear DPPI config when
re-enabling Tx or Rx after radio_disable() or
radio_switch_complete_and_disable() call in LLL state/role
contexts.

Fixes #28471.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-09-24 17:05:14 +02:00
Daniel Leung
2f7cc4ac9b tests: thread_apis: move uptime gathering in join scenario
When doing test_thread_join with OTHER_ABORT_TIMEOUT, the interval
between two k_uptime_get() includes the two k_thread_create() which
means the interval delta does not exactly count the time spent
in k_thread_join(). On x86_64 with userspace, time spent inside
k_thread_create() scales with memory size as it needs to create
a new page table for the thread. So to actually measure
the time spent in k_thread_join(), the locations where uptime is
obtained need to be moved.

Fixes #28549

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2020-09-24 09:54:11 -05:00
Peter Bigot
470176e668 tests: kernel/sleep: increase maximum threshold for nRF51
nRF51 MCUs are Cortex-M0 running with a 16 MHz clock.  The overhead of
work done in k_usleep() requires adding three more ticks (92 us) to the
expected loop iteration time.  (Two ticks is enough on most boards, but
some require a little more time.)

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-09-24 09:52:32 -05:00
Armando Visconti
fe6a73669d drivers: sensor: hts221: Add checks for drdy_gpios macros
To avoid build errors enable the trigger only if DRDY gpio is
defined in DTS. Fix #28443

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2020-09-24 09:51:08 -05:00
Hake Huang
f0f95b16dd board: update rt6xx series sram mapping
update rt6xx series sram mapping to skip 0x180000,
reserved for DSP usage.
this fixes tests/subsys/debug/coredump for this board

Signed-off-by: Hake Huang <hake.huang@oss.nxp.com>
2020-09-24 09:43:14 -05:00
Johan Hedberg
6f5d8bd2c4 x86: pcie: Fix calling pcie_mm_init()
Commit 5632ee26f3 introduced an issue where in order to use MMIO
configuration:

 - do_pcie_mmio_cfg is required to be true
 - Only set to true in pcie_mm_init()
 - Which is only called from pcie_mm_conf()
 - Which is only called from pcie_conf() if do_pcie_mmio_cfg is
   already true!

The end result is that MMIO configuration will never be used.

Fix the situation by moving the initialization check to pcie_conf().

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2020-09-24 16:08:08 +03:00
Alexander Kozhinov
594e780756 samples: hello_world: cmake warning
fixes following cmake warning:
CMake Warning at ../../kernel/CMakeLists.txt:54 (message):
  Single threaded mode (CONFIG_MULTITHREADING=n) is deprecated

Signed-off-by: Alexander Kozhinov <AlexanderKozhinov@yandex.com>
2020-09-24 07:25:47 -04:00
Andrew Boie
04fe7c6eeb tests: exception: fix thread entry points
- They all had the wrong prototype and hard-casts can sometimes
lead to problems
- Several renamed to something more descriptive

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-09-23 17:07:25 -05:00
Ryan Erickson
c3853bb478 doc: release notes: mention Pinnacle 100 board addition
Add mention of new ARM based board:
Added the Pinnacle 100 Modem Development board.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2020-09-23 16:40:53 -05:00
Andrew Boie
7b6c7278db doc: releasenotes: mem pool deprecation
Per TSC we will document deprecation for 2.4 but not add
__deprecated tags until the 2.5 merge window opens.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-09-23 15:53:01 -05:00
Carles Cufi
28cb9dab64 kernel: Deprecate CONFIG_MULTITHREADING
Deprecate the Kconfig option for the time being. Unless a contributor
volunteers to take over the work to maintain the option, it will be
removed after 2 releases.

Relates to #27415.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-09-23 15:50:32 -05:00
Maureen Helm
4042a7c347 doc: release: Add NXP SoCs, boards, and drivers to 2.4.0 notes
Adds 2.4.0 release notes for NXP SoCs, boards, and drivers.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2020-09-23 15:44:52 -05:00
Maureen Helm
8a4ac53d2f doc: release: Add 2.4.0 highlights
Fills in the highlights section for the 2.4.0 release notes.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2020-09-23 15:44:52 -05:00
Jukka Rissanen
66cdcb0b48 net: DHCPv4 needs UDP to work properly
Add dependency to UDP in DHCPv4 Kconfig option as UDP is needed
in DHPCv4 to work properly.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-09-23 13:28:38 -05:00
Stephan Walter
381cac1a35 drivers: nrf_qspi: fix devicetree opcode references
The condition used to detect presence of optional devicetree
properties that specify read and write opcodes was inadvertently
changed to something that will never be true.  Update the check and
the property extraction to restore the original behavior.

Fixes #28635.

Signed-off-by: Stephan Walter <stephan@walter.name>
2020-09-23 13:27:46 -05:00
Lauren Murphy
f29a2d1ccc doc: Clarify semantics of k_msgq_put
Amend Doxygen documentation for k_msgq_put to note that the message
content will not be modified as a result of the function call and
constify data parameter in function prototype.

Fixes #22301

Signed-off-by: Lauren Murphy <lauren.murphy@intel.com>
2020-09-23 13:21:07 -05:00
Armando Visconti
4df0d019fd drivers/sensor/lsm6dsl: Fix read/write bus API in shub code
The ce0cc3a7 commit (lsm6dsl: make the driver multi-instance) changes
all bus API signature, which now requires a "const struct device *dev"
and not a "struct lsm6dsl_data *data". By mistake the shub part was
left unchanged. Fix: #28565

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2020-09-23 13:17:06 -05:00
Alexandre Bourdiol
7cd921c9d2 tests: kernel: mem_protect: syscalls: FAULTY_ADDRESS for nucleo_l073rz
Configure faulty address for nucleo_l073rz to 0x0FFFFFFF
Fixes #28621

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2020-09-23 13:11:19 -05:00
Erwan Gouriou
209429338a boards: nucleo_l552ze_q: Fix connectors image
Add correct image for nucleo_l552ze_q "zio" connectors.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-09-23 13:10:40 -05:00
Peter Bigot
b7a897ebd3 logging: avoid null pointer dereference in loop
An execution path could reach a loop that dereferences a pointer in
conditions where the pointer is null.  Add a check to the loop
condition.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-09-23 13:08:18 -05:00
Jukka Rissanen
4a27246c06 tests: net: tcp2: Fix crash in frdm_k64f
Lowering the connection timeout in order to avoid spin lock assert
in frdm_k64f device. This error was seen with this device

ASSERTION FAIL [z_spin_lock_valid(l)] @ zephyr/include/spinlock.h:92
        Recursive spinlock 0x20003590

Fixes #28602

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-09-23 13:02:04 -05:00
Andrzej Głąbek
8d7fee4e4a modules/Kconfig.nordic: Do not select HAS_CMSIS_CORE through HAS_NRFX
The HAS_NRFX Kconfig option is selected also for the nrf52_bsim board,
where the nrfx drivers are compiled for a simulated target, without
CMSIS. Thus, selecting HAS_CMSIS_CORE in such case is inappropriate.
This patch removes then the selection of the HAS_CMSIS_CORE option from
HAS_NRFX. When the nrfx drivers are built for a real SoC, where CMSIS
is actually used, the option will get selected by the CPU_CORTEX_M one.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2020-09-23 17:12:01 +02:00
David Komel
c067463791 net: tcp2: fix sysworkq corruption in tcp_conn_unref()
Bug description:
When in tcp_conn_unref(), in case one of the delayed works is already
submitted to sysworkq (after delay period), e.g. send_timer, the check
of k_delayed_work_remaining_get() prevents calling
k_delayed_work_cancel().
This leads to corrupting sysworkq when zeroing struct tcp* conn.
Note that the "next" pointer for the work queue is part of the struct
work (in _reserved field). Which is, in this case, a member of struct
tcp.

Scenario leading to the bug:
(1) net_tcp_connect() is called from a work in sysworkq
(2) net_tcp_connect() submits conn->send_timer to sysworkq
(3) while net_tcp_connect() is waiting on connect_sem, delay period
    passes (z_timeout) and send_timer enters sysworkq work slist
(4) also, some other code (app) submits more works to queue, now pointed
    by conn->send_timer in sysworkq work list
(5) connection fails (no answer to SYN), causing a call to
    tcp_conn_unref()
(6) tcp_conn_unref() is calling tcp_send_queue_flush()
(7) checking k_delayed_work_remaining_get(&conn->send_timer) returns 0
    due to delay period end, but send_timer is still in sysworkq work
    slist (sysworkq thread still hasn't handled the work)
(8) BUG!: no call to k_delayed_work_cancel(&conn->send_timer)
(9) back in tcp_conn_unref(), a call to memset(conn, 0, sizeof(*conn))
    zeroes conn->send_timer
(10) conn->send_timer is pointed to in sysworkq work slist, but is
     zeroed, clearing pointer to following works submitted in stage (4)
(11) EFFECT! the works in stage (4) are never executed!!

NOTES:
* k_delayed_work_cancel(), handles both states:
  (1) delayed work pends on timeout and
  (2) work already in queue.
  So there is no need to check k_delayed_work_remaining_get()
* This is also relevant for conn->send_data_timer

Solution:
removing checks of k_delayed_work_remaining_get(), always calling
k_delayed_work_cancel() for work in struct tcp, in unref, before memset

Signed-off-by: David Komel <a8961713@gmail.com>
2020-09-23 08:37:44 -05:00
Ioannis Glaropoulos
2eaef86577 boards: nucleo_l552ze_q: do not offset the image by default by 0x400.
We only need to offset the start of the non-secure image
by 0x400, if TFM is built with BL2 support. In this case
we use the ROM_START_OFFSET Kconfig switch and we set it
to 0x400, which is the default BL2 Header size value in
TF-M builds. This instructs the linker to offset the beginning
of the ROM section by 0x400. In other words, we do not need
to statically move the start of the image by 0x400 (using
FLASH_BASE_ADDRESS or FLASH_LOAD_OFFSET) when building for
nucleo_l552ze_q 'non-secure'. This fixes an issue that
prevents from running Zephyr + TFM without BL2 support.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2020-09-23 15:05:43 +02:00
Øyvind Rønningstad
407ebf8132 cortex_m: secure_entry_functions.ld: Increase SAU alignment to 32
The spec requires SAU regions to be aligned on 32 bytes.

Signed-off-by: Øyvind Rønningstad <oyvind.ronningstad@nordicsemi.no>
2020-09-23 13:15:38 +02:00
Øyvind Rønningstad
81e7608c03 arm: tz: secure_entry_functions.ld: Fix NSC_ALIGN for nRF devices
If the location counter ('.') is within the area that the veneers
should go, the current solution will give a linker error ("Cannot move
location counter backwards"). This patch places the veneers in the next
SPU region in this case.

Signed-off-by: Øyvind Rønningstad <oyvind.ronningstad@nordicsemi.no>
2020-09-23 13:15:38 +02:00
Øyvind Rønningstad
2b56b86190 arm: tz: secure_entry_functions.ld: Fix NSC_ALIGN redefinition
Allow CONFIG_ARM_NSC_REGION_BASE_ADDRESS to override the nRF-specific
logic for alignment.

Fixes issue https://github.com/zephyrproject-rtos/zephyr/issues/27544

Signed-off-by: Øyvind Rønningstad <oyvind.ronningstad@nordicsemi.no>
2020-09-23 13:15:38 +02:00
Andrew Boie
61d42cf42b x86-64: fix thread tracing
The current instrumentation point for CONFIG_TRACING added in
PR #28512 had two problems:

- If userspace and KPTI are enabled, the tracing point is simply
  never run if we are resuming a user thread as the
  z_x86_trampoline_to_user function is jumped to and calls
  'iret' from there

- Only %rdi is being saved. However, at that location, *all*
  caller-saved registers are in use as they contain the
  resumed thread's context

Simplest solution is to move this up near where we update page
tables. The #ifdefs are used to make sure we don't push/pop
%rdi more than once. At that point in the code only %rdi
is in use among the volatile registers.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-09-22 20:47:48 -04:00
Jukka Rissanen
d312c6e7e6 net: gptp: Print priority1 and priority2 vars in net-shell
Print the default values of BMCA priority1 and priority2
variables in net-shell.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-09-22 16:45:45 -05:00
Jukka Rissanen
e3fd17072e net: gptp: Allow user to tweak priority1 and priority2 values
Instead of hardcoding the priority1 and priority2 values used
in BMCA, let the user tweak the values via Kconfig.

Fixes #28151

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-09-22 16:45:45 -05:00
Torsten Rasmussen
5d473dc092 cmake: fix zephyr_get_system_include_directories_for_lang() function
This commit fixes the zephyr_get_system_include_directories_for_lang()
function in the event that no system include directories are specified
for Zephyr interface.

This fixes an issue where the value returned by this function is
`-isystem` with no directory.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2020-09-22 16:31:32 -05:00
Gerson Fernando Budke
5576432cd3 samples: net: echo_server: Decrease buffer for atsamr21_xpro
From 2.3 to 2.4 the net samples pair echo-server/client increase the
SRAM requirements. Since CI doesn't build all combinations, (even for
a release like 2.4.0-rc1) the problem was detected only now.  Decrease
buffers for atsamr21_xpro on both echo_server/client sample pair.

Fixes #28341.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2020-09-22 16:15:10 -05:00
Henrik Brix Andersen
21e31bfae4 doc: release: 2.4: add sensor_attr_get() in release notes
Mention the recently added sensor_attr_get() API function in the
release notes for v2.4.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2020-09-22 16:06:01 -05:00
Emil Obalski
3527b7dca1 tests: shell: Correct overlay extension
When added bluetooth over USB shell overlay, the
file was by mistake added with wrong extension.

Signed-off-by: Emil Obalski <emil.obalski@nordicsemi.no>
2020-09-22 16:04:56 -05:00
Wentong Wu
50252bbf92 arch: x86: mmu: use z_x86_kernel_ptables as array.
Use z_x86_kernel_ptables as array to make Coverity happy.

Coverity-CID: 212957.
Fixes: 27832.

Signed-off-by: Wentong Wu <wentong.wu@intel.com>
2020-09-22 16:00:03 -05:00
Kumar Gala
eda6dbe1bc ci: double number of builders for daily build
To get the daily build to hopefully run completely w/o timeouts lets
double the number of builders.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-09-22 14:16:58 -05:00
Flavio Ceolin
724601bfea codeowners: Add owners to security documentation
Add myself and David Brown as owners for security documentation.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2020-09-22 13:39:46 -05:00
Flavio Ceolin
7c86add30f doc: release notes: Update security notes for 2.4
Add information about security issues addressed in the v2.4.0
release.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2020-09-22 13:39:46 -05:00
Ioannis Glaropoulos
142219896d boards: arm: musca_b1: do not offset the image by default by 0x400.
We only need to offset the start of the non-secure image
by 0x400, if TFM is built with BL2 support. In this case
we use the ROM_START_OFFSET Kconfig switch  and set to
0x400. This instructs the linker to offset the beginning
of the ROM section by 0x400. In other words, we do not need
to statically move the start of the image by 0x400. This
fixes an issue that prevents from running Zephyr + TFM
without BL2 on Musca B1.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2020-09-22 19:38:51 +02:00
Ioannis Glaropoulos
96ce274d03 boards: mps2_an521: do not offset the image by default by 0x400.
We only need to offset the start of the non-secure image
by 0x400, if TFM is built with BL2 support. In this case
we use the ROM_START_OFFSET Kconfig switch  and set to
0x400. This instructs the linker to offset the beginning
of the ROM section by 0x400. In other words, we do not need
to statically move the start of the image by 0x400. This
fixes an issue that prevents from running Zephyr + TFM
without BL2 on MPS2 AN521.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2020-09-22 19:38:51 +02:00
Ioannis Glaropoulos
3758b3328c modules: tfm: make BL2 header in non-secure image configurable
When we build Zephyr for a Non-Secure image, using TFM
as the Secure counterpart, we may or may not use BL2 (e.g.
MCUboot in TFM). If we build with BL2 we need to account
for a ROM offset before the start of the non-secure image
where TFM BL2 expects the BL2 header. This offset is not
needed when TFM is built without BL2. We use the existing
Kconfig options to determine whether we need a ROM offset
or not. We use the value of 0x400 for the BL2 header,
which is the default value used in TFM, but the option is
non-hidden, allowing the user to overwrite the default
value if needed.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2020-09-22 19:38:51 +02:00