Commit graph

279 commits

Author SHA1 Message Date
Alberto Escolar Piedras
9fc1ca7997 nrf52_bsim: Expand some bs_tests hooks descriptions
Expand the descriptions of some bs_tests hooks

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2022-12-14 16:34:55 +01:00
Alberto Escolar Piedras
fb95defce3 nrf52_bsim: Add option to delay CPU and test initialization
In some simulated test cases, it can be usefull
to delay the boot of the CPU and the test initialization
for a while. Namely by the offset of the device
relative to other simulated devices.

We add the option to select so from command line.
By default the option is disabled so this change is
backwards compatible.

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2022-12-14 16:34:55 +01:00
Anas Nashif
dae4720703 boards: native: mark as simulator
Mark native_posix platform as a simulator.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-11-25 06:09:02 -05:00
Elvar Tresnak
53666831d5 doc: POSIX arch: Add link to POSIX OS abstraction
In the note about the relationship between the POSIX arch
and the POSIX OS abstraction, add a link.

Signed-off-by: Elvar Tresnak <Elvar.Tresnak@gmail.com>
2022-11-05 08:41:24 +01:00
Alberto Escolar Piedras
3a8749e430 doc: posix boards: Add much more content
Added much more content describing the posix boards
specially the nrf52_bsim.

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2022-10-28 15:05:01 +02:00
Alberto Escolar Piedras
a3b0df6666 doc: posix arch: Refactor arch docs into own page
Refactor the POSIX arch documentation out of the
native_posix page into its own page.
Originally native_posix was the only POSIX arch based
board, but this has not been the case anymore for several
years.
The architecture part of the documentation being in the
native_posix doc has created uneeded confusion over time.
Both due to this, and as preparation for much more
documentation for the bsim boards, refactor it out.

This is mostly a refactoring exercise, with only very
minor changes in the text to keep it consistant with
the move.

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2022-10-28 15:05:01 +02:00
Pieter De Gendt
1b40a17a38 boards: posix: native_posix: Handle SDL events in zephyr thread
This commit introduces a zephyr thread for SDL events. This allows
to use zephyr mutex locking with SDL callbacks.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2022-10-05 13:11:15 +02:00
Martin Jäger
9cec058e8e boards: posix: native_posix: enable can_loopback0 by default
The .yaml file states that CAN is supported, but the basic sample
application samples/drivers/can/counter cannot be compiled without
additional configuration.

The loopback driver does not require any additional steps like the
linux SocketCAN driver, so it is safe to enable it by default and
get rid of the many overlay files in the tests.

ISO-TP tests and the counter sample are excluded via .yaml from
twister tests because of timing issues.

Signed-off-by: Martin Jäger <martin@libre.solar>
2022-10-03 10:17:12 +02:00
Martin Jäger
77e4c6515a drivers: can: native_posix_linux: initial implementation
This driver provides an interface to SocketCAN interfaces of the Linux
system running a Zephyr application with the native_posix board. These
interfaces may be virtual or actual CAN buses.

Signed-off-by: Martin Jäger <martin@libre.solar>
2022-09-09 10:08:59 +02:00
Alberto Escolar Piedras
fa9dd89a3a nrf52_bsim: Add support for level interrupt
Change in the MCU/interrupt handler model
which enables using the new nrf52 HW models irq controller
level interrupts.

Note that this change requires the updated HW models which
provide the new level based interrupts API.

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2022-08-31 21:53:23 +00:00
Andy Ross
65d657685e arch/posix: Add libfuzzer support
Add support for LLVM's libfuzzer utility.  This works by building an
executable with a "LLVMFuzzerTestOneInput()" entry point (which is
external to Zephyr, running in the host process environment!), which
it drives out of its own main() routine.  The toolchain API is exposed
as just another sanitizer variant, which is clean.

Signed-off-by: Andy Ross <andyross@google.com>
2022-08-26 11:57:46 +02:00
Andy Ross
bb950b2d63 boards/native_posix: Unwrap main loop to expose external event API
Some applications of native_posix (libfuzzer in particular) want to
drive the native_posix environment from "outside" as a caller.

Unwrap the hwm_main_loop() utility into a callable hwm_one_event()
function instead, and move the loop into the main() function instead.
Likewise split out the initialization path into a API-visible
posix_init() function.

Finally adds a posix_exec_for() entry point which iterates over the
event interface for a given timeout.

