Commit Graph

68630 Commits

Author SHA1 Message Date
Martí Bolívar 2bc25deb07 Kconfig: fix "flag LEGACY_INCLUDE_PATH as deprecated"
Commit cd7c44a152
("Kconfig: flag LEGACY_INCLUDE_PATH as deprecated") forgot to select
DEPRECATED when deprecating a Kconfig option. Fix it.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2022-08-19 08:13:32 +00:00
Torsten Rasmussen f249f278bf west: warn that using runner args on multiple domains is experimental
The introduction of sysbuild and west build / flash / debug / etc.
support raises questions regarding how to handle user specified runner
arguments.

Some arguments may be acceptable for all domains, whereas others are
only valid for a single or few domains in a multi domain build.

Therefore, consider the usages of runner specific options experimental
when applied to multiple domains.

The following warning is printed to the user when using runner specific
arguments on multiple domains:
> WARNING: Specifying runner options for multiple domains is
> experimental.
> If problems are experienced, please specify a single domain using
> '--domain <domain>'

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2022-08-19 09:21:38 +02:00
Andy Ross 02b23f3733 arch/posix: Add MemorySanitizer support
Wire this up the same way ASAN works.  Right now it's support only by
recent clang versions (not gcc), and only in 64 bit mode.  But it's
capable of detecting uninitialized data reads, which ASAN is not.

This support is wired into the sys_heap (and thus k_heap/k_malloc)
layers, allowing detection of heap misuse like use-after-free.  Note
that there is one false negative lurking: due to complexity, in the
case where a sys_heap_realloc() call is able to shrink memory in
place, the now-unused suffix is not marked uninitialized immediately,
making it impossible to detect use-after-free of those particular
bytes.  But the system will recover cleanly the next time the memory
gets allocated.

Also no attempt was made to integrate this handling into the newlib or
picolibc allocators, though that should hopefully be possible via
similar means.

Signed-off-by: Andy Ross <andyross@google.com>
2022-08-19 08:30:01 +02:00
Andy Ross 74cc534758 cmake: Update CONFIG_ASAN support
This had bitrotten a bit, and didn't build as shipped.  Current
libasan implementations want -fsanitize=address passed as a linker
argument too.  We have grown a "lld" linker variant that needs the
same cmake treatment as the "ld" binutils one, but never got it.  But
the various flags had been cut/pasted around to different places, with
slightly different forms.  That's really sort of a mess, as sanitizer
support was only ever support with host toolchains for native_posix
(and AFAICT no one anywhere has made this work on cross compilers in
an embedded environment).  And the separate "gcc" vs. "llvm" layers
were silly, as there has only ever been one API for this feature (from
LLVM, then picked up compatibly by gcc).

Pull this stuff out and just do it in one place in the posix arch for
simplicity.

Also recent sanitizers are trying to add instrumentation padding
around data that we use linker trickery to pack tightly
(c.f. SYS_INIT, STRUCT_SECTION_ITERABLE) and we need a way
("__noasan") to turn that off.  Actually for gcc, it was enough to
just make the records const (already true for most of them, except a
native_posix init struct), but clang apparently isn't smart enough.

Finally, add an ASAN_RECOVER kconfig that enables the use of
"halt_on_error=0" in $ASAN_OPTIONS, which continues execution past the
first error.

Signed-off-by: Andy Ross <andyross@google.com>
2022-08-19 08:30:01 +02:00
Andy Ross d6297988be cmake/llvm: Improve tool detection
On Debian, llvm-obj{copy,dump} tools are installed with a version
suffix.  Look first for a version that matches our compiler when
probing for tool paths before trying the bare version, or falling back
to GNU binutils.

Signed-off-by: Andy Ross <andyross@google.com>
2022-08-19 08:30:01 +02:00
Andy Ross 5722da71ce kernel: Skip bss clear on native_posix
There's no point to doing this when the host OS clears all memory at
mapping time.  And as it turns out, the __bss_end symbol it was
relying on actually comes from the host toolchain's linker, not our
own linker scripts (making it semi-dangerous to rely on).  And it's
not present in clang/lld output anyway.

Signed-off-by: Andy Ross <andyross@google.com>
2022-08-19 08:30:01 +02:00
Kevin Townsend 0e560bf8e9 doc: build: dts: Remove refs to label property
Removes references to the label property in devicetree, replacing
them with node label where appropriate.

