Skip to content

Commit cd61968

Browse files
update docs
1 parent 06e9107 commit cd61968

File tree

1 file changed

+25
-14
lines changed

1 file changed

+25
-14
lines changed

docs/os-development/emulating-esp32-on-desktop.md

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,19 @@ To this end, we're using the amazing a159x36 QEMU emulator, which can emulate th
2121

2222
To get it running, follow these steps:
2323

24-
1. Compile QEMU (or get a precompiled build)
24+
1. Compile the ESP32 QEMU
2525
2. Pad a MicroPythonOS release image to 16MB (otherwise QEMU refuses it)
2626
3. Start QEMU with the padded MicroPython release image
2727

28+
There are also [GitHub workflows](https://github.com/MicroPythonOS/qemu/tree/esp-develop-9.2/.github/workflows) that compile the ESP32 QEMU for Linux, Windows, MacOS (intel) and MacOS (arm) so you might be able to download a prebuilt version from the [GitHub actions](https://github.com/MicroPythonOS/qemu/actions) artifacts. You need to be logged in to download them.
29+
2830
## 1. Compile QEMU
2931

3032
Get the prerequisites:
3133

32-
`sudo apt-get install -y -q --no-install-recommends build-essential libgcrypt-dev libglib2.0-dev libpixman-1-dev libsdl2-dev libslirp-dev ninja-build python3-pip libvte-2.91-dev wget zlib1g-dev`
34+
```
35+
sudo apt-get install -y -q --no-install-recommends build-essential libgcrypt-dev libglib2.0-dev libpixman-1-dev libsdl2-dev libslirp-dev ninja-build python3-pip libvte-2.91-dev wget zlib1g-dev
36+
```
3337

3438
Clone it:
3539

@@ -40,7 +44,9 @@ cd qemu
4044

4145
Configure it:
4246

43-
`./configure --target-list=xtensa-softmmu --enable-gcrypt --enable-slirp --enable-debug --enable-vte --enable-stack-protector`
47+
```
48+
./configure --target-list=xtensa-softmmu --enable-gcrypt --enable-slirp --enable-debug --enable-vte --enable-stack-protector
49+
```
4450

4551
Compile it:
4652

@@ -50,9 +56,13 @@ Compile it:
5056

5157
Download the [latest release](https://github.com/MicroPythonOS/MicroPythonOS/releases) or use one you built yourself.
5258

53-
A simple way to pad a file to 16MB on Linux is:
59+
The ESP32 QEMU refuses it if it's not a supported size (2, 4, 8 or 16MB) so just pad it with zeroes.
5460

55-
`dd if=MicroPythonOS_esp32_0.8.0.bin of=MicroPythonOS_esp32_0.8.0.bin.padded bs=1M count=16 oflag=append conv=notrunc`
61+
A simple way to do this on Linux is:
62+
63+
```
64+
dd if=MicroPythonOS_esp32_0.8.0.bin of=MicroPythonOS_esp32_0.8.0.bin.padded bs=1M count=16 oflag=append conv=notrunc
65+
```
5666

5767
## 3. Start QEMU
5868

@@ -70,30 +80,31 @@ Also these are forwarded, although currently unused:
7080
- `127.0.0.1:10080 to 192.168.4.15:80` when the ESP32 is in Station (WiFi client) mode
7181
- `127.0.0.1:10081 to 192.168.4.1:80` when the ESP32 is in Access Point (Hotspot) mode
7282

73-
**Note**: QEMU will only log to stdout if you start it from a normal shell, with stdin set. If you're starting it from a script or other tool, consider adding "unbuffer" as a prefix to make sure stdin is set, otherwise you won't see much logging.
83+
**Note**: QEMU will only log to stdout if you start it from a normal shell because then stdin is be set. If you're starting it from a script or other tool that doesn't set stdin, consider adding the `unbuffer` tool as a prefix at the start of the command to make sure stdin is set, otherwise you won't see much logging.
7484

7585
## Controls
7686

7787
To navigate around in the emulated T-Display S3:
7888

79-
- press "r" for the reset button
80-
- press "1" for the GPIO0 button - "previous"
81-
- press "2" for the GPIO14 button - "next"
89+
- press `r` for the reset button
90+
- press `1` for the GPIO0 button - mapped to the "previous" action
91+
- press `2` for the GPIO14 button - mapped to the "next" action
8292
- press both for the "enter" action
83-
- long press "1" for the "back" action
93+
- long press `1` for the "back" action
8494

8595
You can also click the buttons on the picture of the board if you like.
8696

87-
Also, currently unused but:
97+
Also, currently unused:
98+
8899
- 7, 8, 9 and 0 are bound to capacitive touch input pins 0, 1, 11 and 12 which correspond to GPIO01, GPIO02, GPIO12 and GPIO13
89100

90101
The code for these controls is in QEMU's `hw/xtensa/esp32s3.c` and `hw/display/st7789v.c`.
91102

92103
## Building an image with a filesystem
93104

94-
For quick development, rather than doing a full rebuild, you could also just rebuild the filesystem based on internal_filesystem/ and bundle that filesystem in an image.
105+
For quick development, rather than doing a full rebuild, you could also just rebuild the filesystem based on `internal_filesystem/` and bundle that as a LittleFS2 filesystem in the image.
95106

96-
Run `scripts/make_image.sh` from the [MicroPythonOS repo](https://github.com/MicroPythonOS/MicroPythonOS) to do so.
107+
Run `./scripts/make_image.sh` from the [MicroPythonOS repo](https://github.com/MicroPythonOS/MicroPythonOS) to do so.
97108

98-
It will call `scripts/mklittlefs.sh` to build the filesystem and bundle it with all the other requisites, giving you a bootable image in one second.
109+
It will call `./scripts/mklittlefs.sh` to build the filesystem and bundle it with all the other requisites, giving you a bootable image in one second.
99110

0 commit comments

Comments
 (0)