Skip to content

trunner: add support for loading tests on armv7r5f-zynqmp-qemu#465

Merged
damianloew merged 4 commits intomasterfrom
damianloew/load_apps_on_qemu
Mar 26, 2026
Merged

trunner: add support for loading tests on armv7r5f-zynqmp-qemu#465
damianloew merged 4 commits intomasterfrom
damianloew/load_apps_on_qemu

Conversation

@damianloew
Copy link
Contributor

@damianloew damianloew commented Mar 19, 2026

Description

  • coremark_pro: set timeouts for armv7r5f-zynqmp-qemu
  • exclude tests not supported on armv7r5f-zynqmp-qemu
  • trunner: unify loading apps to RAM
  • trunner: add support for loading tests on armv7r5f-zynqmp-qemu

Motivation and Context

trunner: unify loading apps to RAM

The following targets shared the same interface for loading apps to RAM:
 - armv8m33-mcxn94x-frdm
 - armv7m4-stm32l4x6-nucleo
 - armv7r5f-zynqmp-qemu
Base class has been created to avoid code duplication.

trunner: add support for loading tests on armv7r5f-zynqmp-qemu

As this is a dummyfs target, test binaries must be explicitly loaded before execution.
This change adds that loading step to trunner.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Chore (refactoring, style fixes, git/CI config, submodule management, no code logic changes)

How Has This Been Tested?

  • Already covered by automatic testing.
  • New test added: (add PR link here).
  • Tested by hand on: (list targets here).

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing linter checks and tests passed.
  • My changes generate no new compilation warnings for any of the targets.

Special treatment

@gemini-code-assist
Copy link

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly expands trunner's testing capabilities by integrating a new QEMU target, armv7r5f-zynqmp-qemu. The changes primarily focus on establishing a reliable method for loading test applications onto this target using GDB, which involves a new application loader and improvements to the GDB interaction utility. This enables more comprehensive and automated testing for embedded systems running on the specified ARM architecture.

Highlights

  • New QEMU Target Support: Added support for the armv7r5f-zynqmp-qemu target, enabling trunner to execute tests on this specific emulated platform.
  • GDB-based Application Loading: Introduced ARMV7R5FPloAppLoader, a new component that leverages GDB to load applications into the emulated target's RAM, providing a robust mechanism for test setup.
  • Configurable GDB Initialization: Enhanced the GdbInteractive tool to accept and execute a list of initial commands upon connection, allowing for target-specific GDB configurations like setting the architecture.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces support for the armv7r5f-zynqmp-qemu target, enabling application loading via GDB. The changes to trunner/tools/gdb.py for handling initial commands are well-implemented. However, I've identified a critical bug in the new target implementation that could lead to a crash, and an opportunity for refactoring to enhance code quality and efficiency. Please see my detailed comments.

@github-actions
Copy link

github-actions bot commented Mar 19, 2026

Unit Test Results

10 459 tests  +906   9 797 ✅ +836   55m 14s ⏱️ + 2m 47s
   625 suites + 34     662 💤 + 70 
     1 files   ±  0       0 ❌ ±  0 

Results for commit a06be35. ± Comparison against base commit 6ed92c4.

This pull request skips 1 test.
phoenix-rtos-tests/libc/misc ‑ aarch64a53-zynqmp-qemu:phoenix-rtos-tests/libc/misc.stat_mode.fifo_type

♻️ This comment has been updated with latest results.

@damianloew
Copy link
Contributor Author

/gemini review

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new PloRamAppLoader base class to standardize the process of loading applications into RAM for various targets. Existing app loaders for STM32L4x6 and MCXN947 have been refactored to inherit from this new base class, eliminating redundant code. Crucially, support for a new target, armv7r5f-zynqmp-qemu, has been added, including a dedicated ARMV7R5FPloAppLoader that utilizes GDB for application loading. The GdbInteractive class has also been enhanced to support initial GDB commands. Additionally, several test configurations across libc, mem, sys, and waitpid have been updated to properly exclude or include the armv7r5f-zynqmp-qemu target based on its specific capabilities, such as the lack of fork() or mprotect functionality on NOMMU architectures. A suggestion was made to refactor the application loading logic in ARMV7R5FPloAppLoader to improve readability and efficiency by pre-gathering application metadata before GDB loading and PLO registration.