Signed-off-by: Kevin Townsend <kevin.townsend@linaro.org>
2022-08-18 19:50:39 -05:00
Gerard Marull-Paretas 8588fdc7b3 dts: bindings: gpio-leds: move to led folder
The gpio-leds binding is meant for LED drivers, not GPIO. As in Linux,
move the binding to the led folder.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-18 17:13:17 -07:00
Gerard Marull-Paretas 8adec7d879 dts: bindings: gpio-keys: align with Linux
gpio-keys binding has been used in Zephyr to describe random push
buttons in boards. On Linux, it is used by a keyboard input driver,
while in Zephyr is, in most cases, used directly in applications out of
the device driver model. This should likely be _fixed_ if one day we
have a proper input device class. Still, we can align a few things:

- Inherit from base.yaml (we need status, compatible, etc defined there)
- Remove the requirement of a label in child nodes
- Fix child nodes label description
- Move to dts/bindings/input

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-18 17:13:17 -07:00
Kumar Gala 9b5c653b3f dts: bindings: test: Add explicit label property
Don't import the label prop from base.yaml as it is marked deprecated.
This lets the various tests that still use DT_LABEL() to work properly.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-18 15:19:40 -07:00
Kumar Gala c527c063c6 dts: bindings: deprecated label property
Mark 'label' property as deprecated in base.yaml.  'label' is still
defined and valid for specific bindings to specify like gpio-keys.yaml
or fixed-partitions.yaml.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-18 15:19:40 -07:00
Kumar Gala b62757210a tests: sensor: sbs_gauge: Remove label property
The label property isn't needed so remove it.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-18 15:19:40 -07:00
Henrik Brix Andersen 590cd5cb72 drivers: can: rename can_state enumerations
Rename the can_state enumerations to contain the word STATE to make their
meaning more clear:
- CAN_ERROR_ACTIVE  => CAN_STATE_ERROR_ACTIVE
- CAN_ERROR_WARNING => CAN_STATE_ERROR_WARNING
- CAN_ERROR_PASSIVE => CAN_STATE_ERROR_PASSIVE
- CAN_BUS_OFF       => CAN_STATE_BUS_OFF

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-08-18 21:41:11 +00:00
Szymon Czapracki aa7533380c Bluetooth: audio: Add missing 'or' in service declaration
Fix missing or symbol in service declaration

Signed-off-by: Szymon Czapracki <szymon.czapracki@codecoup.pl>
2022-08-18 21:40:23 +00:00
Henrik Brix Andersen 7e3814b262 drivers: can: expand return values reported by the CAN timing functions
Expand the error return values reported by the CAN timing calculation
functions to be able to distinguish between an an out of range
bitrate/sample point, an unsupported bitrate, and a resulting sample point
outside the guard limit.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-08-18 21:39:16 +00:00
Henrik Brix Andersen 2b99b05d0a drivers: can: move bitrate limit checks to arbitration/data functions
Move the check for the maximum allowed CAN bitrate to the corresponding
can_calc_timing()/can_calc_timing_data() function.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-08-18 21:39:16 +00:00
Hu Zhenyu 424668f5a7 tests: mec15xxevb_assy6853: Enlarge the IDLE_STACK_SIZE from 256 to 512
The test case "samples/boards/mec15xxevb_assy6853/power_management" could
always pass until commit 5f60164 was merged in. This patch changes the sem
take timeout value from 50ms to forever of the log thread, it will make the
idle thread run longer and takes more stack memory. Analyzed the coredump
of the failed test case, it can be found that the test case stucks at
z_idle_stacks. The test case used default CONFIG_IDLE_STACK_SIZE = 256 in
kernel/Kconfig, now we increase the value to 512 in prj.conf for this test
only. With this change, the test case can pass with the commit of 5f60164.
Fixes #47987

Signed-off-by: Hu Zhenyu <zhenyu.hu@intel.com>
2022-08-18 21:38:56 +00:00
Torsten Rasmussen 1a119b4121 tests: use CONFIG_ZTEST_NEW_API=y for bluetooth/controller/ctrl_cte_req
The bluetooth/controller/ctrl_cte_req wrongly defaulted to old Ztest API
after the introduction of the new unit_testing board.

