Commit graph

56486 commits

Author SHA1 Message Date
Henrik Brix Andersen
7a525c1c24 samples: sensor: fxos8700: add mimxrt1024_evk board configuration
Add configuration for the mimxrt1024_evk board. This board does not have
any of the FXOS8700 interrupt pins connected by default, so triggers are
not available.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2021-09-29 10:07:41 -04:00
Henrik Brix Andersen
36619c024d boards: arm: mimxrt1024_evk: enable onboard fxos8700 sensor
Enable the onboard 6-axis FXOS8700CQ digital accelerometer and
magnetometer sensor.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2021-09-29 10:07:41 -04:00
Chen Peng1
dde3d6ca9b timer: mask interrupts in timer's timeout handler.
before running timer's timeout function, we need to make
sure that those threads waiting on this timer have been
added into the timer's wait queue, so add operations to
use timer lock to mask interrupts in z_timer_expiration_handler
function to synchronize timer's wait queue.

Signed-off-by: Chen Peng1 <peng1.chen@intel.com>
2021-09-29 09:18:12 -04:00
Vinayak Kariappa Chettimada
ad36dcdf15 Bluetooth: Controller: Use defines for scanning state types
Use defines for scanning state types of passive, active,
initiator and synchronization state.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-09-29 15:05:57 +02:00
Vinayak Kariappa Chettimada
e0ac70ad91 Bluetooth: Controller: Allow resolving list update during passive scan
Allow resolving list update  when passive scanning,
otherwise deny if advertising, active scanning, initiating
or periodic sync create is active.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-09-29 15:05:57 +02:00
Vinayak Kariappa Chettimada
bbe8fe721b Bluetooth: Controller: Fix imprecise data bus error in periodic sync
Fix imprecise data bus error when receiving Periodic
Advertising Report caused due to uninitialized `extra` field
member in the node rx struct passed from ULL to LL thread
context.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-09-29 15:02:37 +02:00
Vinayak Kariappa Chettimada
665a8d2c6e Bluetooth: Controller: Fix repeated per sync drift compensations
Fix repeated periodic sync drift compensation invoked when
receiving chain PDUs which caused memory corruptions and
bus faults.

Use `is_aux_sched` flag in Periodic Sync's LLL context to
differentiate between the first AUX_SYNC_IND PDU followed by
use of LLL scheduling to receive following AUX_CHAIN_IND PDU
versus ULL scheduling being used to receive AUX_CHAIN_IND
PDUs.

Drift compensation to be done only using the AUX_SYNC_IND
PDU and not on reception of AUX_CHAIN_IND PDU using ULL
scheduling.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-09-29 15:02:37 +02:00
Krzysztof Chruscinski
a18bc0f4f7 logging: Cleaning references to tracing in logging
There were some leftovers in logging after attempt to use
logging as tracing backend. Removing all references since it
lead to test compilation failures.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-09-29 14:59:36 +02:00
Robert Lubos
4a2665c284 doc: release: 2.7: Add release notes for networking
Add networking relase notes based on commit history, for commits
including "net" phrase in the title.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2021-09-29 08:16:02 -04:00
Erwan Gouriou
21be2c8374 boards: nucleo_l073rz: Set LSI as LPTIM clock source
For some reason, LSE can't be used as LPTIM clock source
on nucleo_l073rz.
As a consequence, low power operations are not functional on
this platform.
Waiting for the original issue to be fixed, set LSI as LPTIM
clock source.

Partially fixes #38930

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-09-29 06:36:53 -04:00
Lixin Guo
a5a360d319 Tests: memory protect: add some error test cases
Add some error case for adding and removing memory partition
API.

