Commit graph

73 commits

Author SHA1 Message Date
Michał Szprejda 959ea1a172 resc: cmake: robot: Rename Renode variable
Rename Renode variable used to store the .elf file path from `bin` to
`elf` for consistency.

Signed-off-by: Michał Szprejda <mszprejda@antmicro.com>
2024-05-28 12:54:52 +02:00
Michał Szprejda 7bc9a98a70 Twister: Rework integration with renode-test
Initial integration with renode-test was introduced in commit bdf02ff,
which added support for calling the `renode-test` command from both west
and twister.

This commit removes the custom run_renode_test target used for running
Robot tests with the `west build` command and makes twister call
`renode-test` directly instead.

Signed-off-by: Michał Szprejda <mszprejda@antmicro.com>
2024-05-28 12:54:52 +02:00
Evgeniy Paltsev 47b334c619 ARC: nSIM: cmake: launch cores in direct order for simulation run
Align cmake launch script with west runners

Signed-off-by: Evgeniy Paltsev <PaltsevEvgeniy@gmail.com>
Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
2024-05-17 12:40:52 +02:00
Dmitrii Golovanov 5008c31f8c config: qemu: Add QEMU_EXTRA_FLAGS config option
Add QEMU_EXTRA_FLAGS as QEMU board config option.

This allows Twister tests to provide additional device setup
commands to QEMU in prj.conf or testcase.yaml configuration files.

Example use case: to setup TCP or UDP network interfaces
with non-conflicting port numbers in different test suites
to avoid conflicts when Twister run tests in parallel on the
same host.

Signed-off-by: Dmitrii Golovanov <dmitrii.golovanov@intel.com>
2023-10-20 15:03:55 +02:00
Alberto Escolar Piedras e11bc94a44 cmake run_native: Fix target dependency
The run_native (and therefore run) targets did not depend
on the proper thing for native_simulator based targets

Fix it.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-10-03 15:40:08 +01:00
Yong Cong Sin 9239599277 twister: add support for custom emulator in simulator
Enable the possibility for boards to implement a custom `run` target in
its board.cmake to run any arbitrary commands. This is helpful for devs
who would like to add support for proprietary simulator to their boards
that can't be upstreamed.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2023-08-02 17:35:26 +02:00
Michał Szprejda bdf02ff5d6 Twister: Add integration with renode-test
Add support for calling the `renode-test` command from west and twister.
Enable running Robot Framework tests suites in Renode.

Signed-off-by: Michał Szprejda <mszprejda@antmicro.com>
Signed-off-by: Mateusz Hołenko <mholenko@antmicro.com>
2023-05-26 09:43:49 -04:00
Evgeniy Paltsev 15b46039b8 ARC: used 64bit MDB binary by default.
This significantly improve user experience as 32 bit mdb binary
require to install multiple libraries before it can be used on
modern linux distros.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Evgeniy Paltsev <PaltsevEvgeniy@gmail.com>
2023-05-22 10:16:28 +02:00
Huifeng Zhang 9012223839 cmake: armfvp: enable SMSC_91C111 when it needed
Enable the SMSC_91C111 component for Arm FVP when
the 'CONFIG_ETH_SMSC91X' option is selected.

Signed-off-by: Huifeng Zhang <Huifeng.Zhang@arm.com>
2023-04-11 11:27:05 +02:00
Tomasz Bursztyka 7a8a5f4a30 cmake: Add Qemu NVMe emulated device
As it is meant to be used on the tests/drivers/disk test case, it will
currently create a dummy 1Mb image on a fixed path to serve as a NVMe
disk.

It could be made of an alternate path and size, if necessary.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2023-04-07 13:28:47 +02:00
Abe Levkoy c9190960a2 cmake: emu: qemu: Create pipe file before using
For run_qemu and qemu_debugserver, the targets that use QEMU_PIPE,
ensure that the QEMU_PIPE file exists before passing the path to QEMU as
an argument.

Signed-off-by: Abe Levkoy <alevkoy@google.com>
2023-04-04 13:35:03 +02:00
Alp Sayin a01877c6e0 cmake: emu: qemu: start QEMU gdbserver only if relevant Kconfig is set
This removes the enforced `-s` option and only passes in a `-gdb` only if
CONFIG_QEMU_GDBSERVER_LISTEN_DEV is set. When unset, it allows users to
utilize QEMU_EXTRA_FLAGS from environment preventing a clash that occurs
if `-s` and `-gdb` are both passed to QEMU invocation.