Enforce use of CONFIG_ZTEST_NEW_API to get test working again.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2022-08-19 05:15:07 +09:00
Andrzej Głąbek ec1ae253aa drivers: i2c_tca954x: Fix transfer function
This is a follow-up to commit e1c0a494b3.

The `tca954x_transfer()` function cannot call `i2c_transfer_dt()`,
because the I2C device address used in the transaction must be the one
passed as the `addr` parameter, not the address of the TCA954xA switch
itself. Hence, this commit restores the call to `i2c_transfer()`.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-08-18 15:14:16 -05:00
Steven Slupsky fe716dbb09 pm: stats: fix typo
There is a typo in argument for the STATS_NAME_INIT_PARMS macro.
This causes an error during build.
The correct reference should be "pm_stats".

Signed-off-by: Steven Slupsky <sslupsky@gmail.com>
2022-08-18 15:13:47 -05:00
Tom Burdick efc0928570 dma/hda: Use the correct register block size for each IP block
Previous versions were using, incorrectly, the host in/out regblock size
of 40 bytes for all peripherals when in fact the link in/out regblock size
is 20 bytes in size.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2022-08-18 14:54:57 -05:00
Stephanos Ioannidis e918783af1 lib: libc: minimal: Define off_t as intptr_t
The `off_t` type, which is specified by the POSIX standard as a signed
integer type representing file sizes, was defined as `long` or `int`
depending on the target architecture without a clear explanation on why
it was defined as such.

While the POSIX standard does not specify the size requirement of the
`off_t` type, it generally corresponds to the size of a pointer in
practice, mainly because the optimal file handling size is closely tied
to the native pointer size.

For this reason, this commit removes the per-architecture `off_t`
definition and defines it as `intptr_t` such that its size always
matches the native pointer size.

Note that the toolchain-defined `__INTPTR_TYPE__` macro is used instead
of the `intptr_t` typedef as per the common convention used in the C
standard library headers.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2022-08-19 02:47:50 +09:00
Carles Cufi 0b3564e36d blobs: Document the command and the module integration
Extend the existing documentation by documenting the command itself and
the format of the module.yml blobs section.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2022-08-18 15:25:43 +00:00
Carles Cufi 0424509d6e west: blobs: Ensure that folder exists before fetching
The `<module>/zephyr/blobs/` folder, as well as any additional
sub-folders that might be required under `blobs/` may not exist when
fetching a blob. Ensure that the folder exists, create it if it doesn't.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2022-08-18 15:25:43 +00:00
Carles Cufi 5524f7a950 west: blobs: Add a clean sub-command
The new "clean" blobs sub-command deletes any blobs present on the
filesystem.

Also improve the help text for sub-commands.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2022-08-18 15:25:43 +00:00
Carles Cufi 02c95c64fe west: blobs: Rework the -m option
To align with other commands, such as "west update", convert the
accumulative -m option into an nargs="*"-type one that takes the list of
modules directly without a flag.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2022-08-18 15:25:43 +00:00
Carles Cufi 389af0885c west: blobs: Default to listing and fetching all blobs
Instead of both listing and fetching only the blobs in the
modules listed by the user in the command-line, default to
listing/fetching them all for ease-of-use and consistency with other
commands. Remove the --all options since it's meaningless now.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2022-08-18 15:25:43 +00:00
Daniel Leung fd8ffdb833 boards: qemu_x86_tiny: enable support for coverage
This adds the bits so that we can use qemu_x86_tiny for
coverage, as this is currently the only board that can do
demand paging.

