Currently it models RAM/ROM areas, has simple UART and hard-coded RTC and GPIO. See hw/xtensa/esp8266.c for more details.
It may be useful for those who'd like to use debugger to see how firmware works. crosstool-NG is updated for gdb building.
Patches and pointers to hardware documentation are welcome.
I have two issues though.
$ ./configure --prefix=$HOME --target-list=xtensa-softmmu
$ make install
$ qemu-system-xtensa -machine esp8266 -nographic -kernel ../arduino-sketch/app.out -S -s
It seems to run, but I can't get any output on serial0. I tried os_sprintf with and without ets_install_putc1. Do you have any sample code that writes to serial successfully? I know serial works because if I run qemu without -kernel argument I get two lines from the bootloader.
There is another issue with gdb (maybe it's related to running in on OS X):
$ ../xtensa-lx106-elf/bin/xtensa-lx106-elf-gdb
GNU gdb (crosstool-NG 1.20.0) 7.5.1
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=x86_64-build_apple-darwin14.0.0 --target=xtensa-lx106-elf".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
(gdb) target remote :1234
Remote debugging using :1234
Remote 'g' packet reply is too long: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000400000000000000000fada8cc2f6b682101f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000
(gdb)
I've found people having similar problems and solving them by building gdb with expat support. Can crosstool-NG be guided to configure gdb with expat support?
igrr wrote:Thanks jcmvbkbc for your effort. Qemu + gdb is just the thing i need for the code i am about to write.
I have two issues though.Code: Select all$ ./configure --prefix=$HOME --target-list=xtensa-softmmu
$ make install
$ qemu-system-xtensa -machine esp8266 -nographic -kernel ../arduino-sketch/app.out -S -s
Great, you've figured out all parts correctly!
igrr wrote:It seems to run, but I can't get any output on serial0. I tried os_sprintf with and without ets_install_putc1. Do you have any sample code that writes to serial successfully? I know serial works because if I run qemu without -kernel argument I get two lines from the bootloader.
The bootloader uses ets_printf, should work in user code as well. Haven't tried myself, will try when I get some free time, maybe later today.
igrr wrote:There is another issue with gdb (maybe it's related to running in on OS X):Code: Select all(gdb) target remote :1234
Remote debugging using :1234
Remote 'g' packet reply is too long:
Arrgh (: Thanks for the report! The gdb built with the crosstool doesn't have privileged registers definitions fixed, and I used gdb built with my other tool. I've fixed lx106 overlay in the crosstool and checked that now it successfully connects to qemu.