Signed-off-by: Lixin Guo <lixinx.guo@intel.com>
2021-09-29 06:29:19 -04:00
Robert Lubos
45e07dbbb3 net: sockets: tls: Ignore empty iovec entries in sendmsg
According to `sendmsg()` man pages, the `struct msghdr` can contain
empty records (iov_len equal to 0). Ignore them in TLS `sendmsg()`
implementation to avoid unnecessary calls to mbed TLS.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2021-09-29 11:08:40 +02:00
Robert Lubos
f0ec61ef70 net: mqtt: Handle incomplete zsock_sendmsg write
In case zsock_sendmsg did not send all of the data requested, update the
`struct msghdr` content and retry.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2021-09-29 11:08:40 +02:00
Robert Lubos
6e04a0f59d net: context: Do not overflow net_pkt when using msghdr
If data for `context_sendto()` was provided in a form of
`struct msghdr` (for instance via `sendmsg()`), it was not verified that
the provided data would actually fit into allocated net_pkt. In result,
and error could be returned in case the provided data was larger than
net_pkt allows.

Fix this, by verifying the remaining buffer length when iterating over
`struct msghdr`. Once the buffer is filled up, break the loop. In
result, functions like `sendmsg()` will return the actual length of data
sent instead of an error.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2021-09-29 11:08:40 +02:00
Piotr Golyzniak
0e1ecb373a twister: Fix missing testcases with error status
If timeout error was occured during performing testsuite on QEMU or
other simulator (e.g. Renode), information about this error will be not
placed in final report. It can be fixed, by set status of testcases,
which were not performed due to this error as "BLOCK".

Simmilar solution is alredy used in DeviceHandler when Twister works
with real platform. So I think that it is resonable to use the same
approach, when tests are performed on simulators.

I move loop which iterate through all testcases and set their tests
status as BLOCK into the parent Handler class, because the same
activity is performed in each children class (BinaryHandler,
DeviceHandler and QEMUHandler).

Fixes #38756

Signed-off-by: Piotr Golyzniak <piotr.golyzniak@nordicsemi.no>
2021-09-28 21:34:10 -04:00
Martin Jäger
cf6bb4d962 tests: lib: json: Negate assert messages
Assert messages are printed if the assertion fails, so they should
state what went wrong instead of the expected behaviour.

Signed-off-by: Martin Jäger <martin@libre.solar>
2021-09-28 20:37:06 -04:00
Tom Owen
5408efde6b board: Added board support package for Nucleo_F446ZE
Includes support for USB, CAN, ADC, DAC, and Arduino GPIO Map.
Future could support: ETM Trace (if Zephyr supports it), QSPI, FMC, DCMI

Initially based on closest BSP for the same SoC: nucleo_f446re
Extra peripherals added based on closest BSP for nucleo-144 board:
 nucleo_f429zi
Checked against nucleo-144 schematic
Documentation updated as best as I could
Arduino compatible pinmux for SPI, UART and I2C via Zio header

Tested:
  USB Device mode (samples/subsys/usb/console)
  Console via ST-link usart3 (samples/hello_world)
  user LEDs (samples/basic/blinky)
  scripts/twister --device-tests -p nucleo_f446ze
Not tested but should work: SPI, I2C, CAN, ADC, DAC
Not working yet: Quad-SPI (missing in dts/arm/st/f4/stm32f4.dtsi)

Signed-off-by: Tom Owen <tom.owen@zepler.net>
2021-09-28 20:34:55 -04:00
Daniel Leung
1ec2dbd662 xtensa: fix implicit declaration of _xtensa_handle_one_int*
Some Xtensa SoCs may not have that many levels of interrupts.
So limit the call to DEF_INT_C_HANDLER() to only supported
levels to avoid calling non-existent functions.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-09-28 20:33:56 -04:00
Krzysztof Chruscinski
abf8c741e4 logging: Prefix internal functions with z_
There are 2 function in log_internal that were not prefixed.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-09-28 20:31:52 -04:00
Krzysztof Chruscinski
03165c914b logging: Cleanup in the internal headers
Added log_internal.h for internal APIs. Move functions out of
log_core.h. Log_core.h shall have only macros and functions related
to logging message creation. Log_core.h is included by log.h thus
number of dependencies in that headers must be limited to minimum
to allow including without risk of circular dependencies.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-09-28 20:31:52 -04:00
Emil Gydesen
8d20e8d5bc Bluetooth: ISO: Add iso accept info struct
Add a new struct that provides information to the upper
layer when accepting an connected isochronous stream.

