Follow these steps to set up an M5Stack Cardputer emulator on Linux and test MicroPython code before deployment.
sudo apt update
sudo apt install git wget flex bison gperf python3 python3-pip python3-setuptools cmake ninja-build ccache libffi-dev libssl-dev dfu-util libusb-1.0-0
mkdir -p ~/esp
cd ~/esp
git clone --recursive https://github.com/espressif/esp-idf.git
cd ~/esp/esp-idf
./install.sh
. ./export.sh
git clone https://github.com/espressif/qemu.git
cd qemu
./configure --target-list=xtensa-softmmu
make
sudo make install
git clone https://github.com/micropython/micropython.git
cd micropython
git submodule update --init
cd ports/esp32
make submodules
make
qemu-system-xtensa -nographic -M esp32 -m 4M -drive file=build-GENERIC/firmware.bin,if=mtd,format=raw
main.py
:
print("Hello, M5Stack Cardputer!")
qemu-system-xtensa -nographic -M esp32 -m 4M -drive file=build-GENERIC/firmware.bin,if=mtd,format=raw -s -S
xtensa-esp32-elf-gdb -ex "target remote localhost:1234" -ex "symbol-file build-GENERIC/application.elf"
monitor load "main.py"
monitor start
For a more accurate emulation of the M5Stack Cardputer, you may need to configure specific peripherals and interfaces based on the hardware features listed in the provided documents.