wiki:rubycfg_ssp

Version 11 (modified by nmir-saito, 6 years ago) ( diff )

--

TOPPERS/SSP Kernel用 Ruby版コンフィギュレータ向け追加ファイル

これは何か

TOPPERS/SSPカーネル1.3.0でRuby版コンフィギュレータを使用するために必要な追加ファイルです.
Mac版 Docker を使用して Ubuntu 16.04 LTS (Xenial Xerus) コンテナでの動作を確認しています.

利用方法については Docker を用いた動作確認手順を示しますので,参考にしてください.

動作確認に必要なもの

  • Docker : Docker上のコンテナ(仮想環境)を動かすために使います.
  • Git : Dockerのスクリプトを取得するのに使います.
  • コマンドライン環境:コマンドの実行にbashシェルを使います.Mac ならターミナルアプリ,Windowsなら MinGW など.

Dockerを用いた動作確認手順

以下ではMacOSのターミナルアプリで実行した際の様子を示します.他のホストOSで使用する場合もほぼ同様と思います.

# Dockerスクリプトの取得(カレントディレクトリに docker-toppers というディレクトリが作成されます)
$ git clone https://github.com/nmiri-nagoya-nsaito/docker-toppers.git
Cloning into 'docker-toppers'...
remote: Counting objects: 85, done.
remote: Compressing objects: 100% (55/55), done.
remote: Total 85 (delta 36), reused 70 (delta 27), pack-reused 0
Unpacking objects: 100% (85/85), done.

# スクリプトのディレクトリへ移動し,コンテナのシェルを起動する(詳細はスクリプト参照)
$ cd docker-toppers
$ ./start_shell.sh 
Building cli
Step 1/16 : FROM ubuntu:xenial
 ---> 0ef2e08ed3fa
Step 2/16 : MAINTAINER Naoki Saito <saito.naoki@nmiri.city.nagoya.jp>
 ---> Using cache
 ---> 1bec673845d0
Step 3/16 : RUN apt-get update
 ---> Using cache
 ---> 2dd9e0f61959
(中略)
Step 16/16 : RUN chmod -R +x ./scripts     && sync     && ./scripts/setup_user.sh
 ---> Running in d9b928e37d60
Removing intermediate container d9b928e37d60
 ---> f77b5e071680
Successfully built f77b5e071680
Successfully tagged docker-toppers_cli:latest
Creating docker-toppers_cli_1 ... done
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.

saito@3da8e259676b:~$ 

この時点で Linux コンテナ内のシェルが起動していますので,次は Ruby版コンフィギュレータを使用してSSPカーネルをビルドします.

# 適当な作業ディレクトリへ移動(dockerの設定でコンテナの ~/workdir ディレクトリをホストと共有する設定にしている)
saito@3da8e259676b:~$ cd workdir

# 本パッケージをダウンロード
saito@3da8e259676b:~$ svn co http://dev.toppers.jp/svn_user/contrib/rubycfg_ssp/trunk rubycfg_ssp
A    rubycfg_ssp/syssvc_sym.def
A    rubycfg_ssp/install.sh
A    rubycfg_ssp/alarm.trb
(略)
A    rubycfg_ssp/target_check.trb
A    rubycfg_ssp/prc_kernel.trb
A    rubycfg_ssp/target_kernel.trb
リビジョン 357 をチェックアウトしました。

# SSPカーネルコードのセットアップ及びビルド
saito@3da8e259676b:~/workdir$ rubycfg_ssp/build_ssp_ruby.sh 
ヒット:1 http://archive.ubuntu.com/ubuntu xenial InRelease
取得:2 http://archive.ubuntu.com/ubuntu xenial-updates InRelease [109 kB]
取得:3 http://archive.ubuntu.com/ubuntu xenial-security InRelease [107 kB]
216 kB を 2秒 で取得しました (92.3 kB/s)
パッケージリストを読み込んでいます... 完了
パッケージリストを読み込んでいます... 完了
依存関係ツリーを作成しています                
状態情報を読み取っています... 完了
以下の追加パッケージがインストールされます:
  binutils-arm-none-eabi libnewlib-arm-none-eabi libnewlib-dev libstdc++-arm-none-eabi-newlib
提案パッケージ:
  libnewlib-doc
以下のパッケージが新たにインストールされます:
  binutils-arm-none-eabi gcc-arm-none-eabi libnewlib-arm-none-eabi libnewlib-dev libstdc++-arm-none-eabi-newlib
