Tests with qemu for esp32
C C++ Python Shell Haxe Assembly Other
Switch branches/tags
Nothing to show
Clone or download
Permalink
Failed to load latest commit information.
.vscode More straight data Apr 4, 2017
audio first commit Dec 5, 2016
backends first commit Dec 5, 2016
block first commit Dec 5, 2016
bsd-user first commit Dec 5, 2016
contrib first commit Dec 5, 2016
crypto first commit Dec 5, 2016
default-configs Added STM32 emulation Feb 14, 2018
disas first commit Dec 5, 2016
docs first commit Dec 5, 2016
dtc @ 8f70ac3 Readded dtc submodule Dec 5, 2016
fpu first commit Dec 5, 2016
fsdev first commit Dec 5, 2016
gdb-xml first commit Dec 5, 2016
hw Return better values for mbed initialisation Apr 30, 2018
include Added rak811 board emulation Feb 15, 2018
io first commit Dec 5, 2016
libdecnumber first commit Dec 5, 2016
linux-headers first commit Dec 5, 2016
linux-user first commit Dec 5, 2016
migration first commit Dec 5, 2016
nbd first commit Dec 5, 2016
net first commit Dec 5, 2016
pc-bios first commit Dec 5, 2016
po first commit Dec 5, 2016
qapi first commit Dec 5, 2016
qga first commit Dec 5, 2016
qobject first commit Dec 5, 2016
qom first commit Dec 5, 2016
replay first commit Dec 5, 2016
roms first commit Dec 5, 2016
scripts first commit Dec 5, 2016
slirp first commit Dec 5, 2016
stubs first commit Dec 5, 2016
target-alpha first commit Dec 5, 2016
target-arm Added STM32 emulation Feb 14, 2018
target-cris first commit Dec 5, 2016
target-i386 first commit Dec 5, 2016
target-lm32 first commit Dec 5, 2016
target-m68k first commit Dec 5, 2016
target-microblaze first commit Dec 5, 2016
target-mips first commit Dec 5, 2016
target-moxie first commit Dec 5, 2016
target-openrisc first commit Dec 5, 2016
target-ppc first commit Dec 5, 2016
target-s390x first commit Dec 5, 2016
target-sh4 first commit Dec 5, 2016
target-sparc first commit Dec 5, 2016
target-tilegx first commit Dec 5, 2016
target-tricore first commit Dec 5, 2016
target-unicore32 first commit Dec 5, 2016
target-xtensa Merged handle unknown registers in gdbstub from head Jul 7, 2017
tcg first commit Dec 5, 2016
tests first commit Dec 5, 2016
trace first commit Dec 5, 2016
ui first commit Dec 5, 2016
util Return better values for mbed initialisation Apr 30, 2018
.dir-locals.el first commit Dec 5, 2016
.exrc first commit Dec 5, 2016
.gitignore first commit Dec 5, 2016
.gitmodules Readded dtc submodule Dec 5, 2016
.mailmap first commit Dec 5, 2016
.travis.yml first commit Dec 5, 2016
CMakeLists.txt Added STM32 emulation Feb 14, 2018
CODING_STYLE first commit Dec 5, 2016
COPYING first commit Dec 5, 2016
COPYING.LIB first commit Dec 5, 2016
Changelog first commit Dec 5, 2016
HACKING first commit Dec 5, 2016
LICENSE first commit Dec 5, 2016
MAINTAINERS first commit Dec 5, 2016
Makefile first commit Dec 5, 2016
Makefile.objs first commit Dec 5, 2016
Makefile.target first commit Dec 5, 2016
README Added missing WUR & RUR instructions. Dec 5, 2016
README.md raspi3 updates Feb 14, 2018
VERSION first commit Dec 5, 2016
accel.c first commit Dec 5, 2016
aio-posix.c first commit Dec 5, 2016
aio-win32.c first commit Dec 5, 2016
arch_init.c first commit Dec 5, 2016
async.c first commit Dec 5, 2016
balloon.c first commit Dec 5, 2016
block.c first commit Dec 5, 2016
blockdev-nbd.c first commit Dec 5, 2016
blockdev.c first commit Dec 5, 2016
blockjob.c first commit Dec 5, 2016
bootdevice.c first commit Dec 5, 2016
bt-host.c first commit Dec 5, 2016
bt-vhci.c first commit Dec 5, 2016
configure first commit Dec 5, 2016
cpu-exec-common.c first commit Dec 5, 2016
cpu-exec.c first commit Dec 5, 2016
cpus.c first commit Dec 5, 2016
cputlb.c first commit Dec 5, 2016
device-hotplug.c first commit Dec 5, 2016
device_tree.c first commit Dec 5, 2016
disas.c first commit Dec 5, 2016
dma-helpers.c first commit Dec 5, 2016
dump.c first commit Dec 5, 2016
exec.c first commit Dec 5, 2016
gdbstub.c first commit Dec 5, 2016
hmp-commands-info.hx first commit Dec 5, 2016
hmp-commands.hx first commit Dec 5, 2016
hmp.c first commit Dec 5, 2016
hmp.h first commit Dec 5, 2016
iohandler.c first commit Dec 5, 2016
ioport.c first commit Dec 5, 2016
iothread.c first commit Dec 5, 2016
kvm-all.c first commit Dec 5, 2016
kvm-stub.c first commit Dec 5, 2016
main-loop.c first commit Dec 5, 2016
memory.c first commit Dec 5, 2016
memory_mapping.c first commit Dec 5, 2016
module-common.c first commit Dec 5, 2016
monitor.c first commit Dec 5, 2016
numa.c first commit Dec 5, 2016
os-posix.c first commit Dec 5, 2016
os-win32.c first commit Dec 5, 2016
page_cache.c first commit Dec 5, 2016
pebble.py Added STM32 emulation Feb 14, 2018
pebble_dbgserial.sh Added STM32 emulation Feb 14, 2018
qapi-schema.json first commit Dec 5, 2016
qdev-monitor.c first commit Dec 5, 2016
qdict-test-data.txt first commit Dec 5, 2016
qemu-bridge-helper.c first commit Dec 5, 2016
qemu-char.c first commit Dec 5, 2016
qemu-doc.texi first commit Dec 5, 2016
qemu-ga.texi first commit Dec 5, 2016
qemu-img-cmds.hx first commit Dec 5, 2016
qemu-img.c first commit Dec 5, 2016
qemu-img.texi first commit Dec 5, 2016
qemu-io-cmds.c first commit Dec 5, 2016
qemu-io.c first commit Dec 5, 2016
qemu-nbd.c first commit Dec 5, 2016
qemu-nbd.texi first commit Dec 5, 2016
qemu-option-trace.texi first commit Dec 5, 2016
qemu-options-wrapper.h first commit Dec 5, 2016
qemu-options.h first commit Dec 5, 2016
qemu-options.hx first commit Dec 5, 2016
qemu-seccomp.c first commit Dec 5, 2016
qemu-tech.texi first commit Dec 5, 2016
qemu-timer.c first commit Dec 5, 2016
qemu.nsi first commit Dec 5, 2016
qemu.sasl first commit Dec 5, 2016
qmp-commands.hx first commit Dec 5, 2016
qmp.c first commit Dec 5, 2016
qtest.c first commit Dec 5, 2016
rules.mak first commit Dec 5, 2016
softmmu_template.h first commit Dec 5, 2016
spice-qemu-char.c first commit Dec 5, 2016
tcg-runtime.c first commit Dec 5, 2016
tci.c first commit Dec 5, 2016
thread-pool.c first commit Dec 5, 2016
thunk.c first commit Dec 5, 2016
tpm.c first commit Dec 5, 2016
trace-events first commit Dec 5, 2016
translate-all.c first commit Dec 5, 2016
translate-all.h first commit Dec 5, 2016
translate-common.c first commit Dec 5, 2016
user-exec.c first commit Dec 5, 2016
version.rc first commit Dec 5, 2016
vl.c first commit Dec 5, 2016
xen-common-stub.c first commit Dec 5, 2016
xen-common.c first commit Dec 5, 2016
xen-hvm-stub.c first commit Dec 5, 2016
xen-hvm.c first commit Dec 5, 2016
xen-mapcache.c first commit Dec 5, 2016

