Commit graph

73689 commits

Author SHA1 Message Date
Emil Gydesen
249d4774f3 Bluetooth: Audio: Add bt_audio_dir_str to improve logging of dir
The direction of a stream/endpoint/parameter has just been
logged as a unsigned integer. This commits adds a
value -> string internal function that would log
BT_AUDIO_DIR_SINK as "sink" and BT_AUDIO_DIR_SOURCE
as "source".

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-01-09 12:18:03 +01:00
Henrik Brix Andersen
11aa8454f0 Revert "random: Change testing random generator"
This reverts commit d6881de3b3.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-01-09 19:29:50 +09:00
Declan Snyder
d6881de3b3 random: Change testing random generator
The old random timer test was not random-looking
enough on some platforms.

Replace with new test which is psuedo-xoshiro.

The generator is still deterministic
and does not depend on entropy at all,
but should look more random for testing.

Change name of generator tree-wide also.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2023-01-09 10:16:55 +01:00
Jakub Zimnol
e065050f1b boards: xtensa: m5stickc_plus: initial support
adds initial support for M5StickC-Plus board

Signed-off-by: Jakub Zimnol <j.zimnol@avsystem.com>
2023-01-09 10:16:27 +01:00
Guillaume Gautier
5bdea1f022 west.yml: Update west.yml with latest STM32 HAL version
Update west.yml with latest STM32 HAL version

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2023-01-09 10:15:52 +01:00
Patryk Duda
09277d44e3 drivers: watchdog: Make SOC reset as an option in counter watchdog
When using watchdog which doesn't support callbacks (e.g. STM32 IWDG)
it's very useful to have counter based watchdog with shorter timeout.
This way we can gather useful information before IWDG resets SOC.

In above case it's usually not desired to reset SOC when counter
watchdog is triggerd, because we can lose information about reset cause.
For example, STM32 can determine if the reset was caused by watchdog.

Another use case for counter watchdog without SOC reset is to detect
slow code paths.

Signed-off-by: Patryk Duda <pdk@semihalf.com>
2023-01-09 10:15:33 +01:00
Carlo Caione
c13d23a43e riscv: Add support for hardware stacking / unstacking
Some RISC-V SoCs implement a mechanism for hardware supported stacking /
unstacking of registers during ISR / exceptions. What happens is that on
ISR / exception entry part of the context is automatically saved by the
hardware on the stack without software intervention, and the same part
of the context is restored by the hardware usually on mret.

This is currently not yet supported by Zephyr, where the full context
must be saved by software in the full fledged ESF. This patcheset is
trying to address exactly this case.

At least three things are needed to support in a general fashion this
problem: (1) a way to store in software only the part of the ESF not
already stacked by hardware, (2) a way to restore in software only the
part of the context that is not going to be restored by hardware and (3)
a way to define a custom ESF.

Point (3) is important because the full ESF frame is now composed by a
custom part depending on the hardware (that can choose which register to
stack / unstack and the order they are saved onto the stack) and a part
defined in software for the remaining part of the context.

In this patch a new CONFIG_RISCV_SOC_HAS_ISR_STACKING is introduced that
enables the code path supporting the three points by the mean of three
macros that must be implemented by the user in a soc_stacking.h file:
SOC_ISR_SW_STACKING, SOC_ISR_SW_UNSTACKING and SOC_ISR_STACKING_ESF
(refer to the symbol help for more details).

This is an example of soc_isr_stacking.h for an hardware that doesn't do
any hardware stacking / unstacking but everything is managed in
software:

    #ifndef __SOC_ISR_STACKING
    #define __SOC_ISR_STACKING

    #if !defined(_ASMLANGUAGE)

    #define SOC_ISR_STACKING_ESF_DECLARE \
    	struct __esf { \
    		unsigned long ra; \
    		unsigned long t0; \
    		unsigned long t1; \
    		unsigned long t2; \
    		unsigned long t3; \
    		unsigned long t4; \
    		unsigned long t5; \
    		unsigned long t6; \
    		unsigned long a0; \
    		unsigned long a1; \
    		unsigned long a2; \
    		unsigned long a3; \
    		unsigned long a4; \
    		unsigned long a5; \
    		unsigned long a6; \
    		unsigned long a7; \
    		unsigned long mepc; \
    		unsigned long mstatus; \
    		unsigned long s0; \
    	} __aligned(16)
    #else

    #define SOC_ISR_SW_STACKING \
    	addi sp, sp, -__z_arch_esf_t_SIZEOF; \
    	DO_CALLER_SAVED(sr);

    #define SOC_ISR_SW_UNSTACKING \
    	DO_CALLER_SAVED(lr);

    #endif /* _ASMLANGUAGE */
    #endif /* __SOC_ISR_STACKING */

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2023-01-09 10:15:07 +01:00
Guillaume Gautier
b0d70ba176 boards: arm: b_l072z_lrwan1: Use LSE for RTC source clock
* This board was originally configured through its Kconfig to use LSE
instead of LSI for the RTC source clock, so the dts is updated
accordingly.
* Remove the RTC source clock symbol from the Kconfig since it is now
deprecated.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2023-01-09 10:14:35 +01:00
Guillaume Gautier
3e6c9c40aa drivers: counter: Properly deprecate Kconfig symbols in STM32 RTC driver
Now that both RTC source clock Kconfig symbols are disabled by default,
we invert the ifdef so that in the absence of configuration we still
fall in the LSI configuration.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2023-01-09 10:14:35 +01:00
Guillaume Gautier
1cbc1c14f0 drivers: counter: Deprecate Kconfig STM32 source clock
Following #50104, properly deprecates old Kconfig symbols concerning
RTC source clock and makes them optional to have them disabled by
default.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2023-01-09 10:14:35 +01:00
Tim Lin
31791f87e4 ITE: dts: it8xxx2: Separate device nodes from it8xxx2.dtsi
The GCR, PINCTRL, I2C and WUC registers of the it82xx2 will be remapped,
so these device nodes will not be in the it8xxx2.dtsi, these should be
separated to create a it81xx2.dtsi.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2023-01-09 10:14:21 +01:00
Guillaume Gautier
45b0804550 tests: drivers: counter: counter_basic_api: src: Fix STM32 RTC device
Commit fd65800 introduced a regression for the counter_basic_api test for
STM32 by using a Silabs Gecko Kconfig to enable the STM32 RTC.
This commit uses the proper STM32 Kconfig for the RTC instead.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2023-01-09 10:14:06 +01:00
Marti Bolivar
c3d39d9573 doc: application development: adjust creation section hierarchy
The 'Creating an Application' section has existed for several years
and predates the introduction of the example-application repository.

It's still a good reference, but it's not really the easiest way to
make an applications any more. Judging by experience watching users
ask questions and receive support on Discord, the example-application
repository is serving its purpose as a better 'pre-cooked' starting
point.

Adjust the hierarchy so that there's a single, parent section about
creating applications, which has using example-application as one
alternative, and doing it by hand as a less-recommended option. Add
more text on exactly what you need to do with example-application to
get something you can actually use.

Signed-off-by: Marti Bolivar <marti.bolivar@nordicsemi.no>
2023-01-08 19:51:47 +01:00
Marti Bolivar
873b63109b doc: application: improve example-application section
The 'Example Application' text is similar to but not the same as the
name of the repository, which is example-application. Use the name of
the repository instead. This is easier to search for and plants seeds
in people's memory about where to find it on GitHub.

Add more cross references.

Signed-off-by: Marti Bolivar <marti.bolivar@nordicsemi.no>
2023-01-08 19:51:47 +01:00
Marti Bolivar
82ed21d9e7 doc: application: improve application types section
Add more cross-references to the overview and make a few other
improvements. In particular, adapt to David Kinder's recommended
style (lowercase 'zephyr' for the repository, capitalized 'Zephyr' for
the more general software distribution).