Signed-off-by: Alp Sayin <alpsayin@gmail.com>
2023-02-20 09:48:52 +01:00
Jan Malek 477b9af568 renode: Implement Renode script overlays
Add support for Renode script overlays allowing
to tune simulation parameters for selected samples/tests.

Signed-off-by: Jan Malek <jmalek@internships.antmicro.com>
Signed-off-by: Mateusz Holenko <mholenko@antmicro.com>
2023-01-25 14:02:29 -08:00
Ambroise Vincent 562069d4ed cmake: armfvp: allow for extra arguments
Taking example on the qemu cmake file.

Signed-off-by: Ambroise Vincent <ambroise.vincent@arm.com>
2022-12-29 10:12:33 +01:00
Henrik Brix Andersen b3b64e9ede cmake: emu: qemu: do not enable CAN bus on NIOS2 and LEON3
QEMU for NIOS2 and LEON3 do not provide support for the "can-bus" object
type. Skip configuring CAN bus command line arguments for these.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-11-02 22:10:05 +09:00
Henrik Brix Andersen abf82013ac drivers: can: add support for configuring CAN emulation in QEMU
Add support for configuring CAN emulation support in QEMU. For now, the
only supported CAN controller is the single-channel Kvaser PCIcan PCI card.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2022-11-01 15:22:31 -04:00
Daniel DeGrasse a13e5d0a2d cmake: emu: ensure that QEMU_PIPE is set when using sysbuild
Ensure that QEMU_PIPE variable is set when using sysbuild. This is required
because twister will use the "main" sysbuild application as the target for
"ninja run" when testing QEMU targets, which means that the "main" build
must be aware of any QEMU_PIPE setting passed by twister at build time.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-10-26 08:48:37 -04:00
Kumar Gala 2f031efea8 cmake: sim: Update simulator related cmake to use CONFIG_MP_MAX_NUM_CPUS
Update cmake related files that are used by simulators to use
CONFIG_MP_MAX_NUM_CPUS instead of CONFIG_MP_NUM_CPUS as we work to
phase out CONFIG_MP_NUM_CPUS.

Signed-off-by: Kumar Gala <kumar.gala@intel.com>
2022-10-19 16:01:10 +02:00
Huifeng Zhang dab22aac7a cmake: armfvp: permit run zephyr together with tf-a
As the TF-A was integrated into zephyr as a module. This adds necessary
CMake scripts to load BL1 and FIP binary built from TF-A.

Signed-off-by: Huifeng Zhang <Huifeng.Zhang@arm.com>
2022-09-09 16:36:37 +00:00
Jordan Yates 070422db46 arch: common: dedicated SEMIHOST symbol
Control the usage of semihosting with a dedicated symbol, instead of
implying semihosting from the usage of `SEMIHOST_CONSOLE`. This allows
semihosting to be used without the semihost console.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2022-04-21 13:04:52 +02:00
Jaxson Han 1a682680a7 cmake: armfvp: Improve the FVP version check
Print a warning message on 'west build -t run', if the FVP does not meet
the minimal requirement. The check acts as a reminder instead of an
entrance guard. So, the check won't stop executing the FVP program.

Signed-off-by: Jaxson Han <jaxson.han@arm.com>
2022-03-16 09:19:44 -05:00
Jaxson Han 3c1f3197e2 cmake: armfvp: Add FVP min version check
After the fix of FVP_BaseR_AEMv8R booting issue, the minimum required
version of FVP will be 11.16.16. Add an FVP minimal required version
check in building time.

When the ARMFVP_MIN_VERSION is set in board cmake file, the version
check will be enabled and print a warning.

Signed-off-by: Jaxson Han <jaxson.han@arm.com>
Change-Id: Ibbade0c328b5e91b8830fb35cba6917f08aabbda
2022-03-08 11:09:13 +01:00
Antony Pavlov 76769a42d0 soc: mips: add Qemu Malta support
The MIPS Malta is an ATX form factor evaluation board made by MIPS
Technologies. Malta board is the most popular platform for MIPS
full-system emulation.

See https://www.linux-mips.org/wiki/MIPS_Malta for details.

Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Signed-off-by: Remy Luisant <remy@luisant.ca>
2022-01-19 13:48:21 -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
Immo Birnbaum f4d41b1a6c cmake: boards: make QEMU icount sleep parameter configurable
When QEMU is running in icount mode, the behaviour regarding
the CPU being in sleep mode is configurable, with the default
value being set to 'off'. In this case, instruction counting
continues even when the CPU is sleeping or no target time is
set in the system timer. If the sleep parameter is set to
'on', instruction counting stops if the CPU is sleeping, and
the instruction count will fast-forward directly to the next
target time once it is being set.