アップグレード: 0 個、新規インストール: 5 個、削除: 0 個、保留: 1 個。
65.1 MB のアーカイブを取得する必要があります。
この操作後に追加で 610 MB のディスク容量が消費されます。
取得:1 http://archive.ubuntu.com/ubuntu xenial/universe amd64 binutils-arm-none-eabi amd64 2.26-4ubuntu1+8 [2,083 kB]
取得:2 http://archive.ubuntu.com/ubuntu xenial/universe amd64 gcc-arm-none-eabi amd64 15:4.9.3+svn231177-1 [17.3 MB]
取得:3 http://archive.ubuntu.com/ubuntu xenial/universe amd64 libnewlib-dev all 2.2.0+git20150830.5a3d536-1 [105 kB]
(略)
libnewlib-arm-none-eabi (2.2.0+git20150830.5a3d536-1) を設定しています ...
libstdc++-arm-none-eabi-newlib (15:4.9.3+svn227297-1+8) を設定しています ...
libc-bin (2.23-0ubuntu10) のトリガを処理しています ...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  579k  100  579k    0     0  1066k      0 --:--:-- --:--:-- --:--:-- 1064k
./asp3/configure.rb
./asp3/MANIFEST
./asp3/README.txt
./asp3/doc/asp_spec.txt
(略)
./asp3/target/dummy_gcc/target_timer.cfg
./asp3/target/dummy_gcc/target_timer.h
./asp3/target/dummy_gcc/target_unrename.h
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  161k  100  161k    0     0   581k      0 --:--:-- --:--:-- --:--:--  582k
./ssp/configure
./ssp/MANIFEST
./ssp/doc/ssp_spec.txt
./ssp/doc/extension.txt
./ssp/doc/porting.txt
(略)
./ssp/extension/dataqueue.c
./ssp/extension/eventflag.h
./ssp/extension/eventflag.c
patching file arch/arm_m_gcc/Makefile.prc
patching file sample/Makefile
patching file sample/sample1.cfg
patching file target/cq_frk_fm3_gcc/Makefile.target
Generating Makefile from ../sample/Makefile.
ruby ../cfg/cfg.rb --pass 1 --kernel ssp -I. -I../include -I../arch  -I../target/cq_frk_fm3_gcc -I../arch/arm_m_gcc/ -I.. -I../sample -I./gen -I../tecs_kernel --api-table ../kernel/kernel_api.def --symval-table ../kernel/kernel_sym.def --symval-table ../syssvc/syssvc_sym.def   --symval-table ../arch/arm_m_gcc/prc_sym.def \
					-M deps/cfg1_out_c.d ../target/cq_frk_fm3_gcc/target_kernel.cfg ../sample/sample1.cfg
[cfg.rb] Generated cfg1_out.c
arm-none-eabi-gcc -c -MD -MP -MF deps/cfg1_out.d -O2 -Wall -g   -mcpu=cortex-m3 -mthumb -mthumb  -DTOPPERS_OMIT_TECS  -DROM_BOOT -DTOPPERS_LABEL_ASM  -I. -I../include -I../arch  -I../target/cq_frk_fm3_gcc -I../arch/arm_m_gcc/ -I.. -I../sample -I./gen -I../tecs_kernel -DTOPPERS_CB_TYPE_ONLY  -mcpu=cortex-m3 -mthumb -DALLFUNC  -fno-strict-aliasing -mcpu=cortex-m3 -mthumb -I../kernel -I ../extension  cfg1_out.c
arm-none-eabi-gcc -c -O2 -Wall -g   -mcpu=cortex-m3 -mthumb -mthumb  -DTOPPERS_OMIT_TECS  -DROM_BOOT -DTOPPERS_LABEL_ASM  -I. -I../include -I../arch  -I../target/cq_frk_fm3_gcc -I../arch/arm_m_gcc/ -I.. -I../sample -I./gen -I../tecs_kernel -DALLFUNC  -fno-strict-aliasing -mcpu=cortex-m3 -mthumb -I../kernel -I ../extension ../arch/arm_m_gcc/start.S
arm-none-eabi-gcc -O2 -Wall -g   -mcpu=cortex-m3 -mthumb -mthumb  -DTOPPERS_OMIT_TECS  -DROM_BOOT -DTOPPERS_LABEL_ASM  -I. -I../include -I../arch  -I../target/cq_frk_fm3_gcc -I../arch/arm_m_gcc/ -I.. -I../sample -I./gen -I../tecs_kernel -nostdlib -nostdlib  --entry _start   -T ../target/cq_frk_fm3_gcc/cq_frm_fm3_rom.ld  -o cfg1_out \
					 cfg1_out.o 