Signed-off-by: Andy Ross <andyross@google.com>
2022-08-26 11:57:46 +02:00
Kumar Gala
5ac8fca9cb kscan: Introduce zephyr,keyboard-scan chosen prop
Introduce zephyr,keyboard-scan chosen node property to point to the
node that implements the default KSCAN device.  This is similar to
the zephyr,display property.

We switch over the samples to utilize the new property instead of
kscan0 alias.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-12 17:54:03 -05:00
Kumar Gala
01c4e02240 kscan: sdl: Convert driver over to devicetree
Move kscan SDL driver to be based on devicetree.  This is similar to
how the display SDL driver works.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-12 17:54:03 -05:00
Kumar Gala
6124ccfccf drivers: ethernet: provide Kconfig means to disable ethernet drivers
There are several test cases that create fake ethernet devices and
expect the fake device to be the only ethernet device enabled.  Some
tests handle this be explicitly disabling actual ethernet drivers,
but this doesn't scale well.

Change drivers/ethernet/Kconfig to utilze a menuconfig option that
wraps all the drivers.  This allows us for those test cases that
don't want any actual ethernet drivers to disable them with a
simple CONFIG_ETH_DRIVER=n.

Note, the fake ethernet devices utilize CONFIG_ETH_INIT_PRIORITY so
we have it outside of the 'if ETH_DRIVER' block.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-12 11:33:43 +02:00
Kumar Gala
f2fa572561 entropy: remove Kconfig.defconfig* setting of entropy drivers
Now that entropy drivers are enabled based on devicetree
we need to remove any cases of them getting enabled by
Kconfig.defconfig* files as this can lead to errors.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-09 23:37:33 -05:00
Kumar Gala
63769bd1c1 drivers: display: Remove unnecessary Kconfig settings
Have the display enabled in devicetree will now get the driver
enabled by default when CONFIG_DISPLAY=y is set.  So we can remove
setting driver enabling Kconfig values in various .conf and
defconfig files.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-09 12:27:44 +02:00
Kumar Gala
adbf3d9245 boards: native_posix: Remove label property from devicetree
The label property isn't needed in devicetree so remove it.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-04 13:47:22 +02:00
Kumar Gala
5c57a36f9d i2c: remove Kconfig.defconfig setting of I2C drivers
Now that I2C drivers are enabled based on devicetree
we need to remove any cases of them getting enabled by
Kconfig.defconfig* files as this can lead to errors.

Typically the Kconfig.defconfig* will blindly enable a
sensor and not respect the devicetree state of the I2C.
Additionally we can get problems with prj.conf/defconfig
getting incorrectly overridden.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-01 18:01:44 +02:00
Kumar Gala
9a501e0922 serial: remove Kconfig.defconfig setting of serial drivers
Now that serial drivers are enabled based on devicetree
we need to remove any cases of them getting enabled by
Kconfig.defconfig* files as this can lead to errors.

Typically the Kconfig.defconfig* will blindly enable a
sensor and not respect the devicetree state of the serial.
Additionally we can get problems with prj.conf/defconfig
getting incorrectly overridden.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-26 09:29:24 -05:00
Simon Hein
93dfc69a3a boards: comply to coding guidelines MISRA C:2012 Rule 14.4
MISRA C:2012 Rule 14.4 (The controlling expression of an if statement
and the controlling expression of an iteration-statement shall have
essentially Boolean type.)

Use `do { ... } while (false)' instead of `do { ... } while (0)'.

This commit is a subset of the original commit:
5d02614e34a86b549c7707d3d9f0984bc3a5f22a

Signed-off-by: Simon Hein <SHein@baumer.com>
2022-07-21 10:31:00 +02:00
Henrik Brix Andersen
3ba47f94d1 boards: posix: native_posix: list CAN-FD as a supported feature
List CAN-FD as supported by the native_posix and native_posix_64 boards to
reflect the recent addition of CAN-FD loopback support.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-07-18 18:43:36 +02:00
Rubin Gerritsen
8619e0300a boards: nrf52_bsim: Replace irq name table with function call
The interrupt names are now defined in the HW models.
As a result, all source files in the nrf52_bsim folder are now
free of nrf52832 specific references. Therefore these can in
theory be used for other models as well.

Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
2022-06-23 14:35:26 +02:00
Rubin Gerritsen
4a26f54b30 boards: nrf52_bsim: Remove useless include of irq_sources.h
This file defines IRQ numbers that are already defined in the MDK
headers, so there is no need of including it.