The CIG ID and CIS ID makes it possible for the upper layer
to determine which ISO channels are "together" in a group.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-09-28 20:19:37 -04:00
Vinayak Kariappa Chettimada
fda7b46f92 Bluetooth: Controller: Update Bluetooth version to 5.3
Update the Bluetooth HCI Version to 5.3.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-09-28 20:18:00 -04:00
Håkon Øye Amundsen
ede29d849d samples/mgmt/smp_svr: Increase main stack size
Some build variants will fail runtime for certain boards (e.g. nRF52832)
due to stack overflow. Avoid this by increasing the stack size.

Signed-off-by: Håkon Øye Amundsen <haakon.amundsen@nordicsemi.no>
2021-09-28 20:15:25 -04:00
Andy Ross
0f20abda8d tests/kernel/threads_apis: Add case for CPU_MASK_PIN_ONLY
Add testing for the PIN_ONLY API variant (which has a separate run
queue per CPU).  Predicate on SMP systems only, to keep needless
duplicate testing to a minimum.

Note that one of the cases in this test exercises an "all cpus" option
for the cpu mask, which is illegal when CONFIG_SCHED_CPU_MASK_PIN_ONLY
is set.  Skip.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2021-09-28 20:15:05 -04:00
Andy Ross
b11e796c36 kernel/sched: Add CONFIG_CPU_MASK_PIN_ONLY
Some SMP applications have threading designs where every thread
created is always assigned to a specific CPU, and never want to
schedule them symmetrically across CPUs under any circumstance.

In this situation, it's possible to optimize the run queue design a
bit to put a separate queue in each CPU struct instead of having a
single global one.  This is probably good for a few cycles per
scheduling event (maybe a bit more on architectures where cache
locality can be exploited) in circumstances where there is more than
one runnable thread.  It's a mild optimization, but a basically simple
one.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2021-09-28 20:15:05 -04:00
Andy Ross
b155d06712 kernel/sched: Factor out ready_q initialization
Split "init_ready_q()" into a separate function that operates on the
queue pointer and not the global kernel object.  Pure refactoring.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2021-09-28 20:15:05 -04:00
Andy Ross
387fdd2e53 kernel/sched: Refactor/simplify run queue accessors
Similar to the previous patch, the various _priq_run_*() functions are
always passed a first argument that is the singleton system run queue
(this is because the same backend functions are used by wait queues).

Refactor into a simpler API that places the access to the run queue in
just a single spot.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2021-09-28 20:15:05 -04:00
Andy Ross
c230fb3580 kernel/sched: Simply de/queue_thread()
Pure refactoring.  For historical reasons these two functions took a
first argument (a pointer to the run queue) that was always the same.
Eliminate it.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2021-09-28 20:15:05 -04:00
Aurelien Jarno
2e9cce6779 soc: arm: stm32wl: wakeup from stop clock selection based on sysclk
When exiting Stop mode, if system clock is MSI, MSI oscillator is
selected as wakeup from stop clock; otherwise HSI16 oscillator is
selected.

It is otherwise reconfigured as MSI just after, but it slightly
increases the wake-up time and power consumption.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2021-09-28 20:14:03 -04:00
Aurelien Jarno
246ea739bb dts/arm/st: wl: increase Sub-GHz SPI frequency to 12MHz
The maximum supported speed according to the SX126x datasheet (I have
not found that information in the STM32WL datasheet or reference
manual). Increase the Sub-GHz SPI frequency from 1 Mhz to to 12 MHz,
which corresponds to a baud rate prescaler of 4 with a 48 MHz clock. It
also matches what is done the the STM32CubeWL package.

This reduces the time the MCU is kept running, thus reducing the global
power consumption.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2021-09-28 20:13:38 -04:00
Emil Gydesen
c938c81575 Bluetooth: Audio: VCS client use auto CCC discovery
Update the VCS client to use the auto CCC discovery
feature instead of expecting it to be a specific place
in the remote server's GATT database.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-09-28 20:12:55 -04:00
Yuval Peress
03bcf8276a emul: Support getting an emulator by name
Issue #38271

