Commit graph

58629 commits

Author SHA1 Message Date
Daniel DeGrasse fa56e9ee2b drivers: mcux_gpt_timer: Added GPT timer for HW clock
Added a driver to enable the GPT timer on RT1xxx parts to be used
instead of systick as a clock source. The timer is set to run in reset
mode, and uses the low frequency 32kHz oscillator for power savings

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2021-12-13 20:13:21 -05:00
Glauber Maroto Ferreira 0dfc2ea103 doc: samples: display: update documentation
- fixes sample codes' relative paths
- updates instructions to build and run for native posix
platforms on its 64 flavor.

Signed-off-by: Glauber Maroto Ferreira <glauber.ferreira@espressif.com>
2021-12-13 19:39:47 -05:00
Gerard Marull-Paretas 4985c69ab9 ci: doc-build: skip Kconfig docs build on pull requests
The documentation supports a special target named "html-fast" that skips
generation of all Kconfig pages. Instead, it creates a single dummy page
where a reference to all existing Kconfig options is placed. This means
that references are resolved, but content is not rendered. Since Kconfig
help is rendered as a literal, chances of breaking documentation
build due to Kconfig changes should be low. The change proposed in this
patch should speed up documentation build on pull requests while a
proper solution is found for the Kconfig docs.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-13 19:34:59 -05:00
Kai Vehmanen af31478e16 Revert "soc: cavs_v25: increase core count default to 4"
This reverts commit af79664da3.

The patch caused regression on TGL-H systems where only 2 DSP
cores are available. The Kconfig override used by existing SOF
application does not work with Zephyr. A quick fix using
Zephyr board revisions was considered, but review feedback
was that core count difference should be reflected in SoC-level
device tree. This will take more time to develop, so the revert
is needed to fix the immediate regression.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
2021-12-13 19:31:45 -05:00
Daniel Leung c1ac125068 tests: coredump: skip acrn_ehl_crb
The coredump tests output quite a large amount of data into
the console. However, the ACRN console only has very limited
history (comparatively), such that twister is unable to
match the necessary strings to consider the tests passed.
So skip those tests on acrn_ehl_crb.

Fixes #40887

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-12-13 19:27:24 -05:00
Peter Mitsis f8b76f3b03 kernel: add 'static' keyword to select routines
Applies the 'static' keyword to the following inlined routines:
    z_priq_dumb_add()
    z_priq_mq_add()
    z_priq_mq_remove()
As those routines are only used in one place, they no longer have
externally visible declarations.

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
2021-12-13 17:21:58 -05:00
Casper Bonde c6d7a6648e Bluetooth: Fix build error for printing LTK
CONFIG_BT_LOG_SNIFFER_INFO allows print of LTK for debugging.
If CONFIG_BT_SMP_SC_PAIR_ONLY is set a non-existing struct
entry was printes, which caused a compile-time error.

Signed-off-by: Casper Bonde <casper_bonde@bose.com>
2021-12-13 17:21:24 -05:00
Lixin Guo d4826d874e kernel: work: remove unused if statement
Condition of work == NULL is checked before, so there is no need to
check it again.

Signed-off-by: Lixin Guo <lixinx.guo@intel.com>
2021-12-13 17:20:56 -05:00
Erwan Gouriou 82b290ef48 scripts/pylib/twister: Add sn option to stm32cubeprogrgammer runner
In order to enable use of stm32cubeprogrammer runner with twister,
add "sn" tool specific option which allows to provide target serial
number and hence select the target to flash when multiple ones are
connected to the host.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-12-13 17:20:17 -05:00
Henrik Brix Andersen 33121983e9 doc: reference: promote the canbus subsystem documentation
Promote the Controller Area Network (CAN) subsystem reference
documentation from being part of the networking subsystem documentation
to having its own section.

The networking subsystem primarily deals with IP-based networking,
whereas CAN is a subsystem of its own.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2021-12-13 17:19:26 -05:00
Nicolas Pitre 40a94d2451 lib/os/heap: use BIT() and BIT_MASK() on bit fields
This is a clean way to make MISRA happy.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2021-12-13 17:16:07 -05:00
David Leach ff6907f7c9 MAINTAINERS: Update NXP platform collaborators
Add danieldegrasse to the NXP platform collaborators list.

Signed-off-by: David Leach <david.leach@nxp.com>
2021-12-13 15:49:30 -05:00
Jeremy Bettis 1e0a36c655 build: Remove unused functions
Removed unused functions, or moved inside #ifdefs.

This allows using -Werror=unused-function on the clang compiler. Tested
by building the ChromeOS EC on all supported platforms with
-Werror=unused-functions.

Signed-off-by: Jeremy Bettis <jbettis@google.com>
2021-12-13 15:49:08 -05:00
Aymeric Aillet 903c78c207 driver: i2c: TCA954X: Add support for TCA9548A
Add support for the 8 channels TCA9548A I2C mux.
Added a new binding ti,tca9548a binding inheriting
properties from ti,tca954x-base and defining its own compatibles fields.

Signed-off-by: Aymeric Aillet <aymeric.aillet@iot.bzh>
2021-12-13 18:07:08 +01:00
Aymeric Aillet ee1d849c4e driver: i2c: TCA954X: Add support for "reset-gpios"
Add an optional "reset-gpios" phandle-array
field to the driver common yaml.
The reset GPIO channel and pin can be defined
in device tree as a node property.
The driver then deassert the reset signal at mux
initialization if a "reset-gpios" has been specified.

Signed-off-by: Aymeric Aillet <aymeric.aillet@iot.bzh>
2021-12-13 18:07:08 +01:00
Aymeric Aillet 50540ed594 driver: i2c: TCA9546A: Rename to TCA954x
Prepare the driver to upcoming support of more mux references.
Rename all TCA9546A related files to TCA954x.
Keep ti,tca9546a and ti,tca9546a-channel compatible
for backward compatibility reasons.
New tca954x-base binding embedding common properties,
tca9546a binding inherits from it and define its own compatibles fields.

Signed-off-by: Aymeric Aillet <aymeric.aillet@iot.bzh>
2021-12-13 18:07:08 +01:00
Armando Visconti 13bf2e5e48 drivers/sensor: stmemsc: make use of i2c/spi dt APIs
Make use of the i2c and spi DT APIs introduced in
2946a535 and c894ad12 that get i2c_dt_spec and spi_dt_spec
as input arguments.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2021-12-13 10:21:43 -06:00
Erwan Gouriou 9407add27c samples/drivers: led_pca9633: Convert to build_only
Sample should only be run if led is present on board.
Since, this is not the case on any of the in tree boards,
set the sample as build-only.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-12-13 10:02:44 -06:00
Fabio Baltieri 98acf68d41 boards: nucleo_h745zi_q: enable POWER_SUPPLY_DIRECT_SMPS
The board is fitted with the SMPS components and have no path from
VDD_MCU to VDD_LDO.

The stm32h7_init code used to default to SMPS on supported SoC but has
been changed in 22186c7c51 to only use SMPS if explicitly configured to
do so. This is causing the board to become unresponsive after a power
cycle when flashed with the current defconfig, and needs to be started
pulling BOOT0 high to be recovered.

Setting CONFIG_POWER_SUPPLY_DIRECT_SMPS restores the intended behavior.

Signed-off-by: Fabio Baltieri <fabio.baltieri@gmail.com>
2021-12-13 09:40:21 -06:00
Joakim Andersson faad102707 modules: tfm: Fix in SPM log level silence configuration
Fix copy-paste mistake in SPM log level silence configuration, PARTITION
should be SPM in order to correctly silence SPM log.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2021-12-13 16:36:06 +01:00
Hake Huang 2f3b8b01aa twister: remove redundant required for generate-hardware-map
remove a redundate required for --generate-hardware-map

this fixing: #41066

Signed-off-by: Hake Huang <hake.huang@oss.nxp.com>
2021-12-13 08:46:15 -05:00
Kent Hall ce95e033fb tests: drivers: counter: Update tests for STM32F4 timer counter driver
Updates counter driver test suite to support STM32F4 timers.

Signed-off-by: Kent Hall <kjh2166@columbia.edu>
2021-12-11 14:20:17 -05:00
Kent Hall ba37d5935e drivers: counter: Counter API implementation for STM32F4 Series (TIMER).
- Shim for counter API using LL_TIM driver.
- Supports all general-purpose (TIMx) timers.