This uses the board revision as a way to specify the RAM
size as coverage requires more memory available to store
the coverage data. By piggybacking onto board revision,
this avoids adding another board config just for coverage.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-08-18 17:23:18 +02:00
Daniel Leung ee40548788 samples: condvar: extra stack space for custom threads
When coverage is enabled, some boards require more stack space
for the custom threads created in main(). Since this "samples"
already has CONFIG_TEST enabled, we can pad the stack size
with CONFIG_TEST_EXTRA_STACK_SIZE.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-08-18 17:23:18 +02:00
Daniel Leung c9955cf861 testsuite: coverage: pin gcov sections for demand paging
This adds the bits to pin the GCOV sections to the pinned
sections so they can be accessed during boot when demand
paging is enabled. Or else accessing them would result in
page faults.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-08-18 17:23:18 +02:00
Daniel Leung 1ace8efb8a cmake: extend linker snippets for pinned sections
This extends the linker snippet code to cover pinned
sections.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-08-18 17:23:18 +02:00
Daniel Leung ade3394f11 testsuite: coverage: align rodata section
This adds an ALIGN statement to the rodata linker snippet
for coverage. Without this, sometimes the section is not
aligned, but __init_array_start indicates an aligned
address, resulting in incorrect function pointers.
So align it.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-08-18 17:23:18 +02:00
Daniel Leung 835680f0e7 twister: enhance support for board@revision as platform name
This adds an extra layer to match the revision part where this
needs to be of permitted patterns as described in.
cmake/modules/extensions.cmake. Without this, the matching
may produce undesirable results. For example, if there is
a file named qemu_x86_tiny_1.conf, the testplan will create
a board name qemu_x86@tiny.1 (which is definitely not correct).

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-08-18 17:23:18 +02:00
li biao c2c467a6ff tests: lib: move ringbuffer to new ztest API
Move test ringbuffer to use new ztest API.

Signed-off-by: li biao <biao1x.li@intel.com>
2022-08-18 16:08:44 +02:00
Andrzej Głąbek ca4d8cf4ab drivers: sensor: mpu9250: Fix initialization routine
Fix a call that writes Register 29 - Accelerometer Configuration 2.
Due to an obvious copy-paste mistake in the code, this register was
written with a DLPF setting from devicetree intended for gyroscope,
not for accelerometer (and the latter was effectively ignored).

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-08-18 16:08:23 +02:00
Andriy Gelman f4dc5ac565 linker: Use a different macro to set vma for the noinit section
The two macros are the same in this context. But an SoC may
redefine the GROUP_LINK_IN() macro which could introduce an
unintended change in this part of the linker script.

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2022-08-18 16:05:49 +02:00
Andriy Gelman 4e90efa79f linker: set __rom_region_end via an offset from __rom_region_start
Currently __rom_region_end points to the virtual memory address, while
__rom_region_start points to the load memory address. In most cases the
two address spaces will be the same. In the case of the infineon xmc4xxx
series they can be different because flash can be read via a different
cachable address space.

Evaluate __rom_region_end as an offset from __rom_region_start to fix this
possible issue.

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2022-08-18 16:05:49 +02:00
Andriy Gelman 8d5acea57b linker: make sure the macro arguments both point to the vma
If the rom region can be accessed via a virtual memory address,
then __rodata_region_end will point to the vma, while __rom_region_start
is the lma. This patch makes sure the two values are in the vma address
space.

This is in prepartion for a future patch which will allow the rom to be
accessed via a virtual memory address.

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2022-08-18 16:05:49 +02:00
Andriy Gelman 671cfa5488 linker: align the lma to 4 bytes
This is needed when the flash can be accessed via a different vma
address as in the case of the infineon xmc4xxx series where 0xc000000
is the uncached start address and 0x8000000 is the cached start address.

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2022-08-18 16:05:49 +02:00
Torsten Rasmussen 3217d97375 tests: update unit/cbprintf test to use Kconfig
This commit removes CONFIG defines from main.c and instead uses the
proper Kconfig handling of specifying extra Kconfig options in
testcase.yaml.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2022-08-18 14:29:14 +02:00
Torsten Rasmussen c23be568fb tests: add Kconfig file to bluetooth ctrl_data_length_update testcases
With Kconfig support in unittest the bluetooth ctrl_data_length_update
test fails because the symbols being configured are promptless or
disabled because of dependencies.

Add a Kconfig file to make needed symbols visible in unittest mode.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2022-08-18 14:29:14 +02:00
Torsten Rasmussen c3fa8b84a3 tests: adopt ztest base test to extended unittest module
With the support of Kconfig in unittest CMake module then prj.conf is
now supported.

Add a prj.conf with ZTEST config settings and remove hardcoded values
from CMakeLists.txt file.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2022-08-18 14:29:14 +02:00
Torsten Rasmussen 0f15d89a26 tests: remove testing for board unit_testing
Remove boilerplate code:
> if (NOT BOARD STREQUAL unit_testing)
>    message(FATAL_ERROR "This project can only be used with...")
> endif()

as that is now handled by boards.cmake when validating the board.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2022-08-18 14:29:14 +02:00
Torsten Rasmussen 7a65bdbd64 cmake: kconfig: introduce dedicated unit testing board
This commit introduces a dedicated unit testing board.