README.md

ESP32 & Pebble Smartwatch QEMU Implementation

To learn about ARM and STM32

./qemu-system-arm -serial file:uart1.log -serial tcp::12344,server,nowait -serial tcp::12345,server,nowait -monitor stdio -machine pebble-bb2 -cpu cortex-m3 -S -s -pflash .pioenvs/rak811/firmware.bin

Overview

This is originaly the ESP32 qenu with added arm emulation STM32F2xx microcontroller. This is based off of a QEMU fork that is targeting the STM32F103: https://github.com/beckus/qemu_stm32. This repo contains both beckus' STM32F1xx implementation and Pebble's STM32F2xx additions.

Configure for ESP32

Dont do in source builds, try mkdir qemu_esp32

../qemu-xtensa-esp32/configure --disable-werror --prefix=`pwd`/root --target-list=xtensa-softmmu,xtensaeb-softmmu

Configure for STM32 boards

mkdir arm_stm32;cd arm_stm32
../qemu-xtensa-esp32/configure --disable-werror --enable-debug --target-list="arm-softmmu"         --extra-cflags=-DSTM32_UART_NO_BAUD_DELAY

git submodule update --init dtc

If python3 is default on your system

--python=/usr/bin/python2

Raspberry pi 3 emulation

From here https://github.com/bztsrc/qemu-raspi3 https://github.com/bztsrc/qemu-raspi3/tree/patches https://www.raspberrypi.org/forums/viewtopic.php?f=72&t=195565&sid=273f86dd05fa186e3c690cf065a37c78&start=25 wget https://github.com/bztsrc/raspi3-tutorial/raw/master/09_framebuffer/kernel8.img