Signed-off-by: Kent Hall <kjh2166@columbia.edu>
2021-12-11 14:20:17 -05:00
Gerard Marull-Paretas aceed99e2d doc: extensions: link-roles: hide stderr for git describe
Redirect stderr to DEVNULL when running `git describe --exact-match`.
This prevents messages like "fatal: No names found, cannot describe
anything." to be shown.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-10 16:48:43 -05:00
Gerard Marull-Paretas 345cceabb1 ci: doc-build: use concurrency group to cancel in progress builds
Add the documentation build jobs to a concurrency group so that branch
force pushes will automatically cancel in progress jobs.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-10 16:48:15 -05:00
Gerard Marull-Paretas 204860857e doc: do not use any as default role
References should be maded using the appropriate role, e.g. :ref:,
:c:func:, :kconfig:, etc.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-10 16:43:34 -05:00
Gerard Marull-Paretas 459c3f918f doc: drop single quote references
Many documents relied on single quotes to create references, e.g.
`my_reference`. This is possible because `default_role = "any"` is
enabled in Sphinx conf.py. However, this method comes with its problems:

- It mixes all domains together, so it's not clear to what are you
  referencing: a document? a Kconfig option? a C function?...
- It creates inconsistencies: in some places explicit roles are used
  (e.g. :ref:`my_page`) while in some others not.
- _Conflictis_ with markdown. Single quotes are used for literals in
  Markdown, so people tend to use the same syntax in Sphinx, even though
  it has a different purpose.

Usages have been found using `git grep ' `[^`]*` ' -- **/*.rst`.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-10 16:43:34 -05:00
Gerard Marull-Paretas 4dae2433d4 ci: doc-build: disable parallel build
When an error happens during the Sphinx build (e.g. due to a broken
reference), the process hangs on CI when run with both `-j auto`
(parallel build) and `-W` (warnings as errors) options. The root cause
of the issue is unknown, and does not seem to happen locally. Parallel
builds are experimental on Sphinx, so they have been disabled on CI for
now.  Because CI runner is a single core machine, the build time should
remain equal or similar. The option is still left as default, so local
builds will continue to benefit from parallelization.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-10 16:42:57 -05:00
Casper Meijn c8c93afc76 boards: arm: pinetime: Enable ST7789v driver
When the application requests `CONFIG_DISPLAY`, then automatically
enable the display driver using `CONFIG_ST7789V`.

Signed-off-by: Casper Meijn <casper@meijn.net>
2021-12-10 09:02:52 -06:00
Johann Fischer 02d1fd9ad7 linker: remove unused usb_data data section in RAM
Remove unused usb_data data section in RAM which is
replaced by iterable section usb_cfg_data.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-12-10 07:22:15 -06:00
Johann Fischer 5296339fde usb: rework to use macro STRUCT_SECTION_FOREACH
Replace deprecated macro USBD_CFG_DATA_DEFINE by
USBD_DEFINE_CFG_DATA which places usb_cfg_data structures
in specific iterable section.

Replace __usb_data_start, __usb_data_end usage patterns
  size_t size = (__usb_data_end - __usb_data_start);
  for (size_t i = 0; i < size; i++) {...}
by
  STRUCT_SECTION_FOREACH(usb_cfg_data, ...) {...}

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-12-10 07:22:15 -06:00
Johann Fischer b1356e969d include: usb: add iterable section in ram for usb_cfg_data
Add iterable section in ram for struct usb_cfg_data and
new makro USBD_DEFINE_CFG_DATA which should be used to
define usb_cfg_date structures.

Deprecate makro USBD_CFG_DATA_DEFINE.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-12-10 07:22:15 -06:00
Johann Fischer dfb7a5952f include: usb: add alignment attribute to macro USBD_CFG_DATA_DEFINE
It could be observed on native_posix_64 platform that
without alignment attribute the usb_cfg_data structures
are placed with a gap or padding in specified RAM section.
This breaks the possibility to iterate over the structures.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-12-10 07:22:15 -06:00
Fabio Baltieri c07d747173 cmake: use the correct property for the memory region name
Fix the zephyr_linker_dts_memory to lookup the correct property name
when trying to figre the region name.

Signed-off-by: Fabio Baltieri <fabio.baltieri@gmail.com>
2021-12-10 07:14:00 -06:00
Fabio Baltieri a87ce2ddde dts: bindings: stm32-ccm: use the mem-region property
Include the mem-region bindings for the stm32 ccm nodes and set the name
in the current dtsi files.

Signed-off-by: Fabio Baltieri <fabio.baltieri@gmail.com>
2021-12-10 07:14:00 -06:00
Fabio Baltieri 4c937fd16d boards: stm32: set compatible and name for sdram nodes
Add the compatible property to the board level sdram nodes in few stm32
dts files so that the zephyr,memory-region name is used correctly in the
linker script.

Signed-off-by: Fabio Baltieri <fabio.baltieri@gmail.com>
2021-12-10 07:14:00 -06:00
Carles Cufi 2bc9cb4691 sensor: bmi160: Fix address-of-packed-mem warning
The warning below appears once -Waddress-of-packed-mem is enabled:

/__w/zephyr/zephyr/drivers/sensor/bmi160/bmi160.c: In function
bmi160_gyr_channel_get:
/__w/zephyr/zephyr/drivers/sensor/bmi160/bmi160.c:795:23: error: taking
address of packed member of struct <anonymous> may result in an
unaligned pointer value [-Werror=address-of-packed-member]
  795 |           data->sample.gyr, val);
      |           ~~~~~~~~~~~~^~~~