Signed-off-by: Marti Bolivar <marti.bolivar@nordicsemi.no>
2023-01-08 19:51:47 +01:00
Marti Bolivar
c1d31734f9 doc: application: clean up overview
A few things are stale or missing:

- Using the term 'kernel' is outdated at this point. It's been years
  since Zephyr was just a kernel, and we now include many modules as
  well as our internal subsystems and driver layers. Make that clearer
  in the overview.

- Devicetree overlays are a basic piece of zephyr applications and
  they're worth highlighting at this introductory place as well. Note
  that neither app.overlay or prj.conf are actually required to be
  present, so if we're mentioning prj.conf here, we might as well
  mention app.overlay too.

- Explain the basic purpose of and differences between Kconfig
  fragments and DT overlays.

Clean up some other language and provide some more cross references.

Signed-off-by: Marti Bolivar <marti.bolivar@nordicsemi.no>
2023-01-08 19:51:47 +01:00
Marti Bolivar
20b1c56572 doc: application: make default app a workspace app
It is well known that putting your application inside the west
workspace where zephyr is installed, i.e. defining a workspace
application, makes it easier to use west build, since you don't have
to juggle setting ZEPHYR_BASE appropriately.

Therefore, recommend doing thing this way, while leaving a hint about
how to do something else.

The current state of affairs where the application is assumed to be in
$HOME/app is longstanding and precedes the introduction of west to
zephyr, and I think it's overdue for the page to get with the times
and use conventions that work well with west: our reference
application has been a workspace application for almost 2 years at
this point.

Create a new meta-variable <app> to describe the location of the
application to keep things short and make it clearer that the actual
location on the file system doesn't matter as long as things are set
up properly.

Signed-off-by: Marti Bolivar <marti.bolivar@nordicsemi.no>
2023-01-08 19:51:47 +01:00
Erwan Gouriou
af0576b7ea drivers: flash: stm32: Remove useless Kconfig
SOC_FLASH_STM32_V1 is not used anymore.
Remove it

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2023-01-08 19:49:12 +01:00
Erwan Gouriou
cc1601fde7 driver: flash: stm32: Use compat information to select file to build
Now that compatible is directly linked with driver version,
use DT compat based Kconfig flag to build the correct flash driver
version.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2023-01-08 19:49:12 +01:00
Erwan Gouriou
306f4d0bbc dts: stm32: flash: Get all series using same driver to use same compat
Compat "st,stm32f1-flash-controller" is now used by all series using
F1x flash driver.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2023-01-08 19:49:12 +01:00
Erwan Gouriou
a934cce35b drivers: flash: stm32: Rename v1 driver into f1x
Instead of introducing a vX driver version, use series name.
With this commit F0, F1, F3, L0 and L1 series are using F1 flash driver.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2023-01-08 19:49:12 +01:00
Daniel DeGrasse
a3f2d2bbde tests: drivers: adc: add support for RT595 to ADC API test
Enable support for RT595 in ADC API testcase

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2023-01-08 19:48:54 +01:00
Daniel DeGrasse
64ff9aa4d2 samples: drivers: adc: add support for RT595
Add support for RT595 evk to adc driver sample. RT595 uses external
reference voltage, which is set to 1.8V on this board.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2023-01-08 19:48:54 +01:00
Daniel DeGrasse
46aec6dbea boards: arm: mimxrt595_evk add adc support
Add ADC support for RT595 EVK, with channels 0 and 8 connected via
pin control.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2023-01-08 19:48:54 +01:00
Daniel DeGrasse
29c53f4f6a drivers: adc_mcux_lpadc: add clock setup for RT5xx SOC
Add clock setup code for RT5xx series SOC to LPADC driver

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2023-01-08 19:48:54 +01:00
Erik Brockhoff
2f61771948 Bluetooth: controller: consider host ctrl feature bits in feat exchange
Host controlled feature bits were not considered in feature exchange
procedure. This is fixed.

