http://beckus.github.io/qemu_stm32/
https://github.com/beckus/qemu_stm32
the sources are somewhat old but someone has contributed a 'machine' for stm32f103, back in the times during old stm32duino forums i think.
the emulation features are rather rudimentary, mainly providing text output on the command line
an emulation session looks like this:
I don't think usb-serial is there but it seemed hardware uart is implemented, i've not tried out that.> arm-softmmu/qemu-system-arm -machine stm32-f103c8 -kernel image.bin -s
STM32_UART: ADC1 clock is set to 0 Hz.
STM32_UART: ADC1 BRR set to 0.
STM32_UART: ADC1 Baud is set to 0 bits per sec.
STM32_UART: ADC2 clock is set to 0 Hz.
STM32_UART: ADC2 BRR set to 0.
...
CLKTREE: HSI Output Change (SrcClk:None InFreq:8000000 OutFreq:8000000 Mul:1 Div:1 Enabled:1)
CLKTREE: HSI/2 Output Change (SrcClk:HSI InFreq:8000000 OutFreq:4000000 Mul:1 Div:2 Enabled:1)
CLKTREE: SYSCLK Output Change (SrcClk:HSI InFreq:8000000 OutFreq:8000000 Mul:1 Div:1 Enabled:1)
...
LED On
LED Off
LED On
LED Off
gdb connects and i'm able to step the instructions, it apparently works even if the usb-dfu stm32duino bootloader is installed before it.
i need to use this shell script to patch the bins together into a single file
Code: Select all
if [ "$1" == "" ]; then
echo $0 binfile.bin
exit 0
fi
dd if=/dev/zero bs=1024 count=128 of=image.bin
dd if=maple_mini_boot20.bin bs=1024 conv=nocreat,notrunc of=image.bin
dd if=$1 bs=1024 conv=nocreat,notrunc seek=8 of=image.bin
https://github.com/pebble/qemu
this is more complete and apparently has F2 and F4 support but is based around pebble obviously
the sources of qemu is huge and pretty complex, i've not gotten a grasp of that
but it seem to be in the hw/arm folder
https://github.com/pebble/qemu/tree/master/hw/arm
https://github.com/pebble/qemu/blob/mas ... m/pebble.c
https://github.com/pebble/qemu/blob/mas ... tm32f1xx.c
https://github.com/pebble/qemu/blob/mas ... tm32f4xx.c
these emulators normally won't be able to handle real time time sensitive stuff, but i'm not too sure if it could help to debug those complicated memory and such problems. i've not tried out the pebble repository but that seem to be a better qemu stm32 implementation