Implement a getter for emulators similar to device_get_binding. This
function can be used to get the emulator instance during tests to call
emulator specific functions.

Example: The current BMI160 emulator pre-defines a finite set of data
samples that will be returned. If a test was to be written for logic
that uses that data, then the emulator would become completely useless
without the ability for the test to define what data should be returned.

This will also help in exercising error conditions in tests.

Signed-off-by: Yuval Peress <peress@chromium.org>
2021-09-28 20:12:37 -04:00
Gregers Gram Rygg
d47bd60933 soc: nordic_nrf: Add Kconfig option for enabling trace port
Add Kconfig option to enable the hardware trace port in the SystemInit()
function.

Signed-off-by: Gregers Gram Rygg <gregers.gram.rygg@nordicsemi.no>
2021-09-28 20:11:40 -04:00
Robert Lubos
0dbdcc770d net: sockets: Add socket processing priority
When creating a socket, all of the registered socket implementation are
processed in a sequence, allowing to find appropriate socket
implementation for specified family/type/protocol. So far however,
the order of processing was not clearly defined, leaving ambiguity if
multiple implmentations supported the same set of parameters.

Fix this, by registering socket priority along with implementation. This
makes the processing order of particular socket implementations
explicit, giving more flexibility to the user, for example when it's
neeed to prioritze one implementation over another if they support the
same set of parameters.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2021-09-28 20:11:26 -04:00
Robert Lubos
8b851af02a net: sockets: Register native TCP/UDP like any other socket type
This will allow to assing priority to a native TCP/UDP socket
implementation as well.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2021-09-28 20:11:26 -04:00
Marin Jurjević
f4a5c7d680 logging: use green color for info log level
Info log messages don't have dedicated color which
makes them harder to separate from debug logs.

Introduce green color in log output for info level
so it stands out like error and warning messages do.

Signed-off-by: Marin Jurjević <marin.jurjevic@hotmail.com>
2021-09-28 20:10:41 -04:00
Dawid Niedzwiecki
1031cfd51e drivers: serial: ns16550: fill full fifo
Put the maximum number of bytes into Tx FIFO in the fill_fifo routine
to reduce CPU usage.

Previously, the THRE bit was checked in a loop, but, according to doc -
"In the FIFO mode, it is set when the XMIT FIFO is empty, and is
cleared when at least one byte is written to XMIT FIFO.", so only one
byte was transferred every interrupt. That was generating a big amount
of interrupts, which consumes CPU time.

Signed-off-by: Dawid Niedzwiecki <dn@semihalf.com>
2021-09-28 20:10:00 -04:00
Gerson Fernando Budke
d3a558591f dts: bindings: vendor-prefixes: Add gigadevice prefix
Add gigadevice manufacturer binding prefix.

Signed-off-by: Gerson Fernando Budke <gerson.budke@atl-electronics.com>
2021-09-28 20:07:47 -04:00
Emil Gydesen
5a11a19713 Bluetooth: Iso: Add BT_ISO_SDU_BUF_SIZE macro
Add the BT_ISO_SDU_BUF_SIZE which can be used to declare
the TX buffers for ISO, similar to the BT_L2CAP_SDU_BUF_SIZE
macro for L2CAP.

This also updates the ISO samples to use this as well
updating the SDU check to use
CONFIG_BT_ISO_TX_MTU/CONFIG_BT_ISO_RX_MTU without
subtracting the BT_ISO_CHAN_SEND_RESERVE to make the
API more clear.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-09-28 20:07:32 -04:00
Henrik Brix Andersen
c5634f1b08 boards: arm: mimxrt1024_evk: enable flexcan1
Enable FlexCAN1 on the NXP i.MX RT1024 Evaluation Kit.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2021-09-28 20:06:45 -04:00
Sylvio Alves
fd3696a216 cmake: esp32: use zephyr defined python tool
This configures esptool, partition generator and
external bootloader build to use python tool defined
in Zephyr's context environment. This fixes error
regarding missing /usr/bin/python when python2.7 is not
installed in users's machine.

