Commit Graph

74670 Commits

Author SHA1 Message Date
Andrei Emeltchenko f9ced67170 bluetooth: audio: Fix dereference before NULL check
Dereference only after NULL check.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-01-30 23:47:55 +00:00
Andrei Emeltchenko 2782d6996a bluetooth: Fix duplicated parameter check
Parameter count is checked several lines below this line.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-01-30 23:47:55 +00:00
Nicolas Pitre 373f8acaa7 tests: riscv: test FPU sharing access behavior
The RISC-V FPU context switching code is intricate and sometimes subtle.
Here's a test that exercizes various code paths to ensure they work as
intended, and to confirm that the target hardware does behave as
expected too.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2023-01-30 23:47:36 +00:00
Nicolas Pitre 10500f1b41 riscv: cope with MTVAL not updated on illegal instruction faults
Some implementations may not capture the faulting instruction in mtval
and set it to zero when an illegal instruction fault is raised This is
notably the case with QEMU version 7.0.0 when a CSR instruction is
involved.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2023-01-30 23:47:36 +00:00
Nicolas Pitre 83f849e00e riscv: FPU trap: catch CSR access to fcsr, frm and fflags
The FRCSR, FSCSR, FRRM, FSRM, FSRMI, FRFLAGS, FSFLAGS and FSFLAGSI
are in fact CSR instructions targeting the fcsr, frm and fflags
registers. They should be caught as FPU instructions as well.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2023-01-30 23:47:36 +00:00
Nicolas Pitre b2ffee7fe2 riscv: FPU switching fixes
- IRQ state for the interrupted context corresponds to the PIE bit not
  the IE bit.

- Restoring the saved FPU state should clear the entire field before
  or'ing wanted bits in.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2023-01-30 23:47:36 +00:00
Keith Packard 9a0aebc5fd lib/libc: Enable picolibc on qemu_x86_tiny
With all of the test suite issues on this board fixed, qemu_x86_tiny should
now be usable with picolibc.

Signed-off-by: Keith Packard <keithp@keithp.com>
2023-01-30 23:46:55 +00:00
Keith Packard fb193e2d3d tests/mem_protect: Use minimal libc for kernel.memory_protection
This test has trouble on qemu_x86_tiny and randomly generates a Double
Fault error. I couldn't get it to reliably run with picolibc as a Double
Fault usually occured before the test completed.

I spent a couple of hours attempting to track this down and found that it
happens when code pages for the main thread get unmapped because the
qemu_x86_tiny intentionally offers very few available PTEs.

Work around this by just using the minimal libc for this test.

Signed-off-by: Keith Packard <keithp@keithp.com>
2023-01-30 23:46:55 +00:00
Keith Packard 6738e8e9df tests/x86/mem_protect: Disable picolibc heap for demand paging tests
These tests don't need any libc heap and currently fail when one is
available.

Signed-off-by: Keith Packard <keithp@keithp.com>
2023-01-30 23:46:55 +00:00
Keith Packard 77554a09bb tests/x86/pagetables: Check pinned memory flags
Add another clause in the test_ram_perms code to verify that any pinned
regions have the correct flags.

Signed-off-by: Keith Packard <keithp@keithp.com>
2023-01-30 23:46:55 +00:00
Keith Packard fadc6b79bb boards/qemu_x86: Don't reserve pages with no picolib heap
When there's no malloc heap needed for picolibc, don't reserve
the page frames that would be needed. This makes sure
the kernel.demand_paging tests provoke the page faults as
expected.

Signed-off-by: Keith Packard <keithp@keithp.com>
2023-01-30 23:46:55 +00:00
Keith Packard 6a9a8768e7 boards/qemu_x86_tiny: Add picolibc bits to pinned memory
Use the existing bits for newlib to make sure the picolibc files are also
placed in pinned memory.

Signed-off-by: Keith Packard <keithp@keithp.com>
2023-01-30 23:46:55 +00:00
Andrei Emeltchenko dcb199f581 bluetooth: audio: Fix NULL dereference
Fixes NULL dereference right after NULL check.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-01-30 23:46:25 +00:00
Conor Paxton 804aa29f89 riscv: smp: use devicetree to map hartids to zephyr cpus
For RISC-V, the reg property of a cpu node in the devicetree describes
the low level unique ID of each hart. Using devicetree macro's, a list
of all cpus with status "okay" can be generated.

Using devicetree overlays, a hart or multiple harts can be marked as
"disabled", thus excluding them from the list. This allows platforms
that have non-zero indexed SMP capable harts to be functionally mapped
to Zephyr's sequential CPU numbering scheme.