Signed-off-by: Erik Brockhoff <erbr@oticon.com>
2023-01-08 19:48:38 +01:00
Erwan Gouriou
c5ab922f50 drivers: hci: stm32wb: Use clock_control driver for clock configuration
Instead of relying on STM32Cube API, use clock_control framework
for clock configuration inside this driver.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2023-01-08 19:48:27 +01:00
Erwan Gouriou
561fd80180 dts: stm32wb: Add a node for stm32wb rf
Purpose of this node is only to provide a way to configure RF
clock using device tree and clock_control driver.

Default configuration is reproducing existing hard-coded configuration.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2023-01-08 19:48:27 +01:00
Erwan Gouriou
c83bc0539c include: dt-bindings: clocks: stm32wb_clock: Add RFWKP_SEL()
Add macros and defines related to the ability to select RFWK domain
clock.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2023-01-08 19:48:27 +01:00
Erwan Gouriou
f3e788e84e drivers: hci: stm32wb: Refactor c2_reset()
In preparation of the introduction of dt configured clock in this
driver, refactor clock related clocks.
- remove start_ble_rf()
- Move  IPCC clock activation in c2_reset()

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2023-01-08 19:48:27 +01:00
Erwan Gouriou
079a43d9f8 drivers: hci: stm32wb: LSE clock configuration not required
As long as LSE clock is set in device tree, configuration will be
done in clock control driver, no need to do it here.
Besides, remove back up domain related code as this is also already
handled in clock_control driver.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2023-01-08 19:48:27 +01:00
Erwan Gouriou
52b9724a88 drivers: hci: stm32wb: LSI is not an allowed clock for BLE RF.
Remove code related to LSI used as clock source for RF wakeup,
it isn't a valid clock source.
Also don't disable LSI when LSE is selected.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2023-01-08 19:48:27 +01:00
Erwan Gouriou
f1dfeff282 drivers: hci: stm32wb: Don't mess with RTC Clock source
No reason to update RTC clock source in this driver.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2023-01-08 19:48:27 +01:00
Aaron Massey
c4be38dec1 fuel_gauge: sbs_gauge: Enable MFR ACC write
Update the SBS Gauge driver that implements the fuel_gauge API to implement
a set_property function allowing the writing of an SBS word to the
manufacturer access register per the SBS spec.

Includes an update to the SBS Gauge emulator and SBS fuel gauge tests to
weakly verify the code runs.

Signed-off-by: Aaron Massey <aaronmassey@google.com>
2023-01-08 19:48:12 +01:00
Aaron Massey
48d5b6c1f1 emul: Correct emul_sbs_gauge to allow SBS word r/w
Fix SBS I2C transfer emulation to accept reads and writes of 16 bit words
as defined by the SBS spec. This change is tested by a following commit
that implements writing and subsequently reading a written SBS property.

Signed-off-by: Aaron Massey <aaronmassey@google.com>
2023-01-08 19:48:12 +01:00
Aaron Massey
f5d269538b fuel_gauge: Add writable mfr access prop
Add fuel_gauge_set_property function to the fuel gauge API with starting
writable property of SBS specific manufactuer access.

Signed-off-by: Aaron Massey <aaronmassey@google.com>
2023-01-08 19:48:12 +01:00
Aaron Massey
c0762d003a fuel_gauge: Implement sbs gauge read for mfr acc
Implement and weakly test fetching the manufacturer access word from an SBS
compatible fuel gauge.

Signed-off-by: Aaron Massey <aaronmassey@google.com>
2023-01-08 19:48:12 +01:00
Aaron Massey
db60e08604 fuel_gauge: Add readable mfr access prop
Add the SBS manufactuer access as a fuel gauge readable property.