In the Xilinx derivative of QEMU (which simulates ZynqMP and
Zynq-7000 SoCs), the default configuration causes QEMU to no
longer accept control commands via the console or remotely
whenever Zephyr enters and remains in idle mode.

Therefore, this commit makes the value of the sleep para-
meter of the icount functionality configurable, with the
default value remaining 'off'. The value can be changed at
board level alongside with the specification of the icount
shift value.

Signed-off-by: Immo Birnbaum <Immo.Birnbaum@Weidmueller.com>
2021-10-28 15:26:50 +02:00
Neil Armstrong 538968a773 boards: fvp_base_revc_2xaemv8a: permit running Zephyr at EL1NS
It may be needed to run Zephyr at EL1NS level with `CONFIG_ARMV8_A_NS`
In order to run at EL1NS, you'll need a proper Firmware loaded in the
FVP model to run Zephyr at non-secure EL3.

The ARM TF-A for FVP can used to run Zephyr as preloaded BL33.

This adds the necessary cmake scripts to load the TF-A binaries and
load Zephyr as preloaded BL33 payload.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
2021-09-06 14:11:32 -04:00
Jingru Wang cd87366016 cmake: emu: nsim: Allow all nsim platform use mdb
Currently the default runner of nsim_hs_smp is mdb,
the runner of other nsim platform is nsimdrv, user
can't change the default runner unless he uses
west command(--runner).

With this change cmake will choose runner according
to BOARD_DEBUG_RUNNER or BOARD_FLASH_RUNNER. so if
add -DBOARD_FLASH_RUNNER=mdb-nsim or
-DBOARD_DEBUG_RUNNER=mdb-nsim to cmake command,
the apllication will be run with mdb.

Signed-off-by: Jingru Wang <jingru@synopsys.com>
2021-08-24 07:22:22 -04:00
Chen Peng1 ce7ebb0821 tests: add a test to verify UEFI boot on x86_64 targets.
add a config CONFIG_QEMU_UEFI_BOOT to indicate whether
the qemu will use UEFI bootable method;
add a new test "sample.basic.helloworld.uefi" to verify
UEFT bootable method on qemu_x86_64 platform.

Signed-off-by: Chen Peng1 <peng1.chen@intel.com>
2021-08-11 11:46:13 +02:00
Evgeniy Paltsev 37a14c7e39 ARC: add nsim_hs6x_smp board with 2 cores ARCv3 HS6x
Add nsim_hs6x_smp simulation board (nSIM based) with
2 cores ARCv3 HS6x CPU.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Evgeniy Paltsev <PaltsevEvgeniy@gmail.com>
2021-08-07 20:36:23 -04:00
Evgeniy Paltsev 359f3494a3 ARC: ARCv3: add nsim_hs6x board
Add nSIM-based (simulator) board with single core ARCv3 HS6x 64 bit
CPU.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Evgeniy Paltsev <PaltsevEvgeniy@gmail.com>
2021-05-07 14:55:49 -05:00
Jaxson Han 8af11d40d0 cmake: emu: Add arm fvp emulator
Add arm fvp emulator in order to use ninja run or west build -t run.
Add armfvp in order to run twister.

Set env ARMFVP_BIN_PATH before using it,
e.g. export ARMFVP_BIN_PATH=<path/to/fvp/dir>
NOTE: ARMFVP_BIN_PATH is the dir path.

Signed-off-by: Jaxson Han <jaxson.han@arm.com>
2021-04-13 07:47:44 -04:00
Anas Nashif 467f916860 renode: fix dependencies for renode platforms
Make renode platforms run target depend on zephyr ELF.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-02-08 21:03:48 -05:00
Daniel Noom d2a682f372 cmake: Fix unexpected token after &
In bash a '&&' cannot follow directly after a '&'. So a task that is
run in the background should be enclosed in (curly) braces.

This:
```
west build -b qemu_x86 -d build/server samples/net/sockets/echo_server\
 -- -DOVERLAY_CONFIG=overlay-qemu_802154.conf -DPCAP=capture.pcap
west build -t server -d build/server
```
works correctly after this fix.

Fixes #29793

