{"id":15102107,"url":"https://github.com/deomorxsy/xtensa-qemetsu","last_synced_at":"2026-01-31T22:03:49.661Z","repository":{"id":238422368,"uuid":"796517051","full_name":"deomorxsy/xtensa-qemetsu","owner":"deomorxsy","description":"firmware dev environment POC for Xtensa (esp32/esp8266) with pio and QEMU","archived":false,"fork":false,"pushed_at":"2024-07-19T12:02:42.000Z","size":91,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-15T10:02:46.291Z","etag":null,"topics":["esp32","esptool","nvim","platformio","qemu","qemu-system-xtensa"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/deomorxsy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-05-06T05:22:13.000Z","updated_at":"2024-07-19T12:02:46.000Z","dependencies_parsed_at":"2024-05-06T06:30:26.938Z","dependency_job_id":"33b2468c-e363-4606-a468-9ed2c3f3cb62","html_url":"https://github.com/deomorxsy/xtensa-qemetsu","commit_stats":{"total_commits":13,"total_committers":1,"mean_commits":13.0,"dds":0.0,"last_synced_commit":"549ee8787b59e20ba1890164f921c9a2d8fbaf82"},"previous_names":["deomorxsy/xtensa-qemetsu"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/deomorxsy/xtensa-qemetsu","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deomorxsy%2Fxtensa-qemetsu","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deomorxsy%2Fxtensa-qemetsu/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deomorxsy%2Fxtensa-qemetsu/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deomorxsy%2Fxtensa-qemetsu/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/deomorxsy","download_url":"https://codeload.github.com/deomorxsy/xtensa-qemetsu/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deomorxsy%2Fxtensa-qemetsu/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28956938,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-31T18:30:42.805Z","status":"ssl_error","status_checked_at":"2026-01-31T18:30:19.593Z","response_time":128,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["esp32","esptool","nvim","platformio","qemu","qemu-system-xtensa"],"created_at":"2024-09-25T18:47:17.515Z","updated_at":"2026-01-31T22:03:49.637Z","avatar_url":"https://github.com/deomorxsy.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"## lumenssif\n\u003e simple presence-based lighting control with esp32\n\n[![Flashing](https://github.com/deomorxsy/xtensa-qemetsu/actions/workflows/ci.yml/badge.svg)](https://github.com/deomorxsy/xtensa-qemetsu/actions/workflows/ci.yml)\n\nProject environment:\n- [nvim-platformio](https://github.com/anurag3301/nvim-platformio.lua/) lua plugin, a  PlatformIO wrapper for neovim written in lua\n- [qemu-esp-xtensa](https://github.com/espressif/qemu), a fork of QEMU with Espressif patches.\n\nFurther tooling details for reproducing are in ```./assets/metadata.txt```, a dump using ```pio project metadata```.\n\nDirectory structure:\n```sh\n; tree -C -L 1\n.\n├── assets\n├── CMakeLists.txt\n├── compose.yml\n├── deploy.yml\n├── Dockerfile\n├── include\n├── lib             #lib directory can be used for the project specific (private) libraries. More details are located in lib/README file.\n├── LICENSE\n├── Makefile\n├── platformio.ini  #“platformio.ini” (Project Configuration File)\n├── README.md\n├── scripts\n├── src             # src directory where you should place source code (*.h, *.c, *.cpp, *.S, *.ino, etc.)\n└── test\n\n```\n\n### Build\n\n\u003e I used Arch Linux while doing this, hence the PKGBUILD, but the software build is distro-agnostic, so you can just clone the repo and build manually.\n\nChoose between [```qemu-system-xtensa```](https://github.com/qemu/qemu) (mainline qemu, where you configure with the xtensa option) and [```qemu-esp-xtensa```](https://github.com/espressif/qemu) (the fork).\n\nI choose the second one, then got the PKGBUILD:\n```sh\n; wget -O ./PKGBUILD https://aur.archlinux.org/cgit/aur.git/plain/PKGBUILD?h=qemu-esp-xtensa-git\n; # disable asan, AddressSanitizer\n; sed -e \"/--enable-sanitizers/{h;d;}\" -e \"/--disable-gtk/{G;}\" -e 's/\\(--enable-sanitizers\\)/#\\1/g' -e 's/disable-gtk/\u0026 \\\\ /' ./PKGBUILD \u003e ./PKGBUILD\n; makepkg\n; # copy package to /opt/ and create a symbolic link of the binary\n; # to /usr/bin making it available system-wide\n; sudo cp -r ./pkg/qemu-esp-xtensa-git/opt/qemu-esp-xtensa-git/ /opt/\n; sudo ln -s ./opt/qemu-esp-xtensa-git/bin/qemu-system-xtensa /usr/bin/\n```\n\nYou may need ```99-platformio-udev.rules``` on Linux x86_64.\n```sh\n; curl -fsSL https://raw.githubusercontent.com/platformio/platformio-core/develop/platformio/assets/system/99-platformio-udev.rules | sudo tee /etc/udev/rules.d/99-platformio-udev.rules\n; sudo udevadm control --reload\n; sudo udevadm trigger\n```\n\n\n### Boot\n\nOn neovim, build with ```Piorun build```. After building the application, run it on QEMU:\n\n```sh\ncat \u003c\u003c \"EOF\" \u003e ./scripts/qemu-xtensa-myifup.sh\n#!/bin/sh\n#\n# qemu-esp-xtensa-git.git\nqemu-system-xtensa -nographic \\\n    -machine esp32 \\\n    -drive file=./.pio/build/upesy_wroom/firmware.bin,if=mtd,format=raw \\\n    -S -s\nEOF\n\nchmod +x ./scripts/qemu-xtensa-myifup.sh\n./scripts/qemu-xtensa-myifup.sh\n```\n\n### Troubleshooting\n\nNow you may come across this error:\n```\nqemu-system-xtensa: Error: only 2, 4, 8, 16 MB flash images are supported\n```\n\nTo get the firmware binary working, use espressif's [esptool](https://github.com/espressif/esptool) to flash the firmware into a binary image containing the second stage bootloader.\n\n\nCreate a python's virtualenv to store the esptool dependencies using [get-esptool.sh](./scripts/get-esptool.sh):\n```sh\n; cd ./assets/ || return\n; git clone git@github.com:espressif/esptool.git\n; python3 -m venv venv\n; cd - || return\n; . ./assets/venv/bin/activate\n; pip3 install --upgrade pip\n; pip3 install -r ./assets/requirements.txt\n; deactivate\n```\n\nFlash the second stage bootloader into the image then boot it into QEMU using [flash.sh](./scripts/flash.sh):\n```sh\ncat \u003c\u003c \"EOF\" \u003e ./scripts/flash.sh\n#!/usr/bin/sh\n#\n# source(POSIX sh) venv relative to the repo root directory\n. ./assets/venv/bin/activate\n\n./assets/esptool/esptool.py --chip ESP32 merge_bin \\\n    -o merged-flash.bin \\\n    --flash_mode dio \\\n    --flash_size 4MB \\\n    0x1000 .pio/build/upesy_wroom/bootloader.bin \\\n    0x8000 .pio/build/upesy_wroom/partitions.bin \\\n    0x10000 .pio/build/upesy_wroom/firmware.bin \\\n    --fill-flash-size 4MB\n\ndeactivate\nEOF\n\nchmod +x ./scripts/flash.sh\n./scripts/flash.sh\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeomorxsy%2Fxtensa-qemetsu","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdeomorxsy%2Fxtensa-qemetsu","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeomorxsy%2Fxtensa-qemetsu/lists"}