On kernel init, if the application has MP_MAX_NUM_CPUS greater than 1,
generate the list of cpu nodes from the device tree with status "okay"
and  map the unique hartid's to zephyr cpu's

While we are at it, as the hartid is the value that gets passed to
z_riscv_secondary_cpu_init, use that as the variable name instead of
cpu_num

Signed-off-by: Conor Paxton <conor.paxton@microchip.com>
2023-01-30 23:45:35 +00:00
Conor Paxton 02391ed00d riscv: enable booting from non-zero indexed RISC-V hart
RISC-V multi-hart systems that employ a heterogeneous core complex are
not guaranteed to have the smp capable harts starting with a unique id
of zero, matching Zephyr's sequential zero indexed cpu numbering scheme.

Add option, RV_BOOT_HART to choose the hart to boot from.
On reset, check the current hart equals RV_BOOT_HART: if so, boot first
core. else, loop in the boot secondary core and wait to be brought up.

For multi-hart systems that are not running a Zephyr mp or smp
application, park the non zephyr related harts in a wfi loop.

Signed-off-by: Conor Paxton <conor.paxton@microchip.com>
2023-01-30 23:45:35 +00:00
Fabio Baltieri 20644536b9 uart: microchip: fix build error with PM_DEVICE=n
Fix a build error when the driver is built with:

CONFIG_PM=y
CONFIG_PM_DEVICE=n
CONFIG_UART_INTERRUPT_DRIVEN=y
CONFIG_UART_CONSOLE_INPUT_EXPIRED=y

due to uart_xec_pm_policy_state_lock_get() and rx_refresh_timeout_work()
declared under different configuration options.

Fixes: 343d1919f1 "uart: microchip: add low power & wake support"
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-01-30 18:54:59 +00:00
Francois Ramu 842a6ba02d drivers: watchdog: stm32 iwdt enable and update during setup
To follow the IWDG configuration sequence, the timeout install is
just preparing the reload and prescaler parameters.
Then during the iwdg setup the watchdog is enabled and configured
at the same time.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2023-01-30 15:05:39 +00:00
Jarno Lämsä 66a4fab571 tests: lwm2m_registry: Add ZTest tests for lwm2m_registry
These tests test the basic functionality of creating
object and resource instances, setting buffers, writing
and reading to and from resources, and setting and triggering
callbacks.

Signed-off-by: Jarno Lämsä <jarno.lamsa@nordicsemi.no>
2023-01-30 15:04:50 +00:00
Emil Gydesen 8512bd18c6 Bluetooth: Shell: Fix unintialized ad_len bug
`ad_len` was never initiatialized before we started
incremetenting and using it.

We would also override any user data in ad_init, which
is fixed by using the length of the user data as an
offset into the array.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-01-30 10:08:00 +00:00
Robert Lubos 2ab11953e3 net: context: Separate user data pointer from FIFO reserved space
Using the same memory as a user data pointer and FIFO reserved space
could lead to a crash in certain circumstances, those two use cases were
not completely separate.

The crash could happen for example, if an incoming TCP connection was
abruptly closed just after being established. As TCP uses the user data
to notify error condition to the upper layer, the user data pointer
could've been used while the newly allocated context could still be
waiting on the accept queue. This damaged the data area used by the FIFO
and eventually could lead to a crash.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2023-01-30 10:07:44 +00:00
Mahesh Mahadevan 4e6f80d37a drivers: usb: mcux: Fix the write operation
1. Do not copy over the data to the local buffer,
it can be directly sent to the controller. The
cache is flushed before calling the HAL send
function. Also do not allocate a buffer from
the heap pool for the write operation.
2. Remove a length check as this is handled by
the HAL driver.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2023-01-30 10:07:07 +00:00
Mahesh Mahadevan 9bef7d07e7 drivers: usb: mcux: Remove unnecessary while loop
The while loop is changed to an if check.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2023-01-30 10:07:07 +00:00
Mahesh Mahadevan 17da2015bc drivers: usb: Cleanup MCUX driver
1. Remove unused ep_type structure member
2. Add more direction checks

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2023-01-30 10:07:07 +00:00
Siyuan Cheng 86769f03df sample: driver: spi_flash: Add em_starterkit support
Add em_starterkit support in spi_flash driver sample
output log:
JEDEC QSPI-NOR SPI flash testing
==========================

Test 1: Flash erase
Flash erase succeeded!

Test 2: Flash write
Attempting to write 4 bytes
Data read matches data written. Good!

