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

User avatar
By jcmvbkbc
#9596
Slaff wrote:I was able to compile qemu but I do not know what to do next to compile and test my custom applications. Can someone give me step by step hints?

This page can give you an idea of what you can do: http://wiki.linux-xtensa.org/index.php/Xtensa_on_QEMU
Just compile and link your firmware with -g and pass the resulting elf file (not bin files!) to QEMU in -kernel parameter.
You'll need a touch of magic to step over the initial user code that maps FLASH into memory space, as this piece of hardware is currently not implemented and the firmware will hang on attempt to access it. Feel free to figure out what's missing and post a fix for it.
The short video of the very basics (building QEMU, connecting to it with gdb) here: http://jcmvbkbc.spb.ru/~dumb/tmp/qemu-s ... sp8266.ogv
User avatar
By 0xPIT
#21251 Hi,

currently trying your Qemu port on Mac OS X 10.10.3.
Any idea about the cause for the following compile error:

Code: Select allUndefined symbols for architecture x86_64:
  "_load_device_tree", referenced from:
      _lx_init in xtfpga.o
ld: symbol(s) not found for architecture x86_64


Find the complete compiler invocation below.

Thanks!



Code: Select allc++ -I/usr/local/Cellar/pixman/0.32.6/include/pixman-1   -m64 -DOS_OBJECT_USE_OBJC=0 -arch x86_64 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common  -Wno-string-plus-int -Wno-initializer-overrides -Wendif-labels -Wmissing-include-dirs -Wempty-body -Wnested-externs -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wold-style-definition -Wtype-limits -fstack-protector-strong   -I/usr/local/Cellar/libpng/1.6.16/include/libpng16  -I/usr/local/Cellar/libusb/1.0.19/include/libusb-1.0   -I.. -I/Users/pit/Development/git/ESP8266/qemu-xtensa/target-xtensa -DNEED_CPU_H -I/Users/pit/Development/git/ESP8266/qemu-xtensa/include -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -D_REENTRANT -I/usr/local/Cellar/glib/2.42.2/include/glib-2.0 -I/usr/local/Cellar/glib/2.42.2/lib/glib-2.0/include -I/usr/local/opt/gettext/include  -g  -m64 -framework CoreFoundation -framework IOKit -arch x86_64 -g   -o qemu-system-xtensa exec.o translate-all.o cpu-exec.o tcg/tcg.o tcg/tcg-op.o tcg/optimize.o fpu/softfloat.o disas.o kvm-stub.o arch_init.o cpus.o monitor.o gdbstub.o balloon.o ioport.o numa.o qtest.o bootdevice.o memory.o savevm.o cputlb.o memory_mapping.o dump.o xen-common-stub.o xen-hvm-stub.o hw/net/vhost_net.o hw/xtensa/pic_cpu.o hw/xtensa/sim.o hw/xtensa/xtfpga.o target-xtensa/xtensa-semi.o target-xtensa/core-dc232b.o target-xtensa/core-dc233c.o target-xtensa/core-fsf.o target-xtensa/translate.o target-xtensa/op_helper.o target-xtensa/helper.o target-xtensa/cpu.o target-xtensa/gdbstub.o ../blockdev.o ../blockdev-nbd.o ../iothread.o ../qdev-monitor.o ../device-hotplug.o ../os-posix.o ../qemu-char.o ../page_cache.o ../qjson.o ../accel.o ../bt-host.o ../bt-vhci.o ../dma-helpers.o ../vl.o ../tpm.o ../qmp-marshal.o ../qmp.o ../hmp.o ../qemu-log.o ../tcg-runtime.o ../audio/audio.o ../audio/noaudio.o ../audio/wavaudio.o ../audio/mixeng.o ../audio/coreaudio.o ../audio/wavcapture.o ../backends/rng.o ../backends/rng-egd.o ../backends/rng-random.o ../backends/msmouse.o ../backends/testdev.o ../backends/tpm.o ../backends/hostmem.o ../backends/hostmem-ram.o ../block/stream.o ../block/commit.o ../block/backup.o ../disas/i386.o ../hw/block/block.o ../hw/block/cdrom.o ../hw/block/hd-geometry.o ../hw/block/pflash_cfi01.o ../hw/bt/core.o ../hw/bt/l2cap.o ../hw/bt/sdp.o ../hw/bt/hci.o ../hw/bt/hid.o ../hw/bt/hci-csr.o ../hw/char/serial.o ../hw/char/serial-isa.o ../hw/core/qdev.o ../hw/core/qdev-properties.o ../hw/core/fw-path-provider.o ../hw/core/irq.o ../hw/core/hotplug.o ../hw/core/nmi.o ../hw/core/sysbus.o ../hw/core/machine.o ../hw/core/null-machine.o ../hw/core/loader.o ../hw/core/qdev-properties-system.o ../hw/i2c/core.o ../hw/i2c/smbus.o ../hw/i2c/smbus_eeprom.o ../hw/input/hid.o ../hw/input/ps2.o ../hw/isa/isa-bus.o ../hw/net/opencores_eth.o ../hw/nvram/eeprom93xx.o ../hw/nvram/fw_cfg.o ../hw/pci/pci-stub.o ../hw/pcmcia/pcmcia.o ../hw/scsi/scsi-disk.o ../hw/scsi/scsi-generic.o ../hw/scsi/scsi-bus.o ../hw/usb/core.o ../hw/usb/combined-packet.o ../hw/usb/bus.o ../hw/usb/libhw.o ../hw/usb/host-libusb.o ../hw/usb/host-legacy.o ../hw/watchdog/watchdog.o ../migration/migration.o ../migration/tcp.o ../migration/vmstate.o ../migration/qemu-file.o ../migration/qemu-file-buf.o ../migration/qemu-file-unix.o ../migration/qemu-file-stdio.o ../migration/xbzrle.o ../migration/exec.o ../migration/unix.o ../migration/fd.o ../migration/block.o ../net/net.o ../net/queue.o ../net/checksum.o ../net/util.o ../net/hub.o ../net/socket.o ../net/dump.o ../net/eth.o ../net/tap.o ../net/vhost-user.o ../net/tap-bsd.o ../net/slirp.o ../qom/object.o ../qom/container.o ../qom/qom-qobject.o ../qom/cpu.o ../qom/object_interfaces.o ../slirp/cksum.o ../slirp/if.o ../slirp/ip_icmp.o ../slirp/ip_input.o ../slirp/ip_output.o ../slirp/dnssearch.o ../slirp/slirp.o ../slirp/mbuf.o ../slirp/misc.o ../slirp/sbuf.o ../slirp/socket.o ../slirp/tcp_input.o ../slirp/tcp_output.o ../slirp/tcp_subr.o ../slirp/tcp_timer.o ../slirp/udp.o ../slirp/bootp.o ../slirp/tftp.o ../slirp/arp_table.o ../ui/keymaps.o ../ui/console.o ../ui/cursor.o ../ui/qemu-pixman.o ../ui/input.o ../ui/input-keymap.o ../ui/input-legacy.o ../ui/cocoa.o ../ui/curses.o ../ui/vnc.o ../ui/d3des.o ../ui/vnc-enc-zlib.o ../ui/vnc-enc-hextile.o ../ui/vnc-enc-tight.o ../ui/vnc-palette.o ../ui/vnc-enc-zrle.o ../ui/vnc-auth-sasl.o ../ui/vnc-jobs.o trace/generated-helpers.o ../async.o ../thread-pool.o ../nbd.o ../block.o ../blockjob.o ../main-loop.o ../iohandler.o ../qemu-timer.o ../aio-posix.o ../qemu-io-cmds.o ../qemu-coroutine.o ../qemu-coroutine-lock.o ../qemu-coroutine-io.o ../qemu-coroutine-sleep.o ../coroutine-sigaltstack.o ../block/raw_bsd.o ../block/qcow.o ../block/vdi.o ../block/vmdk.o ../block/cloop.o ../block/dmg.o ../block/bochs.o ../block/vpc.o ../block/vvfat.o ../block/qcow2.o ../block/qcow2-refcount.o ../block/qcow2-cluster.o ../block/qcow2-snapshot.o ../block/qcow2-cache.o ../block/qed.o ../block/qed-gencb.o ../block/qed-l2-cache.o ../block/qed-table.o ../block/qed-cluster.o ../block/qed-check.o ../block/vhdx.o ../block/vhdx-endian.o ../block/vhdx-log.o ../block/parallels.o ../block/blkdebug.o ../block/blkverify.o ../block/block-backend.o ../block/snapshot.o ../block/qapi.o ../block/raw-posix.o ../block/null.o ../block/mirror.o ../block/nbd.o ../block/nbd-client.o ../block/sheepdog.o ../block/accounting.o ../block/write-threshold.o ../block/curl.o  ../libqemuutil.a ../libqemustub.a  -lz -lbz2 -lcurl -L/usr/local/Cellar/glib/2.42.2/lib -L/usr/local/opt/gettext/lib -lgthread-2.0 -lglib-2.0 -lintl   -lz -L/usr/local/Cellar/pixman/0.32.6/lib -lpixman-1  -lncurses -framework CoreAudio -L/usr/local/Cellar/libpng/1.6.16/lib -lpng16  -ljpeg -lsasl2 -F/System/Library/Frameworks -framework Cocoa -framework IOKit   -L/usr/local/Cellar/libusb/1.0.19/lib -lusb-1.0