arm-none-eabi-nm -n cfg1_out > cfg1_out.syms
arm-none-eabi-objcopy -O srec -S cfg1_out cfg1_out.srec
ruby ../cfg/cfg.rb --pass 2 --kernel ssp -I. -I../include -I../arch  -I../target/cq_frk_fm3_gcc -I../arch/arm_m_gcc/ -I.. -I../sample -I./gen -I../tecs_kernel -T ../target/cq_frk_fm3_gcc/target_kernel.trb
=====================================
Task priority configuration result: 
	INIT_TASK:	IPRI = 1, EXEPRI = 1
	LOGTASK:	IPRI = 2, EXEPRI = 2
	MAIN_TASK:	IPRI = 3, EXEPRI = 3
	TASK1:	IPRI = 4, EXEPRI = 4
	TASK2:	IPRI = 5, EXEPRI = 5
	TASK3:	IPRI = 6, EXEPRI = 5
=====================================
=====================================
Stack size configuration result:
	Estimated task stack size = 768
	Specified interrupt stack size = INTERRUPT_STACKSIZE(value=1024)
	Allocated total stack size = ALL_STACKSIZE(value=2048)
=====================================
[cfg.rb] Generated kernel_cfg.h
[cfg.rb] Generated kernel_cfg.c
arm-none-eabi-gcc -c -MD -MP -MF deps/sample1.d -O2 -Wall -g   -mcpu=cortex-m3 -mthumb -mthumb  -DTOPPERS_OMIT_TECS  -DROM_BOOT -DTOPPERS_LABEL_ASM  -I. -I../include -I../arch  -I../target/cq_frk_fm3_gcc -I../arch/arm_m_gcc/ -I.. -I../sample -I./gen -I../tecs_kernel  ../sample/sample1.c
(略)
arm-none-eabi-gcc -c -MD -MP -MF deps/dataqueue.d -O2 -Wall -g   -mcpu=cortex-m3 -mthumb -mthumb  -DTOPPERS_OMIT_TECS  -DROM_BOOT -DTOPPERS_LABEL_ASM  -I. -I../include -I../arch  -I../target/cq_frk_fm3_gcc -I../arch/arm_m_gcc/ -I.. -I../sample -I./gen -I../tecs_kernel -DALLFUNC  -fno-strict-aliasing -mcpu=cortex-m3 -mthumb -I../kernel -I ../extension ../extension/dataqueue.c
rm -f libkernel.a
arm-none-eabi-ar -rcs libkernel.a  target_support.o  prc_support.o  target_config.o target_serial.o prc_config.o prc_timer.o startup.o task.o task_manage.o interrupt.o exception.o sys_manage.o cyclic.o alarm.o time_manage.o time_event.o eventflag.o dataqueue.o 
arm-none-eabi-ranlib libkernel.a
arm-none-eabi-gcc -O2 -Wall -g   -mcpu=cortex-m3 -mthumb -mthumb  -DTOPPERS_OMIT_TECS  -DROM_BOOT -DTOPPERS_LABEL_ASM  -I. -I../include -I../arch  -I../target/cq_frk_fm3_gcc -I../arch/arm_m_gcc/ -I.. -I../sample -I./gen -I../tecs_kernel -nostdlib -nostdlib  --entry _start   -T ../target/cq_frk_fm3_gcc/cq_frm_fm3_rom.ld  -L. -o ssp \
		  sample1.o log_output.o vasyslog.o        banner.o serial.o syslog.o logtask.o  kernel_cfg.o  \
		-lkernel -lc  -lgcc  
arm-none-eabi-nm -n ssp > ssp.syms
arm-none-eabi-objcopy -O srec -S ssp ssp.srec
ruby ../cfg/cfg.rb --pass 3 --kernel ssp -O -I. -I../include -I../arch  -I../target/cq_frk_fm3_gcc -I../arch/arm_m_gcc/ -I.. -I../sample -I./gen -I../tecs_kernel -T ../target/cq_frk_fm3_gcc/target_check.trb \
			--rom-symbol ssp.syms --rom-image ssp.srec
configuration check passed
saito@3da8e259676b:~/workdir$ 

以上で,<カレントディレクトリ>/ssp/build/ に実行プログラムファイル(ssp)が生成されます.

注意事項

  • SSP-1.3.0 のパッケージに含まれるファイルの文字コードは EUC-JP でしたが,Ruby版コンフィギュレータを使用するために UTF-8 に変換しています.したがってファイルを追加,編集する場合は UTF-8 を使用してください.
  • Windows版のgitで core.autocrlf が true に設定されている場合,シェルスクリプトの実行に失敗することがあるようです.その場合は git config コマンドで core.autocrlffalse に設定してみてください.
Note: See TracWiki for help on using the wiki.