Partition table offset is also updated as part of
this change.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2021-09-28 20:06:25 -04:00
Sylvio Alves
0794bdde09 docs: esp32: update environment setup content
Add toolchain path updates into documentation.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2021-09-28 20:06:25 -04:00
Sylvio Alves
e47eeec810 toolchain: esp32: define target toolchain
In order to retrieve TOOLCHAIN_NAME from Kconfig,
generic.cmake points to any toolchain as a
boilerplate implementation. Now, target.cmake file handles
proper toolchain selection.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2021-09-28 20:06:25 -04:00
Jaxson Han
207926c479 arm64: Kconfig: Enable userspace feature
Enable userspace for Armv8R aarch64

Signed-off-by: Jaxson Han <jaxson.han@arm.com>
2021-09-28 20:06:06 -04:00
Jaxson Han
f079e6638f scripts: Add align for empty _app_smem region
When _app_smem region is empty, alignment is also needed. If there
is no alignment, the _app_smem_start used by arm mpu can be lower
than __rodata_region_end, and this two regions can overlap.

The Armv8-R aarch64 MPU does not allow overlapped regions.

Signed-off-by: Jaxson Han <jaxson.han@arm.com>
2021-09-28 20:06:06 -04:00
Jaxson Han
b7734d2ba0 tests: ztests: error_hook: Fix for Armv8R aarch64
Fix the trigger_fault_access. The fix is similar to cortex m.
Fix the trigger_fault_divide_zero. The fix is similar to qemu, i.e.
skip this testcase, because FVP would not trigger the exception for
dividing zero either.

Signed-off-by: Jaxson Han <jaxson.han@arm.com>
2021-09-28 20:06:06 -04:00
Jaxson Han
27ed237f6d arm64: arm_mpu: Add userspace
Add dynamic_areas_init. It will mark a mpu region as a dynamic region
area. The dynamic region areas is designed to be the background
regions, so that the system could re-program the thread regions on
the backgroud regions.

Add configure_dynamic_mpu_regions to re-program the thread regions on
the backgroud regions. The configure_dynamic_mpu_regions function is
the core function of implementing the userspace for the MPU. This
function is used in thread creation and context switch.

During context switch, the pre thread's regions should be disabled,
and the new thread's regions will be re-programed. Since the thread's
stack region will also be switched, there will be a problem before
new thread's region being re-programed which is the new thread's
stack usage. To avoid the exception generated by stack usage caused by
unprogramed new thread's stack region, I disable mpu first before
flush_dynamic_regions_to_mpu and then enable it.

Signed-off-by: Jaxson Han <jaxson.han@arm.com>
2021-09-28 20:06:06 -04:00
Jaxson Han
fa494e78b2 soc: arm64: Adjust the fvp_aemv8r's data region
When userspace enabled, the zephyr data region should start from
_app_smem_start instead of __kernel_ram_start.

Signed-off-by: Jaxson Han <jaxson.han@arm.com>
2021-09-28 20:06:06 -04:00
Jaxson Han
63867d95d0 include: arm64: Fix the init region attrs
Fix the attrs of init fix mem regions for userspace.
Allow RAM region and RO region be read-only for EL0.

Signed-off-by: Jaxson Han <jaxson.han@arm.com>
2021-09-28 20:06:06 -04:00
Jaxson Han
ac0c0a61d5 include: arm64: Refine the mem alignment macros
Add a new macro MEM_DOMAIN_ALIGN_AND_SIZE for mmu and mpu mem
alignment.
MEM_DOMAIN_ALIGN_AND_SIZE is
  - CONFIG_MMU_PAGE_SIZE, when mmu is enabled.
  - CONFIG_ARM_MPU_REGION_MIN_ALIGN_AND_SIZE when mpu enabled.

Signed-off-by: Jaxson Han <jaxson.han@arm.com>
2021-09-28 20:06:06 -04:00