Skip to content

Commit 65c050c

Browse files
committed
working QEMU for ESP32
1 parent d7a6aa1 commit 65c050c

File tree

12 files changed

+2023
-16
lines changed

12 files changed

+2023
-16
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
build/
2+
3+
*.bin

.vscode/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"cmake.sourceDirectory": "/workspaces/iot-playground/demo_esp_idf/firstproj"
3+
}

README.md

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ esptool.py --chip esp32s3 merge_bin --output M5CardRemote.M5Cardputer.bin \
7575
### Install ESP IDF
7676

7777
```bash
78-
sudo apt-get install git wget flex bison gperf python3 python3-pip python3-venv cmake ninja-build ccache libffi-dev libssl-dev dfu-util libusb-1.0-0
78+
sudo apt install git wget flex bison gperf python3 python3-pip python3-venv cmake ninja-build ccache libffi-dev libssl-dev dfu-util libusb-1.0-0
7979

8080
mkdir ~/esp
8181

@@ -102,7 +102,9 @@ idf.py build
102102
### Merge bootloader, partiotion table with app
103103

104104
```bash
105-
esptool.py --chip esp32s3 merge_bin -o ../Demo.ESP_IDF.bin --fill-flash-size 4MB @flash_args
105+
cd build/
106+
107+
esptool.py --chip esp32 merge_bin -o ../firmware.bin --fill-flash-size 4MB @flash_args
106108
```
107109

108110
### Other commands
@@ -124,10 +126,26 @@ idf.py add-dependency
124126
- Install esptool.py - `pip install -U esptool`
125127

126128
```bash
127-
128129
esptool write_flash -z 0 name.bin
130+
```
131+
132+
## QEMU Emulation
133+
134+
```bash
135+
# Install pre-requisites
136+
sudo apt install -y libgcrypt20 libglib2.0-0 libpixman-1-0 libsdl2-2.0-0 libslirp0
137+
138+
# Install
139+
idf_tools.py install qemu-xtensa qemu-riscv32
140+
141+
# Reload env.
142+
. ~/esp/esp-idf/export.sh
143+
144+
# Boot firmware image
145+
qemu-system-xtensa -machine esp32 -nographic -drive file=firmware1.bin,if=mtd,format=raw
129146

130147
```
148+
131149
---
132150

133151
### Development Notes

demo_esp_idf/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
build/
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# For more information about build system see
2+
# https://docs.espressif.com/projects/esp-idf/en/latest/api-guides/build-system.html
3+
# The following five lines of boilerplate have to be in your project's
4+
# CMakeLists in this exact order for cmake to work correctly
5+
cmake_minimum_required(VERSION 3.16)
6+
7+
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
8+
project(firstproj)
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
idf_component_register(SRCS "firstproj.c"
2+
INCLUDE_DIRS ".")
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#include <stdio.h>
2+
#include "esp_log.h"
3+
4+
void app_main(void)
5+
{
6+
ESP_LOGI("firstproj", "Started first project");
7+
8+
// while (true)
9+
// {
10+
// ESP_LOGI("firstproj", "in the loop");
11+
// }
12+
13+
}

0 commit comments

Comments
 (0)