Skip to content

test: run ESP32 programs in QEMU - #5580

Open
jakebailey wants to merge 2 commits into
tinygo-org:devfrom
jakebailey:xtensa-qemu-ci
Open

test: run ESP32 programs in QEMU#5580
jakebailey wants to merge 2 commits into
tinygo-org:devfrom
jakebailey:xtensa-qemu-ci

Conversation

@jakebailey

Copy link
Copy Markdown
Member

I was working on Xtensa panic/recover, but noticed that CI doesn't seem to run emulation. Fix that, and a bug found that only happens on full images.

There has to be another _qemu.go file, but that is not different than other systems.

@deadprogram

Copy link
Copy Markdown
Member

Looks good overall, thanks for working on this @jakebailey

Two small things that were pointed out in an automated code review:

  1. device.AsmFull has no clobber support, so the writes to a2/a3 in qemuExit are undeclared
    clobbers. It's safe here only because the waiti loop follows and nothing after reads them.
    Worth a comment saying a2 = SYS_exit (1), a3 = exit code, and that the trailing loop is
    what makes the missing clobber list OK.

  2. targets/esp32.json and targets/esp32s3.json still have their own qemu-system-xtensa
    emulator lines. Those lack -semihosting and don't set the qemu build tag, so now that CI
    has a working xtensa QEMU on PATH they're broken rather than just unused. Can they be
    dropped in favor of the new esp32-qemu target?

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds ESP32 QEMU execution to CI and corrects full-image flash segment placement.

Changes:

  • Adds a dedicated ESP32 QEMU target with semihosting exit support.
  • Runs an ESP32 program under Espressif QEMU in Linux CI.
  • Fixes DROM/IROM offsets in full ESP32 images.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated no comments.

Show a summary per file
File Description
.github/workflows/linux.yml Installs Espressif QEMU and dependencies.
builder/esp.go Corrects full-image flash offsets.
main_test.go Adds QEMU execution and output cleanup.
src/runtime/runtime_esp32.go Moves hardware abort implementation.
src/runtime/runtime_esp32_abort.go Provides hardware ESP32 abort behavior.
src/runtime/runtime_esp32_qemu.go Adds semihosting termination.
src/runtime/runtime_esp32xx.go Moves shared exit implementation.
src/runtime/runtime_esp32xx_exit.go Provides non-QEMU exit behavior.
targets/esp32-qemu.json Defines the QEMU target.
targets/esp32.json Removes QEMU from the hardware target.
targets/esp32s3.json Removes the incompatible emulator setting.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

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.

3 participants