/__w/zephyr/zephyr/drivers/sensor/bmi160/bmi160.c: In function
bmi160_acc_channel_get:
/__w/zephyr/zephyr/drivers/sensor/bmi160/bmi160.c:807:23: error: taking
address of packed member of struct <anonymous> may result in an
unaligned pointer value [-Werror=address-of-packed-member]
  807 |           data->sample.acc, val);
      |           ~~~~~~~~~~~~^~~~

To avoid the warning, make the struct non-packed, since it is not
necessary in this case given that a union already guarantees that the
pointer to the union points to each member of the union equally..

More info in #16587.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2021-12-10 14:08:59 +01:00
Carles Cufi 0b96dd419d tests: lib: mpsc_pbuf: Fix address-of-packed-mem warning
The warning below appears once -Waddress-of-packed-mem is enabled:

/__w/zephyr/zephyr/tests/lib/mpsc_pbuf/src/main.c: In function
'item_put_data_overwrite':
/__w/zephyr/zephyr/tests/lib/mpsc_pbuf/src/main.c:497:3: error:
converting a packed 'struct test_data_ext' pointer (alignment 1) to a
'uint32_t' {aka 'const unsigned int'} pointer (alignment 4) may result
in an unaligned pointer value [-Werror=address-of-packed-member]
  497 |   mpsc_pbuf_put_data(&buffer, (uint32_t *)&item, len);

To avoid the warning, as well as several others related to the same
problem, use an intermediate void * variable.

More info in #16587.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2021-12-10 14:08:59 +01:00
Carles Cufi cfbaac6733 tests: kernel: Fix address-of-packed-mem warning
The warning below appears once -Waddress-of-packed-mem is enabled:

/__w/zephyr/zephyr/tests/kernel/mem_protect/userspace/src/main.c: In
function 'test_main':
/__w/zephyr/zephyr/tests/kernel/mem_protect/userspace/src/main.c:1024:17:
error: converting a packed 'k_thread_stack_t' {aka 'struct
z_thread_stack_element'} pointer (alignment 1) to a 'struct
z_x86_thread_stack_header' pointer (alignment 4096) may result in an
unaligned pointer value [-Werror=address-of-packed-member]
 1024 |  hdr = ((struct z_x86_thread_stack_header *)ztest_thread_stack);

To avoid the warning, use an intermediate void * variable.

More info in #16587.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2021-12-10 14:08:59 +01:00
Carles Cufi 710e03b990 gpio: sx1509b: Fix address-of-packed-mem warning
The warning below appears once -Waddress-of-packed-mem is enabled:

/__w/zephyr/zephyr/drivers/gpio/gpio_sx1509b.c: In function
'port_write':
/__w/zephyr/zephyr/drivers/gpio/gpio_sx1509b.c:456:19: error: taking
address of packed member of 'struct sx1509b_pin_state' may result in an
unaligned pointer value [-Werror=address-of-packed-member]
  456 |  uint16_t *outp = &drv_data->pin_state.data;

To avoid the warning, use an intermediate void * variable.

More info in #16587.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2021-12-10 14:08:59 +01:00
Carles Cufi 4f64ae383d x86: acpi: Fix address-of-packed-mem warning
The warning below appears once -Waddress-of-packed-mem is enabled:

/home/carles/src/zephyr/zephyr/arch/x86/core/acpi.c: In function
'z_acpi_find_table':
/home/carles/src/zephyr/zephyr/arch/x86/core/acpi.c:190:24: warning:
taking address of packed member of 'struct acpi_xsdt' may result in an
unaligned pointer value [-Waddress-of-packed-member]
  190 |    for (uint64_t *tp = &xsdt->table_ptrs[0]; tp < end; tp++) {

To avoid the warning, use an intermediate void * variable.

More info in #16587.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2021-12-10 14:08:59 +01:00
Carles Cufi 55350a93e9 kernel: userspace: Fix address-of-packed-mem warning
The warning below appears once -Waddress-of-packed-mem is enabled:

/home/carles/src/zephyr/zephyr/kernel/userspace.c: In function
'unref_check':
/home/carles/src/zephyr/zephyr/kernel/userspace.c:471:28: warning:
converting a packed 'struct z_object' pointer (alignment 4) to a 'struct
dyn_obj' pointer (alignment 16) may result in an unaligned pointer value
[-Waddress-of-packed-mem
ber]
  471 |    CONTAINER_OF(ko, struct dyn_obj, kobj);

To avoid the warning, use an intermediate void * variable.

More info in #16587.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2021-12-10 14:08:59 +01:00
Carles Cufi 2000cdf6dc kernel: mmu: Fix access to unpacked member inside packed struct
The following warning is triggered by GCC when
-Waddress-of-packed-member is enabled:

/home/carles/src/zephyr/zephyr/kernel/mmu.c: In function
'free_page_frame_list_put':
/home/carles/src/zephyr/zephyr/kernel/mmu.c:383:42: warning: taking
address of packed member of 'struct z_page_frame' may result in an
unaligned pointer value [-Waddress-of-packed-member]
  383 |  sys_slist_append(&free_page_frame_list, &pf->node);

This is due to the fact that sys_snode_t node is an unpacked structure
inside a packed z_page_frame structure, so that the alignment of the
former cannot be ensured if placed inside the latter.

Given that alignment of z_page_frame is ensured by the code, silence the
compiler by going through an intermediate variable.

More info in #16587.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2021-12-10 14:08:59 +01:00
Carles Cufi 6b46ea3d65 Bluetooth: controller: Fix access to members of packed structs
Fix all instances in the controller of -Waddress-of-packed-member by
casting through an intermediate variable and verifying the alignment
with an assertion.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-12-10 14:08:59 +01:00
Carles Cufi 944a02d18a include: Add a macro to check pointer alignment
Add a new macro, IS_PTR_ALIGNED() that verifies if a pointer is aligned
sufficiently for a particular data type provided as an argument.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2021-12-10 14:08:59 +01:00
Carles Cufi cf111962e0 gcc: Enable address-of-packed-member warnings
After having resolved all of the instances of packed member access,
re-enable the warning.

Fixes #16587.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2021-12-10 14:08:59 +01:00
Flavio Ceolin f3718ed701 tests: pm: s/power/pm tag
Use tag "pm" in power management tests.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-12-10 07:43:01 -05:00
Flavio Ceolin a0f58aa7c9 tests: pm: power_mgmt: Fix testcase name
Fix test case name.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-12-10 07:43:01 -05:00
Flavio Ceolin c4918050f6 tests: pm: Add multicore test
A simple test respects per cpu power states.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-12-10 07:43:01 -05:00
Johann Fischer 5e07fabe0c doc: devicetree: add "zephyr,display" to chosen nodes table
Add "zephyr,display" to Zephyr-specific chosen nodes table.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-12-10 12:47:30 +01:00