mch2022-talktopics/qemu.sh
2022-04-08 23:15:57 +02:00

25 lines
661 B
Bash
Executable file

#!/usr/bin/env bash
set -e
set -u
export IDF_PATH="$PWD/esp-idf"
export IDF_EXPORT_QUIET=0
source "$IDF_PATH"/export.sh
cd build
# Create an empty file, 16MB in size
dd if=/dev/zero bs=1M count=16 of=flash.bin
# Copy the bootloader into the file
dd if=bootloader/bootloader.bin bs=1 seek=$((0x1000)) of=flash.bin conv=notrunc
# Copy the partition table into the file
dd if=partition_table/partition-table.bin bs=1 seek=$((0x9000)) of=flash.bin conv=notrunc
# Copy the firmware into the file
dd if=main.bin bs=1 seek=$((0x10000)) of=flash.bin conv=notrunc
# Run QEMU
qemu-system-xtensa -nographic -machine esp32 -drive 'file=flash.bin,if=mtd,format=raw'