Using QEMU to Develop Piko/RT

Prepare QEMU

You will need to prepare QEMU STM32 emulator from: QEMU STM32 v0.1.3

After download, compile the qemu_stm32 by:

$ ./configure --disable-werror --enable-debug \
        --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=-DSTM32_UART_ENABLE_OVERRUN --python=python2
$ make -j8

Make sure you have export the arm-softmmu to $PATH``:

$ export PATH=$PATH:~/qemu_stm32-stm32_v0.1.3/arm-softmmu

Run Piko/RT on QEMU STM32-p103

You will need to run these command:

$ make PLAT=stm32p103
$ make PLAT=stm32p103 run

If you run correctly, then you will start Piko/RT and get the shell:

Memory map:
  .text   = 00000140--0000315a   12314 Bytes
  .rodata = 00003190--00003a26    2198 Bytes
  .data   = 20000000--20000514    1300 Bytes
  .bss    = 20000518--20001298    3456 Bytes
  .heap   = 200012a0--200022a0    4096 Bytes
  .pgmem  = 20008000--2000f000   28672 Bytes
Order  Bitmap
    0  00000000  00000000  00000000  00000000
    1  00000000  00000000
    2  00000000
    3  00007fff
Created idle_thread at <0x20008200>
Created main_thread at <0x20008800> with priority=31
Reclaim early stack's physical memory (2048 Bytes, order=3).
Creating /proc/version
Creating /proc/meminfo
Creating /dev/mem
Creating /dev/null
Creating /dev/zero
Creating /dev/random
Creating MTD device mtd0
Kernel bootstrap done.
--

$