This will later allow us to remove it from the HW models.

Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
2022-06-05 14:48:26 +02:00
Fabio Baltieri
e24314f10f include: add more missing zephyr/ prefixes
Adds few missing zephyr/ prefixes to leftover #include statements that
either got added recently or were using double quote format.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2022-05-27 15:20:27 -07:00
Fabio Baltieri
67a0f95aed dts: fix a bunch of odd partition values dts entries
Fix various board fixed-partition definitions where the devicetree cell
has been defined oddly, such as 9 nibbles (which makes no sense since
the cells are 32 bit) or 7 nibbles where all the others are 8.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2022-05-25 14:21:04 +02:00
Gerard Marull-Paretas
db508379c2 boards: migrate includes to <zephyr/...>
In order to bring consistency in-tree, migrate all boards code to the
new prefix <zephyr/...>. Note that the conversion has been scripted,
refer to zephyrproject-rtos#45388 for more details.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-05-06 19:57:15 +02:00
Andrzej Głąbek
586e26e8fc soc: nrf: Use data from DTS to populate HAS_HW_NRF_* Kconfig options
Instead of selecting appropriate HAS_HW_NRF_* options for particular
nRF SoCs (and simulated nRF52 target), set their values basing on
information from devicetree.
Correct also semantics of those options so that they are set only when
a corresponding DT node is enabled. This allows using them directly in
Kconfig dependencies of Zephyr drivers for nRF peripherals. Update
appropriately these dependencies.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-04-02 15:14:38 +02:00
Andrzej Głąbek
b4b2b2ef98 boards: nrf52: Suppress DTC warnings about duplicate unit-address
Prevent "unique_unit_address_if_enabled" warnings from being reported
for nRF52 Series SoCs, where certain nodes need to be enabled with
the same base addresses. These can be (depending on a given SoC):
- power@40000000 & clock@40000000
- power@40000000 & clock@40000000 & bprot@40000000
- acl@4001e000 & flash-controller@4001e000

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-04-02 15:14:38 +02:00
Nazar Kazakov
f483b1bc4c everywhere: fix typos
Fix a lot of typos

Signed-off-by: Nazar Kazakov <nazar.kazakov.work@gmail.com>
2022-03-18 13:24:08 -04:00
Nazar Kazakov
9713f0d47c everywhere: fix typos
Fix a lot of typos

Signed-off-by: Nazar Kazakov <nazar.kazakov.work@gmail.com>
2022-03-14 20:22:24 -04:00
Krzysztof Chruscinski
54ca1b36d7 boards: posix: Cleanup backend config for native_posix and nrf52_bsim
Removing backend config from board Kconfig.defconfig and moving
it to native_posix backend configuration in logging. Without this
change define persisted even when logging was not using backends
and that impacted what is compiled in.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-03-14 14:08:49 -04:00
Gerard Marull-Paretas
260deccb6e doc: use :kconfig:option: domain role
Kconfig options now belong to the Kconfig domain, therefore, the
:kconfig:option: role needs to be used.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-03-02 09:28:37 +01:00
Henrik Brix Andersen
8a8bc392dc board: posix: native_posix: list CAN as a supported feature
List CAN as a supported feature on native_posix/native_posix_64.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-02-24 07:12:54 -06:00
Krzysztof Chruscinski
262cc55609 logging: Deprecate v1, default to v2
Reduced logging mode selection to deferred, immediate, minimal and
frontend. Decoupled logging version from mode and created CONFIG_LOG1
which can be used to explicitly select deprecated version.

From now on, chosing CONFIG_LOG_MODE_{IMMEDIATE,DEFERRED} will result
in version2.

Deprecated CONFIG_LOG2_MODE_{IMMEDIATE,DEFERRED} with cmake warning.

Codebase adapted to those changes.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-01-17 15:49:10 -05:00
Daniel Leung
7f794db27b posix: remove @return doc for void functions
For functions returning nothing, there is no need to document
with @return, as Doxgen complains about "documented empty
return type of ...".

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2022-01-12 16:02:16 -05:00
Gerard Marull-Paretas
23a54cb06b boards: posix: native_posix: add cpus and cpu0 nodes
Define the cpus node and the first cpu. The cpus node can be used when
testing, e.g. power states.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-11 10:46:20 +01:00
Henrik Brix Andersen
ab599fe767 boards: posix: native_posix: add CAN loopback device
Add emulated CAN loopback device. The device is disabled by default
since a loopback-only device is not suitable for all use cases/test
cases.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-01-04 15:13:40 -06:00
Jedrzej Ciupis
304c42c39c boards: posix: nrf52_bsim: provide missing CMSIS functions
This commit provides missing CMSIS functions for nRF52 babblesim board.