Signed-off-by: Siyuan Cheng <siyuanc@synopsys.com>
2023-01-30 10:06:24 +00:00
Anas Nashif ef9d5bbddf twister: print synopsis at the end and instruction for reproducing
If errors are found and tests are failing, print a brief summary showing
the top 10 items failing with instructions on how to reproduce either
with twister or west.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-01-28 17:05:19 -05:00
Anas Nashif 79b955c80a west: build: allow --test-item to accept twister style instance names
This will allow something like this:

west build -b qemu_x86  -T samples/hello_world/sample.basic.helloworld

instead of:

cd samples/hello_world
west build -b qemu_x86  -T sample.basic.helloworld

Using this option will allow to take twister output and just pass it to
west to reproduce failures.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-01-28 17:05:19 -05:00
Anas Nashif 1008124358 west: build: handler errors in west build with --test-item
Handle errors and wrong test meta-data when using --test-item.

Fixes #52614

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-01-28 17:05:19 -05:00
Jared Baumann 5a62f2592f net: lib: Fix build warning for sockets_tls
Fixes issue where a build warning would be emmited for sockets_tls.c due
to usage of the deprecated fcntl.h header file.

Signed-off-by: Jared Baumann <jared.baumann8@t-mobile.com>
2023-01-28 08:01:03 -05:00
Thad House 92e518ed5c rpi_pico: add support for Pi Pico and C11
Currently if C11 or higher is enabled, many files fail to compile because
static_assert is defined in multiple header files. Solve this by
disabling the one in the HAL if the other macro is found

Signed-off-by: Thad House <thadhouse1@gmail.com>
2023-01-28 07:48:30 -05:00
Stephanos Ioannidis e9a59518fc release: Zephyr 3.3.0-rc1
This commit sets the Zephyr version to v3.3.0-rc1.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2023-01-28 13:56:00 +09:00
Siyuan Cheng 59130b11dc driver: gpio: Add pin_configure api for creg_gpio driver
Update pin_configure api for creg_gpio driver

Signed-off-by: Siyuan Cheng <siyuanc@synopsys.com>
2023-01-27 19:52:25 -05:00
Jamie McCrae d1c0f18e50 doc: board porting: Add runner requirements note
Add a note on requirements for runners that they be OS agnostic
and not assume a specific device or udev rule determines one
exact device.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-01-27 16:12:39 -08:00
Andrei Emeltchenko 62ab576a6a logging: shell: Fix using uninitialized variables
Fixes using uninitialized variables using returns with correct return
code.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-01-28 08:55:41 +09:00
Henrik Brix Andersen f675cf1358 boards: arm: lpcxpresso55s36: add pyocd support
Add support for flashing the NXP LPCXpresso55S36 Development Board via
pyOCD.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-01-28 08:55:31 +09:00
Henrik Brix Andersen 8d4c6b96c4 tests: drivers: gpio: add GPIO hogs test
Add test of the GPIO hog functionality using the optional GPIO APIs for
getting pin direction and configuration.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-01-27 14:38:52 -08:00
Henrik Brix Andersen cb274e6a3c drivers: gpio: add GPIO hog support
Add support for automatically configuring GPIO hogs defined in the
devicetree during system initialization.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-01-27 14:38:52 -08:00
Henrik Brix Andersen 0174e0b6c1 tests: lib: devicetree: api: add tests for DT_GPIO_HOG_* macros
Add tests for the DT_GPIO_HOG_* macros.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-01-27 14:38:52 -08:00
Henrik Brix Andersen ef61db0d29 devicetree: add DT_GPIO_HOG_* macros
Add DT_GPIO_HOG_* macros for accessing special GPIO hog node properties
from C code.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-01-27 14:38:52 -08:00
Henrik Brix Andersen fba6c7f210 scripts: kconfig: add function to determine if GPIO hogs are enabled
Existence of enabled GPIO hog nodes cannot be determined using any of the
existing kconfig functions. Add custom kconfig helper function to determine
whether any GPIO hogs nodes are enabled.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-01-27 14:38:52 -08:00
Henrik Brix Andersen 28819152cb scripts: dts: add special tooling for handling GPIO hog nodes
GPIO hog nodes contain a "gpios" property, but unlike other "*-gpios"
properties, these are not phandle-arrays as they only carry the data part
(e.g. pin, flags) but lack the phandles to the (parent) GPIO controller.

