summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRishi-k-s <rishikrishna.sr@gmail.com>2025-12-27 22:49:17 +0530
committerRishi-k-s <rishikrishna.sr@gmail.com>2025-12-27 22:49:17 +0530
commit567c2f9dc7da745810cdf2daffdef857d5f53625 (patch)
tree541d89781f9a465a177eb4cfe5e870bd4c7ecb3a
parent579e9f44579718e516213fc4311bf4d3ce45d0d3 (diff)
feat(stop at time): updated the timing thing to stop
-rw-r--r--README.md10
-rwxr-xr-xino_to_running.sh16
-rw-r--r--output.txt127
3 files changed, 69 insertions, 84 deletions
diff --git a/README.md b/README.md
index f09558e..bd9265f 100644
--- a/README.md
+++ b/README.md
@@ -1,11 +1,10 @@
# Build .ino programs in esp-idf and Emulate it with QEMU
Yes, the title is pretty self-explanatory, so you need some prerequisites
-- First you need to setup esp_idf
+- First you need to setup [esp_idf](https://rishikrishna.com/projects/esp32-emulation-qemu/#esp-idf)
+- Then setup QEMU, install instructions can be found [here](https://rishikrishna.com/projects/esp32-emulation-qemu/#qemu)
- Then, setup esp_idf QEMU, not the normal QEMU, like ESP have their own custom one as espressif's repo, uk for the Xtensia boards
- Yeah that is pretty much it
## Running this
-first cd to the project directory
-To run this: \
```bash
git clone https://github.com/Rishi-k-s/emulate_esp32_with_ino arduino_to_esp && cd arduino_to_esp \
chmod +x ./ino_to_running.sh
@@ -14,4 +13,7 @@ chmod +x ./ino_to_running.sh
then, just take any .ino file u have and do this and with some majik :stars: it should be working
```bash
./ino_to_running.sh testing.ino # an example btw
-``` \ No newline at end of file
+```
+Exit it by `Ctrl A , then X`
+
+The output is saved into `output.txt` \ No newline at end of file
diff --git a/ino_to_running.sh b/ino_to_running.sh
index 93c5aa4..e63f335 100755
--- a/ino_to_running.sh
+++ b/ino_to_running.sh
@@ -54,8 +54,22 @@ esptool.py --chip esp32 merge_bin -o "$FLASHABLE_BIN" \
# This is optional, but truncating the image into 4MB so it will run without any errors in QEMU
truncate -s 4M "$FLASHABLE_BIN"
echo "Created flashable binary at $FLASHABLE_BIN"
+
+
echo "Now emulating it via QEMU..."
# Finally running it in QEMU
+
+set -e # Exit if it gets errors
+
qemu-system-xtensa -nographic -machine esp32 \
- -drive file=build/flash_image.bin,if=mtd,format=raw > output.txt 2>&1 \ No newline at end of file
+ -drive file=build/flash_image.bin,if=mtd,format=raw > output.txt 2>&1 &
+
+echo "QEMU PID: $QEMU_PID"
+
+QEMU_PID=$!
+
+sleep 6
+
+kill "$QEMU_PID"
+wait "$QEMU_PID" 2>/dev/null \ No newline at end of file
diff --git a/output.txt b/output.txt
index 1467589..045e9f6 100644
--- a/output.txt
+++ b/output.txt
@@ -10,53 +10,53 @@ ho 0 tail 12 room 4
load:0x40078000,len:15916
load:0x40080400,len:3860
entry 0x40080638
-I (660) boot: ESP-IDF v5.5.1 2nd stage bootloader
-I (660) boot: compile time Dec 27 2025 19:01:21
-I (661) boot: Multicore bootloader
-I (690) boot: chip revision: v0.0
-I (692) boot.esp32: SPI Speed : 40MHz
-I (693) boot.esp32: SPI Mode : DIO
-I (693) boot.esp32: SPI Flash Size : 2MB
-I (699) boot: Enabling RNG early entropy source...
-I (706) boot: Partition Table:
-I (706) boot: ## Label Usage Type ST Offset Length
-I (706) boot: 0 nvs WiFi data 01 02 00009000 00006000
-I (707) boot: 1 phy_init RF data 01 01 0000f000 00001000
-I (707) boot: 2 factory factory app 00 00 00010000 00100000
-I (711) boot: End of partition table
-I (736) esp_image: segment 0: paddr=00010020 vaddr=3f400020 size=0d234h ( 53812) map
-I (752) esp_image: segment 1: paddr=0001d25c vaddr=3ffb0000 size=02560h ( 9568) load
-I (764) esp_image: segment 2: paddr=0001f7c4 vaddr=40080000 size=00854h ( 2132) load
-I (777) esp_image: segment 3: paddr=00020020 vaddr=400d0020 size=1fee0h (130784) map
-I (799) esp_image: segment 4: paddr=0003ff08 vaddr=40080854 size=0e160h ( 57696) load
-I (815) esp_image: segment 5: paddr=0004e070 vaddr=50000000 size=00020h ( 32) load
-I (862) boot: Loaded app from partition at offset 0x10000
-I (862) boot: Disabling RNG early entropy source...
-I (874) cpu_start: Multicore app
-I (1451) cpu_start: Pro cpu start user code
-I (1452) cpu_start: cpu freq: 160000000 Hz
-I (1452) app_init: Application information:
-I (1452) app_init: Project name: arduino_to_esp
-I (1452) app_init: App version: 1
-I (1452) app_init: Compile time: Dec 27 2025 19:01:15
-I (1452) app_init: ELF file SHA256: 7034abebf...
-I (1453) app_init: ESP-IDF: v5.5.1
-I (1453) efuse_init: Min chip rev: v0.0
-I (1453) efuse_init: Max chip rev: v3.99
-I (1453) efuse_init: Chip rev: v0.0
-I (1454) heap_init: Initializing. RAM available for dynamic allocation:
-I (1455) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
-I (1455) heap_init: At 3FFB34A8 len 0002CB58 (178 KiB): DRAM
-I (1455) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
-I (1455) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
-I (1456) heap_init: At 4008E9B4 len 0001164C (69 KiB): IRAM
-I (1473) spi_flash: detected chip: gd
-I (1478) spi_flash: flash io: dio
-W (1482) spi_flash: Detected size(4096k) larger than the size in the binary image header(2048k). Using the size in the binary image header.
-I (1490) main_task: Started on CPU0
-I (1495) main_task: Calling app_main()
-I (1715) main_task: Returned from app_main()
-I (1717) uart: queue free spaces: 20
+I (664) boot: ESP-IDF v5.5.1 2nd stage bootloader
+I (665) boot: compile time Dec 27 2025 21:40:57
+I (665) boot: Multicore bootloader
+I (695) boot: chip revision: v0.0
+I (697) boot.esp32: SPI Speed : 40MHz
+I (697) boot.esp32: SPI Mode : DIO
+I (697) boot.esp32: SPI Flash Size : 2MB
+I (702) boot: Enabling RNG early entropy source...
+I (710) boot: Partition Table:
+I (710) boot: ## Label Usage Type ST Offset Length
+I (710) boot: 0 nvs WiFi data 01 02 00009000 00006000
+I (711) boot: 1 phy_init RF data 01 01 0000f000 00001000
+I (711) boot: 2 factory factory app 00 00 00010000 00100000
+I (714) boot: End of partition table
+I (740) esp_image: segment 0: paddr=00010020 vaddr=3f400020 size=0d234h ( 53812) map
+I (756) esp_image: segment 1: paddr=0001d25c vaddr=3ffb0000 size=02560h ( 9568) load
+I (768) esp_image: segment 2: paddr=0001f7c4 vaddr=40080000 size=00854h ( 2132) load
+I (781) esp_image: segment 3: paddr=00020020 vaddr=400d0020 size=1fee0h (130784) map
+I (804) esp_image: segment 4: paddr=0003ff08 vaddr=40080854 size=0e160h ( 57696) load
+I (820) esp_image: segment 5: paddr=0004e070 vaddr=50000000 size=00020h ( 32) load
+I (865) boot: Loaded app from partition at offset 0x10000
+I (865) boot: Disabling RNG early entropy source...
+I (877) cpu_start: Multicore app
+I (1457) cpu_start: Pro cpu start user code
+I (1458) cpu_start: cpu freq: 160000000 Hz
+I (1458) app_init: Application information:
+I (1459) app_init: Project name: arduino_to_esp
+I (1459) app_init: App version: 579e9f4
+I (1459) app_init: Compile time: Dec 27 2025 21:40:53
+I (1459) app_init: ELF file SHA256: e404303e1...
+I (1459) app_init: ESP-IDF: v5.5.1
+I (1460) efuse_init: Min chip rev: v0.0
+I (1460) efuse_init: Max chip rev: v3.99
+I (1460) efuse_init: Chip rev: v0.0
+I (1461) heap_init: Initializing. RAM available for dynamic allocation:
+I (1462) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
+I (1462) heap_init: At 3FFB34A8 len 0002CB58 (178 KiB): DRAM
+I (1462) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
+I (1462) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
+I (1463) heap_init: At 4008E9B4 len 0001164C (69 KiB): IRAM
+I (1480) spi_flash: detected chip: gd
+I (1483) spi_flash: flash io: dio
+W (1489) spi_flash: Detected size(4096k) larger than the size in the binary image header(2048k). Using the size in the binary image header.
+I (1497) main_task: Started on CPU0
+I (1507) main_task: Calling app_main()
+I (1740) main_task: Returned from app_main()
+I (1742) uart: queue free spaces: 20
I
T
W
@@ -64,35 +64,4 @@ O
R
K
S
-E (6717) task_wdt: Task watchdog got triggered. The following tasks/users did not reset the watchdog in time:
-E (6717) task_wdt: - IDLE1 (CPU 1)
-E (6717) task_wdt: Tasks currently running:
-E (6717) task_wdt: CPU 0: IDLE0
-E (6717) task_wdt: CPU 1: loopTask
-E (6717) task_wdt: Print CPU 1 backtrace
-
-
-Backtrace: 0x40083B4E:0x3FFB1730 0x40082A65:0x3FFB1750 0x400DBA68:0x3FFB77F0 0x400D89B1:0x3FFB7810 0x40086E35:0x3FFB7830
-
-E (11718) task_wdt: Task watchdog got triggered. The following tasks/users did not reset the watchdog in time:
-E (11718) task_wdt: - IDLE1 (CPU 1)
-E (11718) task_wdt: Tasks currently running:
-E (11718) task_wdt: CPU 0: IDLE0
-E (11718) task_wdt: CPU 1: loopTask
-E (11718) task_wdt: Print CPU 1 backtrace
-
-
-Backtrace: 0x40083B4E:0x3FFB1730 0x40082A65:0x3FFB1750 0x400EDCF5:0x3FFB7810 0x40086E35:0x3FFB7830
-
-E (16718) task_wdt: Task watchdog got triggered. The following tasks/users did not reset the watchdog in time:
-E (16718) task_wdt: - IDLE1 (CPU 1)
-E (16718) task_wdt: Tasks currently running:
-E (16718) task_wdt: CPU 0: IDLE0
-E (16718) task_wdt: CPU 1: loopTask
-E (16718) task_wdt: Print CPU 1 backtrace
-
-
-Backtrace: 0x40083B4E:0x3FFB1730 0x40082A65:0x3FFB1750 0x400DBA68:0x3FFB77F0 0x400D89B1:0x3FFB7810 0x40086E35:0x3FFB7830
-
-QEMU: Terminated
- \ No newline at end of file
+qemu-system-xtensa: terminating on signal 15 from pid 1797371 (bash)