QEMU i.MX6 (Sabre Lite) で TOPPERS/FMP を動かす

QEMU の開発リポジトリでは i.MX6 のエミュレーションがマージされていて、以外にも(?)サクッと動いたので、その手順を記録しておく。

ゲストはTOPPERS/FMPカーネル

ホスト環境

Ubuntu 14.04

QEMU ビルド
% cd /tmp
% sudo apt-get build-dep qemu
% git clone git://git.qemu.org/qemu.git
% cd qemu
% ./configure --target-list=arm-softmmu
% make -j$(nproc) 
TOPPERS/FMP ビルド

ツールチェインの取得。

% cd /tmp
% wget -O - https://launchpad.net/gcc-arm-embedded/5.0/5-2016-q1-update/+download/gcc-arm-none-eabi-5_3-2016q1-20160330-linux.tar.bz2 | tar xjf -

コンフィグレータのビルド。

% cd /tmp
% sudo apt-get install libboost-all-dev
% wget -O - https://www.toppers.jp/download.cgi/cfg-1.9.5.tar.gz | tar xzf -   
% cd cfg
% make depend && make

FMP のビルド(コアの数は2とする)。

% cd /tmp
% wget -O - https://www.toppers.jp/download.cgi/fmp_imx6_gcc-20150917.tar.gz | tar xzf -
% cd fmp_1.3.0; mkdir obj; cd obj 
% ../configure -T imx6_gcc -g /tmp/cfg/cfg/cfg -P 2
% make GCC_TARGET=/tmp/gcc-arm-none-eabi-5_2-2015q4/bin/arm-none-eabi fmp.bin 
QEMU の起動

コアの数を2で起動。serial は telnet をバックエンドとし接続まち状態とする。

% /tmp/qemu/arm-softmmu/qemu-system-arm \
    -M sabrelite \
    -smp 2 \
    -kernel /tmp/fmp_1.3.0/obj/fmp \
    -nographic \
    -monitor stdio \
    -serial telnet:0.0.0.0:1200,server

別のターミナルから、待機中の serial の telnet に接続すれば FMP が動き出す。

% telnet localhost 1200
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Processor 2 start.
local_inirtn exinf = 2, counter = 1

TOPPERS/FMP Kernel Release 1.3.0 for Freescale i.MX6 (Jun  5 2016, 11:22:08)
Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory
                            Toyohashi Univ. of Technology, JAPAN
Copyright (C) 2004-2015 by Embedded and Real-Time Systems Laboratory
            Graduate School of Information Science, Nagoya Univ., JAPAN

Processor 1 start.
local_inirtn exinf = 1, counter = 2
Server task 2 starts.
System logging task is started on port 1.
Server task 1 starts.
Sample program starts (exinf = 1).
select tskno 0x11
select cycid 1
select almid 1
select processor 1
select class     1
task1_1 is running (001).   |
task1_1 is running (002).   |
task1_1 is running (003).   |
task1_1 is running (004).   |
task1_1 is running (005).   |