Signed-off-by: Jedrzej Ciupis <jedrzej.ciupis@nordicsemi.no>
2021-12-21 17:00:51 +01:00
Johann Fischer
dee50e9aae drivers: display_sdl: rework to obtain configuration from devicetree
Add bindings for SDL based display controller.
Rework SDL based display controller driver to obtain
configuration from devicetree. Remove unnecessary casts,
add multi-instance support.

Add display controller node and chosen property
to native_posix devicetree.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-12-10 12:47:30 +01:00
Jeremy Bettis
77550d05a3 native_posix: Add gpio to supported list
Add gpio to supported list in native_posix boards so that the gpio tests
with the gpio_emul will run in twister.

Signed-off-by: Jeremy Bettis <jbettis@google.com>
2021-11-25 10:36:25 -05:00
Ryan McClelland
a612fbd1dc boards: posix: fix double promotion warnings
With -Wdouble-promotion added to the warning base, posix gives warnings
when compiled with this on. Cast the constants to long doubles, and the
print %f variable to a double.

Signed-off-by: Ryan McClelland <ryanmcclelland@fb.com>
2021-11-24 17:14:25 -05:00
Filip Kokosinski
94428044e2 cmake: support multiple entries in board.cmake
Currently there is no way to support running a board on multiple
emulation platforms nor to choose a desired emulation platform for the
simulation to be run on. This commit introduces a new
SUPPORTED_EMU_PLATFORMS list, which defines available emulation
platforms for a given board.

Fixes #12375.

Signed-off-by: Filip Kokosinski <fkokosinski@antmicro.com>
2021-11-12 21:33:42 -05:00
Maciej Perkowski
edb23d7bd8 twister: native_posix: Ignor filtering by toolchain for native_posix
In the case of native_posix (and other "host" toolchain based
platforms) Twister shouldn't filter tests by ZEPHYR_TOOLCHAIN_VARIANT.
The PR replaces `- zephyr` with `- host` in native_posix(_64).yaml
and modify the filter in twisterlib.py to not block building
if "host" is under the platform supported toolchains.

Fixes: #38418

Signed-off-by: Maciej Perkowski <Maciej.Perkowski@nordicsemi.no>
2021-09-10 11:24:58 -04:00
Alberto Escolar Piedras
9249609071 boards: bsim: fix bug with single settings file for few bsim devices
Reapply the part of 4b5cd92312
that added new functionality/fixed the actual issues described
in the original commit message withtout the further cleanup.

There was also some cross-commit content from
2b91ebe16e
as part of the cleanup in test_friendship.c which is also included.
+ added cleanup also to test_provision.c on request from Aleksandr.

Original commit msg:
-----------
Multiple bsim devices cannot store individual settings
with the existing settings backend for bsim.

Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
-----------

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2021-08-24 12:37:51 +02:00
Alberto Escolar Piedras
26d7d7c8c8 Revert "boards: bsim: fix bug with single settings file for few bsim devices"
This reverts commit 4b5cd92312.

global_device_nbr is used by many bsim tests.
And many of those are now off tree in preparation of the LE-Audio
work. Removing this for cleanliness now is not nice on others.
=> Revert

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2021-08-24 12:37:51 +02:00
Aleksandr Khromykh
4b5cd92312 boards: bsim: fix bug with single settings file for few bsim devices
Multiple bsim devices cannot store individual settings
with the existing settings backend for bsim.

Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
2021-08-23 18:55:53 -04:00
Johann Fischer
5ee0f6bd8e boards: native_posix: add USB device controller binding and node
Current USB device controller drivers (drivers/usb/device)
do not use DEVICE_DT_GET but the properties from devicetree,
and USB device controller node is parent for CDC ACM UART and
AUDIO children nodes.

Add USB device controller binding and node to keep the samples
building for native_posix driver.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-08-23 18:53:47 -04:00
Martí Bolívar
5726783d85 boards: native_posix: provide i2c device if CONFIG_I2C=y
This is necessary to get some samples to link properly when moving
from device_get_binding() to DEVICE_DT_GET and friends. In particular
I ran into issues building i2c_fujitsu_fram without a real I2C device.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-08-19 17:20:21 -04:00
Stephanos Ioannidis
b18d995178 boards: posix: native_posix: Add memory sizes for twister
This commit adds the missing flash and RAM size properties for
native_posix and native_posix_64 so that the integration tests that
require large memory can run on this board.

Note that the flash and RAM sizes of 64MiB specified here is an
arbitrary value choosen to ensure that all currently supported tests
can run, since there is no inherent limit for the POSIX boards.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2021-08-17 16:41:55 -05:00