Upgrade to Pro — share decks privately, control downloads, hide ads and more …

FMP on QEMU

FMP on QEMU

This slides describe how to run and debug the TOPPERS FMP real-time kernel on QEMU. The goal is to provide an easy environment for learning about the internals of the FMP kernel. This slides where used during the event 第 7 回 自作 OS もくもく会 (7th self-made OS meetup)

Daniel Sangorrin

July 02, 2017
Tweet

More Decks by Daniel Sangorrin

Other Decks in Programming

Transcript

  1. FMP on QEMU 第 7 回 自作 OS もくもく会 会場:東京日本橋タワー

    27 階 サイボウズ株式会社 @daromart http://sangorrin.blogspot.com/ https://github.com/sangorrin ダニエル
  2. whoami • スペイン人 • そして、名古屋人かも ^^ • 好きな言語 • Ada,

    C, ASM, Python • 仕事は Linux 関係 • 貢献した OSS • SafeG, MaRTE OS, FMP, Linux, QEMU
  3. Environment • Host: Ubuntu 16.04 • Dependencies • Downloads #

    apt-get install build-essential autoconf libtool \ gcc-arm-none-eabi gdb-arm-none-eabi qemu-system-arm $ export WORKSPACE=$HOME/qemu-fmp $ mkdir $WORKSPACE $ cd $WORKSPACE $ wget https://www.toppers.jp/download.cgi/cfg-linux-static-1_9_4.gz $ gunzip cfg-linux-static-1_9_4.gz $ git clone https://github.com/ryoon/toppers-fmp-for-qemu-vexpress-a9 $ cp cfg-linux-static-1_9_4 toppers-fmp-for-qemu-vexpress-a9/cfg/cfg/cfg
  4. Build and run FMP • Build (target/vexpressa9_gcc/README-EN.txt) • Run FMP

    on QEMU $ cd toppers-fmp-for-qemu-vexpress-a9/ $ mkdir -p obj/obj_sample $ cd obj/obj_sample $ perl ../../configure -T vexpressa9_gcc -f $ make realclean $ make ENABLE_G_SYSLOG=false PRC_NUM=4 KERNEL_FUNCOBJS= $ qemu-system-arm -cpu cortex-a9 -M vexpress-a9 -smp 4 -serial vc:80Cx40C \ -serial vc:80Cx40C -serial vc:80Cx40C -serial vc:80Cx40C -no-reboot \ -icount auto -m 1024M -kernel fmp $ Ctrl+Alt+4,5,6,7 for switching between each virtual console. $ qemu-system-arm -cpu cortex-a9 -M vexpress-a9 -smp 4 -serial vc:80Cx40C \ -serial vc:80Cx40C -serial vc:80Cx40C -serial vc:80Cx40C -no-reboot \ -icount auto -m 1024M -kernel fmp $ Ctrl+Alt+4,5,6,7 for switching between each virtual console.
  5. Debugging FMP on QEMU • Rebuild and run with -s

    -S • Debug $ make realclean $ make ENABLE_G_SYSLOG=false PRC_NUM=1 KERNEL_FUNCOBJS= OMIT_OPTIMIZATION=true $ qemu-system-arm -cpu cortex-a9 -M vexpress-a9 -smp 1 -serial vc:80Cx40C \ -serial vc:80Cx40C -serial vc:80Cx40C -serial vc:80Cx40C -no-reboot \ -icount auto -m 1024M -kernel fmp -s -S $ arm-none-eabi-gdb fmp target remote localhost:1234 break sta_ker
  6. Example Debugging session $ arm-none-eabi-gdb fmp target remote localhost:1234 break

    sta_ker c tui enable set target-charset EUC-JP n next s step v info locals u up f finish w where b task c b sample1.c:723 terminate and activate the task print *p_tcb bt info reg info all-reg info reg r5 x/1uw 0x60024508 print _kernel_prc1_pcb