Undefined symbols for architecture x86_64:
  "_load_device_tree", referenced from:
      _lx_init in xtfpga.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [qemu-system-xtensa] Error 1
make: *** [subdir-xtensa-softmmu] Error 2

theseus:qemu-xtensa pit$ grep -r _load_device_tree *
hw/ppc/e500.c:static int ppce500_load_device_tree(MachineState *machine,
hw/ppc/e500.c:    ppce500_load_device_tree(p->machine, &p->params, p->addr, p->initrd_base,
hw/ppc/e500.c:    return ppce500_load_device_tree(machine, params, addr, initrd_base,
hw/ppc/ppc440_bamboo.c:static int bamboo_load_device_tree(hwaddr addr,
hw/ppc/ppc440_bamboo.c:        if (bamboo_load_device_tree(FDT_ADDR, ram_size, RAMDISK_ADDR,
hw/ppc/virtex_ml507.c:static int xilinx_load_device_tree(hwaddr addr,
hw/ppc/virtex_ml507.c:        xilinx_load_device_tree(boot_info.fdt, ram_size,
Binary file xtensa-softmmu/hw/xtensa/xtfpga.o matches
theseus:qemu-xtensa pit$ grep -r _lx_init *
hw/sparc/sun4m.c:static void ss_lx_init(MachineState *machine)
hw/sparc/sun4m.c:    .init = ss_lx_init,
Binary file xtensa-softmmu/hw/xtensa/xtfpga.o matches