Discuss here different C compiler set ups, and compiling executables for the ESP8266

User avatar
By pietrushnic
#26134 Thanks. I assume that timer should be next thing.

When I will find some free time I will take a look at hw_timer.c API from Espressif SDK. If you have any pointers that can help with implementation please let me know.
User avatar
By kolban
#30123 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?

Neil
User avatar
By jcmvbkbc
#30147 Hi 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
Code: Select allqemu-system-xtensa -M esp8266 -nographic -serial stdio -monitor none -s
and you should be able to attach to it with gdb with 'target remote :1234'.

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):
Code: Select allcat ${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.
User avatar
By TerryE
#30403 Another useful link is QEMU support for Xtensa [Open Source & Linux Lab]. It's one of the links referred to, but the actual link was broken.