-
Notifications
You must be signed in to change notification settings - Fork 8.3k
runners: add and improve QEMU runner (Python-based replacement for qemu.cmake) #99170
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
runners: add and improve QEMU runner (Python-based replacement for qemu.cmake) #99170
Conversation
|
Please fix compliance and CI issues, also since you considerately modified the file, remove it from the ruff excludes file and format it using Line 1415 in 13daf24
|
7ef3765 to
100ca60
Compare
100ca60 to
ff8dfb9
Compare
995f3dc to
d4d7316
Compare
please take a look |
d4d7316 to
a8e0305
Compare
cmake/emu/qemu.cmake
Outdated
| list(APPEND QEMU_FLAGS | ||
| -icount shift=${CONFIG_QEMU_ICOUNT_SHIFT},align=off,sleep=on | ||
| -rtc clock=vm) | ||
| -icount shift=${CONFIG_QEMU_ICOUNT_SHIFT},align=off,sleep=on |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these changes are not valid with this alignment
044ccd6 to
45995c3
Compare
45995c3 to
26b0e4c
Compare
- Add scripts/west_commands/runners/qemu.py: starter ZephyrBinaryRunner for QEMU. - Add cmake/emu/qemu.cmake shim that warns about deprecation. - Add short note doc/contrib/qemu_runner_note.rst. Fixes: zephyrproject-rtos#5501 Signed-off-by: Ritesh Kudkelwar <[email protected]>
26b0e4c to
31b7a63
Compare
|
Please retry analysis of this Pull-Request directly on SonarQube Cloud |
| if not qemu_bin or not shutil.which(qemu_bin): | ||
| raise RuntimeError( | ||
| "QEMU binary not found: set --qemu-binary or install qemu-system-* on PATH" | ||
| ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use self.require(qemu_bin) instead?
|
|
||
| class QemuBinaryRunner(ZephyrBinaryRunner): | ||
| '''Place-holder for QEMU runner customizations.''' | ||
| log = logging.getLogger(__name__) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Runners already have a logger, as self.logger.
| def _platform_defaults(self): | ||
| # Minimal defaults. Extend per-board: memory, machine type etc. | ||
| # For common x86 qemu_x86: use -M pc -m 512M -nographic | ||
| board = (self.cfg.board or "").lower() if hasattr(self.cfg, "board") else "" | ||
| if "qemu_x86" in board or "qemu_x86" in str(self.cfg.board_dir): | ||
| return ["-M", "pc", "-m", "512", "-nographic"] | ||
| # cortex-m3 qemu example: | ||
| if "cortex_m3" in board or "qemu_cortex_m3" in str(self.cfg.board_dir): | ||
| return ["-M", "lm3s6965evb", "-nographic"] | ||
| # fall back to minimal no-graphic | ||
| return ["-nographic"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should not be done here, but instead passed as arguments from the boards. Search board_runner_args for examples.
This PR introduces a Python-based QEMU runner (
scripts/west_commands/runners/qemu.py)as part of the effort to deprecate the legacy
cmake/emu/qemu.cmake.Key points:
west runintegrationTested on:
qemu_x86board runningsamples/hello_world(successful boot and output)This addresses part of zephyrproject-rtos/zephyr#5501
and sets the foundation for full migration from CMake to Python-based QEMU runner.