Today, a dedicated Zephyr unit testing scheme exists but is different
from how a Zephyr build generally works.

For example Kconfig is not possible, resulting on various different
hacks to pass Kconfig settings from test cases / testcase.yaml through
CMake to the code.
Some directly as compile definitions, some as header files with forced
inclusion on sources, some with wrapper flags which again results in
different define being enabled. There is even cases where a second
forced header inclusion undefines previous defines.

Unit test often does a manual check for the right boards, like this:
> if (NOT BOARD STREQUAL unit_testing)
>    message(FATAL_ERROR "This project can only be used with...")
> endif()

Introducing a dedicated unit_testing board under `tests/root` allows
us to use Kconfig in unit test samples, and thus proper `prj.conf` and
extra Kconfig fragments.
Generation of autoconf.h so the overall architecture follows regular
Zephyr builds.

Proper and uniform error messages when invalid board is selected.

The unit_testing board and arch is located under: `subsys/testsuite` so
that it is only available when find_package(Zephyr COMPONENTS unittest)
is used, and not available for regular Zephyr builds.

Kconfig generates autoconf.h which is applied as compile flag to
test binary which means that kconfig defines placed in ztest.h can now
be removed.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2022-08-18 14:29:14 +02:00
Torsten Rasmussen 35263386f0 kconfig: change $(ARCH_DIR) to arch/
Changing $(ARCH_DIR)/common/Kconfig to arch/common/Kconfig.

The use of ARCH_DIR at this place is wrong, as it suddenly requires out
of tree archs to support a common/Kconfig file, which may make no sense
to them.

If an out of tree arch wants to place common Kconfig code in a common
Kconfig file, that's their choice and they should source such file
themselves.

Instead just source the Zephyr arch common file directly.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2022-08-18 14:29:14 +02:00
Torsten Rasmussen 9871a05a67 kconfig: optional sourcing of $(KCONFIG_BINARY_DIR)/Kconfig.modules
Change sourcing of generated Kconfig.module to be optional.

It should be possible to run parse the Zephyr Kconfig tree even if the
Kconfig.modules file has not been generated.

This can be useful in testing where you may wish to run without Zephyr
modules present, and thus not load the Zephyr module CMake module.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2022-08-18 14:29:14 +02:00
Torsten Rasmussen a450c663f2 cmake: define and create KCONFIG_BINARY_DIR if it doesn't exists
The Zephyr CMake module kconfig.cmake will create files inside
KCONFIG_BINARY_DIR.

In a default Zephyr build setup, this directory is created by Zephyr
CMake module zephyr_module.cmake. But Zephyr CMake modules are modular
and thus it must be possible to use kconfig module without
zephyr_module.

Thus kconfig.cmake must set and create KCONFIG_BINARY_DIR if it does not
already exists.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2022-08-18 14:29:14 +02:00
Torsten Rasmussen c3620c8a8e scripts: remove ZEPHYR_BASE as default root for board listing
Remove ZEPHYR_BASE as default root in list_boards.py.

This allows list_boards.py to be used to only print boards at given
root(s) without printing Zephyr default boards.

Secondly it remove the need in list_boards.py to have any knowledge of
ZEPHYR_BASE.

The `west boards` command already has ZEPHYR_BASE knowledge and can
easily add ZEPHYR_BASE to the list of roots it is already constructing,
thus removing the need for knowing that ZEPHYR_BASE is always added.

Update boards.cmake to pass ZEPHYR_BASE as an additional arch root, as
arch.cmake has not yet been processed,which means ZEPHYR_BASE is missing
in ARCH_ROOT list at this point in time.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2022-08-18 14:29:14 +02:00
Fabio Baltieri 8c55073d59 gpio: move gpio_cmsdk_ahb.h from drivers to include/drivers
Move gpio_cmsdk_ahb.h out of drivers/gpio and into include/drivers/gpio.
This is used by few board files so it should be in include.

This allows to remove few odd
"zephyr_library_include_directories(${ZEPHYR_BASE}/drivers)".

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2022-08-18 12:13:14 +00:00
Fabio Baltieri bf47c2a763 drivers: drop few unused pinmux.h include
Drop few unused include pinmux header from drivers that don't seem to be
using it anymore.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2022-08-18 12:13:14 +00:00