Signed-off-by: Daniel Noom <ggatw@outlook.com>
2021-01-18 19:08:45 +01:00
Tomasz Bursztyka 892714f818 cmake: Adds the necessary flags support for Qemu ivshmem feature
Depending whether doorbell or plain versions are enabled, it will set
the right flags to qemu.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-12-16 18:47:35 -05:00
Martin Åberg c107714214 sanitycheck: Add TSIM3 support
TSIM3 is a LEON processor and system simulator.

This commit allows using TSIM sanitycheck and the make run target.

TSIM parameters can be further specified in the board configuration
using TSIM and TSIM_SYS.

Signed-off-by: Martin Åberg <martin.aberg@gaisler.com>
2020-11-13 14:53:55 -08:00
Watson Zeng fad20c42c6 boards: arc: nsim: add a new board nsim_em7d_v22
Typically we have ARC core configurations where Fast IRQs (FIRQ) are
enabled together with multiple register files and those we have covered
by testing. But FIRQ & single register bank we only happen to have on
the older EMSK v2.2.it might be a good idea to add a similar
configuration to nSIM "boards" so that we keep it tested regularly.

nsim_em7d_v22 configuration is similar with em_staterkit_em7d_v22,
both configed with FIRQ & single register bank.

Signed-off-by: Watson Zeng <zhiwei@synopsys.com>
2020-09-03 21:47:51 +02:00
Wayne Ren 6f6fddf7e9 cmake: combine nsim and mdb for emulation
* to avoid confusion, combine nsim and mdb related
cmake configurations.

* this also enable the lanuch of mdb in sanitycheck

Signed-off-by: Wayne Ren <wei.ren@synopsys.com>
2020-08-14 13:30:56 +02:00
Anas Nashif 07b4df1945 cmake: put elf files for Qemu in /zephyr
The ELF files were placed in ${CMAKE_BINARY_DIR} when all other ELF
files are actually in ${CMAKE_BINARY_DIR}/zephyr, so keep things
consistent and in one place.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-08-13 12:42:27 -04:00
Andrew Boie a9670ab5cf boards: centralize QEMU icount management
Instead of endlessly repeating the same command line args,
centralize this and tune the shift value on a per-board
basis.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-06-24 20:28:36 -04:00
Stephanos Ioannidis 2c00c8e504 cmake: emu: Support QEMU semihosting console emulation
The QEMU '-semihosting' option enables the emulation of the semihosting
mechanism that can be used to interface the Zephyr RTOS to the host
operating system.

In order to support semihosting console output, the QEMU semihosting
feature is enabled and its console is connected to the console backend
chardev.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2020-05-07 23:33:38 -05:00
Stephanos Ioannidis 19965f8173 cmake: qemu: Support delayed expansion of QEMU_KERNEL_OPTION
This commit allows the `QEMU_KERNEL_OPTION` variable, which can be
overridden by the `board.cmake`, to contain references to the variables
that are not available at the time of `board.cmake` inclusion, by
expanding its escpaed variable references in `cmake/emu/qemu.cmake`
which is included nearby the end of the root `CMakeLists.txt`.

With this change, the `board.cmake` can escape variable references as
follows and allow them to be expanded later:

set(QEMU_KERNEL_OPTION "-device;loader,file=\$<TARGET_FILE:$\{...}>")

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2020-04-02 09:22:38 +02:00
Stephanos Ioannidis 04e874485b x86: intel64: Split 'locore' and 'main' kernel images for QEMU
This commit splits the 'locore' and 'main' memory regions into
separate executable images and specifies the 'locore' as the boot
kernel, in order to prevent the QEMU direct multiboot kernel loader
from overwriting the BIOS and option ROM areas located in between
the two memory regions.

The Zephyr x86-64 kernel image consists of two discontiguous load
memory regions: 'locore' at 0x8000 and 'main' at 0x100000, but the
QEMU treats these as single contiguous memory region starting at
0x8000 and ending at (0x100000 + MAIN_IMAGE_SIZE - 1).

This results in the direct multiboot kernel loader overwriting the
BIOS and option ROM areas as part of the kernel loading process, and
causes any writable system regions to be corrupted (e.g. KVMVAPIC ROM).

By splitting the two discontiguous memory regions into separate images
and specifying only the boot image (i.e. 'locore') as the '-kernel',
it is possible to work around the QEMU direct kernel loading design
limitation.

This workaround is required to support the QEMU v4.2.0 and above.

For more details, refer to the issue zephyrproject-rtos/sdk-ng#168.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2020-01-08 07:49:24 -06:00
Stephanos Ioannidis 244148a883 cmake: qemu: Use chardev for console
The current QEMU console configuration directly connects the console
serial port to the backend using '-serial' option.

This is less than ideal because only single console instance can be
connected to a backend and aggregation of multiple console outputs is
not possible (e.g. multiple console serial ports and semihosting
console to single console backend).

In order to solve this problem, single multiplexed chardev console
backend is declared and all consoles are connected to it.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2020-01-04 09:18:51 -05:00
Stephanos Ioannidis 3cc5bda2fa cmake: Support renode 1.8.2.
Renode 1.8 introduced a behaviour change in which it automatically
launches the telnet monitor on the TCP port 1234 by default.

In order to prevent sanitycheck failures from multiple renode instances
attempting to listen on the TCP port 1234 simultaneously, this commit
disables renode telnet monitor by specifying '--port -2' (a negative
number lower than -1 is required to disable telnet monitor because of
the way renode command line parser is implemented).

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2019-11-15 17:37:17 -05:00
Daniel Leung b7eb04b300 x86: consolidate x86_64 architecture, SoC and boards
There are two set of code supporting x86_64: x86_64 using x32 ABI,
and x86 long mode, and this consolidates both into one x86_64
architecture and SoC supporting truly 64-bit mode.

() Removes the x86_64:x32 architecture and SoC, and replaces
   them with the existing x86 long mode arch and SoC.
() Replace qemu_x86_64 with qemu_x86_long as qemu_x86_64.
() Updates samples and tests to remove reference to
   qemu_x86_long.
() Renames CONFIG_X86_LONGMODE to CONFIG_X86_64.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2019-10-25 17:57:55 -04:00
Andrew Boie beb81885c2 qemu_x86_long: don't munge to elf32 in-place
Instead, use the QEMU_KERNEL_FILE facility to perform the
change in a new file zephyr-qemu.elf. This is what will
be sent to the emulator.

Fixes an issue where opening zephyr.elf in GDB would treat
it as a 32-bit binary instead of what it actually is,
forcing the user to override the arch setting.

Fixes: #19734

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-10-19 12:08:00 -07:00
Andy Ross d042a3dac7 tests/kernel/mp: Update the MP test to run on emulated platforms
This was a very early test and got bitrotten inside a esp32-only
whitelist.  Make it run generically.

SMP must be forced off by the test (it's commonly a platform default).

Add a build-time failure when the configuration is single-CPU, for
clarity.

Filter the test likewise so it runs on all supported systems.

Also, the key argument to the CPU startup function is vestigial and
the test was being too strict by requiring it to be non-zero.

Finally, the qemu command line needs to predicate the "-smp" argument
on CONFIG_MP_NUM_CPUS and not just CONFIG_SMP so we have an extra CPU
to test against.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-10-06 12:53:28 -04:00
Charles E. Youse 640c5a5e95 boards/x86: add Intel64 (64-bit long-mode) QEMU target board
Add qemu_x86_long board (with CONFIG_X86_LONGMODE=y) for testing.

This requires adding support to soc/ia32 for long mode (trivial),
and adding a quick 64- to 32-bit ELF conversion before invoking
QEMU, which apparently doesn't like 64-bit kernel files.

Signed-off-by: Charles E. Youse <charles.youse@intel.com>
2019-09-15 11:33:47 +08:00
Charles E. Youse 6767563f94 arch/x86: remove support for IAMCU ABI
This ABI is no longer required by any targets and is deprecated.

Signed-off-by: Charles E. Youse <charles.youse@intel.com>
2019-09-07 10:07:42 -04:00
Alexey Brodkin 408433d5c7 board/nsim: Add support of multi-core ARC HS platform in nSIM
Now when SMP support for ARC is available we may introduce a simulation
platform which might be used for testing & development for SMP setups.

One important note is stand-alone nSIM (as well as its "Free" flavour)
doesn't support SMP simulation so we have to switch to use of nSIM via
proprietary MetaWare debugger [1] and so:
 1. We introduce new emulation target "mdb"
 2. It's only possible to run that platform for those who
    have MetaWare tools installed and valid license.

Though QEMU port for ARC is in work at the moment and once we
open that port and it has SMP support we'll switch to it and everybody
will be able to try ARC HS with SMP.

[1] https://www.synopsys.com/dw/ipdir.php?ds=sw_metaware

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
2019-08-11 21:18:38 +02:00