Comment on lines +146 to +164
with self.gdb.run():
offset = 0
self.gdb.connect()

for app in self.apps:
path = self.gdb.cwd / Path(app.file)
sz = self._aligned_app_size(path)
self.gdb.load(path, self.ramdisk_addr + offset)
offset += sz

offset = 0
for app in self.apps:
path = self.gdb.cwd / Path(app.file)
sz = path.stat().st_size

self.alias(app.file, offset=offset, size=sz)
self.app("ramdisk", app.file, "ddr", "ddr")

offset += self._aligned_app_size(path)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

To improve readability and avoid redundant calculations, you could gather application metadata (like path, size, and aligned size) in a single loop before performing the GDB loading and PLO registration steps. This would make the logic cleaner and slightly more efficient by not re-calculating paths and sizes in the second loop.

        apps_meta = []
        for app in self.apps:
            path = self.gdb.cwd / Path(app.file)
            apps_meta.append(
                {
                    "path": path,
                    "file": app.file,
                    "size": path.stat().st_size,
                    "aligned_size": self._aligned_app_size(path),
                }
            )

        with self.gdb.run():
            offset = 0
            self.gdb.connect()

            for meta in apps_meta:
                self.gdb.load(meta["path"], self.ramdisk_addr + offset)
                offset += meta["aligned_size"]

        offset = 0
        for meta in apps_meta:
            self.alias(meta["file"], offset=offset, size=meta["size"])
            self.app("ramdisk", meta["file"], "ddr", "ddr")

            offset += meta["aligned_size"]

Copy link
Contributor Author

@damianloew damianloew Mar 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMHO too complicated (I don't like 3 for loops instead of 2, calculating path and getting size is not so time consuming to do it 2 times), but I will change sz to aligned_sz in the first loop.

@damianloew damianloew force-pushed the damianloew/load_apps_on_qemu branch from fdf7dfb to cbbe58c Compare March 24, 2026 11:05
As this is a dummyfs target, test binaries must be explicitly loaded before execution.
This change adds that loading step to trunner.

JIRA: CI-652
The following targets shared the same interface for loading apps to RAM:
 - armv8m33-mcxn94x-frdm
 - armv7m4-stm32l4x6-nucleo
 - armv7r5f-zynqmp-qemu
Base class has been created to avoid code duplication.

JIRA: CI-652
@damianloew damianloew force-pushed the damianloew/load_apps_on_qemu branch from cbbe58c to 031a48a Compare March 24, 2026 12:21
@damianloew
Copy link
Contributor Author

Only waiting for coremark to be enabled in p-r-project to set timeouts (locally all benchmarks work), above that ready for review

@damianloew damianloew marked this pull request as ready for review March 24, 2026 17:59
@damianloew damianloew marked this pull request as draft March 25, 2026 12:05
@damianloew damianloew force-pushed the damianloew/load_apps_on_qemu branch 4 times, most recently from 2c0c662 to eeeb019 Compare March 25, 2026 14:56
@damianloew damianloew marked this pull request as ready for review March 25, 2026 15:00
@damianloew damianloew force-pushed the damianloew/load_apps_on_qemu branch from eeeb019 to a06be35 Compare March 25, 2026 16:49
Copy link
Member

@mateusz-bloch mateusz-bloch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@damianloew damianloew merged commit f7978fc into master Mar 26, 2026
51 checks passed
@damianloew damianloew deleted the damianloew/load_apps_on_qemu branch March 26, 2026 10:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants