In my world, I am using @CHERTS distribution of xtensa-gcc running on Windows. I'd like to do some source level debugging of my apps.
My ideal desire would be to download and install some pre-built Windows executables (that I believe would be Qemu with ESP8266 support) and run them pointing at my ELF binaries or Flash images. At that point, I am imagining that I could attach a GDB debugger and start stepping through my code. At least that is the vision I have in my mind.
Is there a recommended path to get to this goal?
Neil
kolban wrote:Is there a cheat sheet (or at least a guided reading list) for getting going using Qemu for ESP8266?
In my world, I am using @CHERTS distribution of xtensa-gcc running on Windows. I'd like to do some source level debugging of my apps.
My ideal desire would be to download and install some pre-built Windows executables (that I believe would be Qemu with ESP8266 support) and run them pointing at my ELF binaries or Flash images. At that point, I am imagining that I could attach a GDB debugger and start stepping through my code. At least that is the vision I have in my mind.
Is there a recommended path to get to this goal?
A page with generic QEMU help links: http://wiki.qemu.org/Qemu-doc.html
I followed these instructions to build qemu-system-xtensa with esp8266 support for win32. I didn't run any tests on it, just checked that it's able to start.
According to other information from that page QEMU has file-based interface on windows, e.g. it writes its output to stdout.txt and stderr.txt
I've put the archive with binaries for win32 here.
You should be able to start esp8266 ROM with
qemu-system-xtensa -M esp8266 -nographic -serial stdio -monitor none -s
This version of esp8266 model in QEMU can't run ELF files given to it in -kernel option, it needs complete FLASH image.
That is, if you dumped your entire FLASH into a file, that file may be given to qemu with -kernel option. Normally flashing tools generate parts of FLASH image, they need to be combined into a single file and be placed there at correct offsets. On linux I do it like that (having ${NAME}-0x00000.bin and ${NAME}-0x40000.bin files as input):
cat ${NAME}-0x00000.bin /dev/zero | head -c $(( 0x40000 )) | cat - ${NAME}-0x40000.bin > flash
That said, esp8266 model in QEMU lacks a lot of peripherals and existing peripheral models are incomplete. In its current shape it's hardly suitable for generic application debugging, more for hardware/ROM/SDK reverse engineering.