Signed-off-by: Aaron Massey <aaronmassey@google.com>
2023-01-08 19:48:12 +01:00
Emil Gydesen
57218eee31 Bluetooth: Host: Add BT_CONN_INTERVAL_TO_US
The macro BT_CONN_INTERVAL_TO_MS was used a fair amount
of places, but it often was used with integers. This meant
that sometimes the resulting (integer) value would be
incorrect, as something like 7.5ms interval would not
be properly stored as a integer in millisecond units.

Adding BT_CONN_INTERVAL_TO_US allows users to still use
integers to store the result, but in a more accurate unit.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-01-08 19:47:03 +01:00
Peter Johanson
8a29ed9092 drivers: adc: Fix ADC tests for new RP2040 board.
Fix ADC tests with new SparkFun Pro Micro RP2040 board.

Signed-off-by: Peter Johanson <peter@peterjohanson.com>
2023-01-08 19:32:59 +01:00
Peter Johanson
e8aeea6d5d boards: arm: Add sparkfun_pro_micro_rp2040 board
Add `sparkfun_pro_micro_rp2040` board with `sparkfun,pro-micro` header.

Signed-off-by: Peter Johanson <peter@peterjohanson.com>
2023-01-08 19:32:59 +01:00
Flavio Ceolin
05d3b57851 doc: security: Disclose CVE information
Add information about CVE-2022-2993

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2023-01-07 21:34:33 +01:00
Joakim Andersson
3c4783042e manifest: Update TF-M to use upstream patch for MBedTLS build warnings
Update TF-M version which remove the downstream patch and replaces it
with the upstream TF-M patch for masking MBedTLS build warning of
unused const variable.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2023-01-06 22:33:37 +09:00
Emil Gydesen
8d86fa0125 Bluetooth: Audio: Add support for encrypted broadcast
Add support for adding a broadcast code to the broadcast
source.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-01-06 10:35:25 +00:00
Emilio Benavente
9b1b68657c tests: drivers: i2s: Combined merged the test files into main
Since main was only registering the Test Suite, it made since
to combine the actual tests into one file instead of having
an empty file to initialize the test.

Signed-off-by: Emilio Benavente <emilio.benavente@nxp.com>
2023-01-06 10:34:45 +00:00
Emilio Benavente
3ffc64a92d tests: drivers: i2s: ZTest ordering issue fix
The test was executing the expected functions
out of order. I have created a config functions
and explicitly declared them to be setup functions
for this ZTest framework.

Signed-off-by: Emilio Benavente <emilio.benavente@nxp.com>
2023-01-06 10:34:45 +00:00
Emilio Benavente
d4cfc35b8d tests: drivers: i2s: Fix Label Property issue
The I2S Speed test attempted to find a device
via the Label Property of the node. I have updated
the code to search for the nodelabel instead.

Signed-off-by: Emilio Benavente <emilio.benavente@nxp.com>
2023-01-06 10:34:45 +00:00
Emilio Benavente
fdad738cff tests: drivers: i2s: Adding overlays to I2S supported boards
Adding overlay files that give an alias name to the
i2s node that is equivalent to the alias in the
i2s speed test.

Signed-off-by: Emilio Benavente <emilio.benavente@nxp.com>
2023-01-06 10:34:45 +00:00
Krzysztof Chruscinski
a326f05b93 tests: logging: log_api: Fix test_log_arguments case
Test had by accident an early return and after removal case was failing
in certain configurations. It was failing because set of long messages
was not fitting into the logging buffer used in the test. Fixed the
test by adding more frequent processing between the messages.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2023-01-05 18:28:33 -05:00
Peter Mitsis
42db096d28 kernel: resolve static analysis false positives
At least one static analysis tool is flagging a potential NULL
derefence in sys_clock_announce()'s tick processing loop where the
routine 'first()' is concerned. In practice, this does not occur as
...

  1. The code in question is protected by a spinlock.
  2. 'first()' does not change the contents of anything.

The code has consequently been tweaked to prevent similar such false
positives in the future.

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
2023-01-05 18:23:04 +00:00