../qemu-xtensa-esp32/configure --target-list=aarch64-softmmu --enable-modules --enable-tcg-interpreter --enable-debug-tcg --disable-werror --python=/usr/bin/python2.7

make -j4

qemu-system-aarch64 -M raspi3 -kernel kernel8.img -serial stdio

Note sure that this works in this tree, need to doublecheck the patches

NOTE: This is very much a work-in-progress! Only some of the peripherals are working at the moment. Please contribute!

Dependencies

QEMU requires that development packages for glib20 and pixman are installed.

FreeBSD

Install the devel/glib20 and x11/pixman ports.

Linux

Mac OS X

Windows

Building

Commands for a typical build:

    ../qemu-xtensa-esp32/configure --disable-werror --enable-debug --target-list="arm-softmmu" 
    --extra-cflags=-DSTM32_UART_NO_BAUD_DELAY
    make

Summary set of configure options that are useful when developing (tested only on OS X 10.9.5):

    ./configure --enable-tcg-interpreter --extra-ldflags=-g \
    --with-coroutine=gthread --enable-debug-tcg --enable-cocoa \
    --enable-debug --disable-werror --target-list="arm-softmmu" \
    --extra-cflags=-DDEBUG_CLKTREE --extra-cflags=-DDEBUG_STM32_RCC \
    --extra-cflags=-DDEBUG_STM32_UART --extra-cflags=-DSTM32_UART_NO_BAUD_DELAY \
    --extra-cflags=-DDEBUG_GIC 

Configure options which control the STM32 implementation:

--extra-cflags=-DDEBUG_CLKTREE
    Print out clock tree debug statements.

--extra-cflags=-DDEBUG_STM32_RCC
    Print RCC debug statements.

--extra-cflags=-DDEBUG_STM32_UART
    Print UART debug statements.

--extra-cflags=-DSTM32_UART_NO_BAUD_DELAY
    Disable the BAUD rate timing simulation
    (i.e. the UART will transmit or receive as fast as possible, rather than
    using a realistic delay).

--extra-cflags=-DSTM32_UART_ENABLE_OVERRUN
    Enable setting of the overrun flag if a character is
    received before the last one is processed.  If this is not set, the UART
    will not receive the next character until the previous one is read by
    software.  Although less realisitic, it is safer NOT to use this, in case the VM is
    running slow.

####Other QEMU configure options which are useful for troubleshooting: --extra-cflags=-DDEBUG_GIC Extra logging around which interrupts are asserted

####qemu-system-arm options which are useful for troubleshooting: -d ? To see available log levels

-d cpu,in_asm
    Enable logging to view the CPU state during execution and the ARM
    instructions which are being executed.  I believe --enable-debug must be
    used for this to work.

Useful make commands when rebuilding:

    make defconfig
    make clean

Generating Images

  • Use ./waf build qemu_image_spi to generate qemu_spi_flash.bin from tintin.
  • Use ./waf build qemu_image_micro to generate qemu_micro_flash.bin from tintin.

Under the covers of the images

QEMU's -pflash argument is used to specify a file to use as the micro flash. An image can be created by concatenating the boot and main firmware files, like so:

truncate -s 64k tintin_boot.bin
cat tintin_boot.bin tintin_fw.bin > micro_flash.bin
truncate -s 512k micro_flash.bin

Running

There is a convenience script pebble.sh that runs QEMU. It depends on the existence of (symlinked) images qemu_micro_flash.bin and qemu_spi_flash.bin.

More details about running QEMU

The generated executable is arm-softmmu/qemu-system-arm .

Example:

    qemu-system-arm -rtc base=localtime -machine pebble-bb2 -cpu cortex-m3 -s \
    -pflash qemu_micro_flash.bin -mtdblock qemu_spi_flash.bin 

Adding -S to the commandline will have QEMU wait in the monitor at start; the _c_ontinue command is necessary to start the virtual CPU.

QEMU Docs

Read original the documentation in qemu-doc.html or on http://wiki.qemu.org

QEMU Modifications

This emulator consists largely of new hardware device models; it includes only minor changes to existing QEMU functionality.

The changes can be reviewed by running git diff --diff-filter=M v1.5.0-backports.

To list the added files, use git diff --name-only --diff-filter=A v1.5.0-backports.

License

The following points clarify the QEMU license:

  1. QEMU as a whole is released under the GNU General Public License

  2. Parts of QEMU have specific licenses which are compatible with the GNU General Public License. Hence each source file contains its own licensing information.

Many hardware device emulation sources are released under the BSD license.

  1. The Tiny Code Generator (TCG) is released under the BSD license (see license headers in files).

  2. QEMU is a trademark of Fabrice Bellard.