Add special devicetree tooling to handle the "gpios" property of GPIO hog
nodes and generate special devicetree helper macros as if they were phandle
arrays.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-01-27 14:38:52 -08:00
Henrik Brix Andersen b208f4da98 dts: bindings: gpio: controller: add dts binding support for GPIO hogs
Each GPIO controller may contain GPIO hog definitions. GPIO hogging is a
mechanism for providing automatic GPIO configuration during system
initialization.

Each GPIO hog is represented as a child node of the GPIO controller.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-01-27 14:38:52 -08:00
Hein Wessels 98112542c2 include: Add a macro to check pointer alignment against boundary
Add a new macro, IS_PTR_ALIGNED_BYTES() that verifies if a pointer
is aligned against a specific byte boundary supplied as argument.

Signed-off-by: Hein Wessels <heinwessels93@gmail.com>
2023-01-27 12:50:26 -08:00
Conor Paxton 6b641c3483 drivers: timer: get mtime cmp reg by reading mhartid
It is not guaranteed that a multi-core RISC-V hart numbering scheme
will match Zephyr's sequential cpu numbering scheme. Read the hartid and
use that value in calculation to get mtime_cmp reg, instead of the
current_cpu id.

Signed-off-by: Conor Paxton <conor.paxton@microchip.com>
2023-01-27 12:49:56 -08:00
Jay Vasanth 343d1919f1 uart: microchip: add low power & wake support
changes to support low power and wake support in microchip xec uart
driver. Add support for wakerx_gpio config in dts to select the wake gpio.
Configure for wake in PM_DEVICE_ACTION_SUSPEND state and clear
interrupt in wake isr. Also added support for
CONFIG_UART_CONSOLE_INPUT_EXPIRED

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2023-01-27 14:25:58 -05:00
Kevin Townsend d3d80e8b33 samples: tfm_ipc: Remove mps3_an547_ns support
The AN547 no longer functions with this TF-M sample, and has been
broken since TF-M 1.6.0 without CI catching the issue, since this sample
wasn't modified to cause a CI run on the affected target.

Removing this board from the sample until the board support can be
reworked.

Signed-off-by: Kevin Townsend <kevin.townsend@linaro.org>
Signed-off-by: David Brown <david.brown@linaro.org>
2023-01-27 14:25:30 -05:00
Joakim Andersson 8cfa0f40cb samples: tfm_secure_partition: Update sample for TF-M 1.7.0
Update TF-M secure partition sample for TF-M 1.7.0.
Removes the support for Library model in the sample.
Updates to using PSA framework 1.1.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
Signed-off-by: David Brown <david.brown@linaro.org>
2023-01-27 14:25:30 -05:00
Joakim Andersson d9b6e58eb3 modules: trusted-firmware-m: Add TF-M connection based NS API source
Add TF-M connection based NCS API source file to build.
This file is needed when a secure service is using connection
based method.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
Signed-off-by: David Brown <david.brown@linaro.org>
2023-01-27 14:25:30 -05:00
Kevin Townsend dd12dfb5ad samples: tfm_integration: Update tfm_ipc for 1.7.0
Update the sample to be compatible with API changes introduced in
TF-M 1.7.0, adding a new direct call to the PSA Crypto API to generate
random data, and cleaning up existing functions for compatibility
sake.

Signed-off-by: Kevin Townsend <kevin.townsend@linaro.org>
Signed-off-by: David Brown <david.brown@linaro.org>
2023-01-27 14:25:30 -05:00
Kevin Townsend c63fb21760 samples: tfm_integration: Remove psa_crypto
Removes the `psa_crypto` sample from the current release, due to
PSA API conflicts that can not be immediately resolved between Zephyr's
instance of MbedTLS in the NS environment, and the TF-M PSA APIs
included when building with TF-M support.

PSA API changes upstream in MbedTLS 3.2.1 (used by TF-M 1.7.0), and
MbedTLS 3.1 (used in TF-M 1.6.0) need to be be resolved in both
upstream projects before this sample can be reintroduced.

Signed-off-by: Kevin Townsend <kevin.townsend@linaro.org>
Signed-off-by: David Brown <david.brown@linaro.org>
2023-01-27 14:25:30 -05:00
Kevin Townsend a50aafd938 samples: tfm_integration: Remove psa_firmware
Removes the `psa_firmware` sample, which is based on an older version
(0.7) of the FWU service from TF-M 1.6.0. This sample needs to be
refactored to use FWU 1.0, included in TF-M 1.7.0 and future releases.

Signed-off-by: Kevin Townsend <kevin.townsend@linaro.org>
Signed-off-by: David Brown <david.brown@linaro.org>
2023-01-27 14:25:30 -05:00