<?xml version="1.0" encoding="UTF-8" ?><rdf:RDF 
  xmlns="http://purl.org/rss/1.0/"
  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
  xmlns:atom="http://www.w3.org/2005/Atom"
  xmlns:dc="http://purl.org/dc/elements/1.1/"
  xml:lang="ja">
  <channel rdf:about="http://w.atwiki.jp/mad-scientist/">
    <title>静岡重工</title>
    <link>http://w.atwiki.jp/mad-scientist/</link>
    <atom:link href="https://w.atwiki.jp/mad-scientist/rss10.xml" rel="self" type="application/rss+xml" />
    <atom:link rel="hub" href="https://pubsubhubbub.appspot.com" />
    <description>静岡重工</description>

    <dc:language>ja</dc:language>
    <dc:date>2010-06-08T00:08:57+09:00</dc:date>
    <utime>1275923337</utime>

    <items>
      <rdf:Seq>
                <rdf:li rdf:resource="https://w.atwiki.jp/mad-scientist/pages/23.html" />
                <rdf:li rdf:resource="https://w.atwiki.jp/mad-scientist/pages/1.html" />
                <rdf:li rdf:resource="https://w.atwiki.jp/mad-scientist/pages/13.html" />
                <rdf:li rdf:resource="https://w.atwiki.jp/mad-scientist/pages/15.html" />
                <rdf:li rdf:resource="https://w.atwiki.jp/mad-scientist/pages/17.html" />
                <rdf:li rdf:resource="https://w.atwiki.jp/mad-scientist/pages/22.html" />
                <rdf:li rdf:resource="https://w.atwiki.jp/mad-scientist/pages/21.html" />
                <rdf:li rdf:resource="https://w.atwiki.jp/mad-scientist/pages/20.html" />
                <rdf:li rdf:resource="https://w.atwiki.jp/mad-scientist/pages/19.html" />
                <rdf:li rdf:resource="https://w.atwiki.jp/mad-scientist/pages/18.html" />
              </rdf:Seq>
    </items>
	
		
    
  </channel>
    <item rdf:about="https://w.atwiki.jp/mad-scientist/pages/23.html">
    <title>Subversion</title>
    <link>https://w.atwiki.jp/mad-scientist/pages/23.html</link>
    <description>
      ----
*はじめに
弊社では、バグトラッキングツールとしてTrac Lightningを導入しました。
Trac Lightningには、バージョン管理ツールのSubversionが同梱されています。
今まではVisual Source Safeを使用していましたが、これを機にSubversionに移行したいと考えます。

**参考文献
***[[svnbook日本語版のPDF版を作成してみました&gt;http://psyto.s26.xrea.com/misc/svnbook/]]
ここにsvnbookのPDF版があります。

*コマンドライン操作
まずは基本のコマンドライン操作から。
**リポジトリの作成
カレントディレクトリにリポジトリ「repos」を作成
 C:¥TracLight&gt;svadmin create repos
**最初のデータのインポート
まず、C:¥tempフォルダに、プロジェクトmyprojectのフォルダ構造を作ります。
 C:¥TracLight&gt;cd ¥
 C:¥&gt;mkdir temp
 C:¥&gt;cd temp
 C:¥temp&gt;mkdir myproject
 C:¥temp&gt;cd myproject
 C:¥temp¥myproject&gt;mkdir branches tags trunk
次に、作成したmyprojectをリポジトリreposにインポートします。
 C:¥temp&gt;svn import myproject file:///C:/TracLight/repos/myproject -m &quot;initial import&quot;
「/」の数を間違えるとエラーになりますのでご注意。
***ファイルの追加
test.txtファイルを追加してみます。
 C:¥temp¥myproject¥trunk&gt;echo hogehoge &gt; test.txt
 C:¥temp¥myproject¥trunk&gt;svn import test.txt file:///C:/TracLight/repos/myproject/trunk/test.txt -m &quot;add file&quot; 
 
----    </description>
    <dc:date>2010-06-08T00:08:57+09:00</dc:date>
    <utime>1275923337</utime>
  </item>
    <item rdf:about="https://w.atwiki.jp/mad-scientist/pages/1.html">
    <title>トップページ</title>
    <link>https://w.atwiki.jp/mad-scientist/pages/1.html</link>
    <description>
      静岡重工は、静岡に拠点を置くコンピュータソフトウェアメーカーです。
気が向いたときにソフトを書いたりします。
----
*[[HEWのTips]]
ルネサスの統合開発環境「HEW」の使用方法のメモでございます。

*[[xyzzy]]
弊社で標準的に利用しているxyzzyの使用方法のメモです。

*[[Subversion]]
バージョン管理ツールSubversionの使用方法のメモはこちらです。
----
来客数：&amp;counter()
----
[[お問い合わせはこちら]]
----    </description>
    <dc:date>2010-06-07T02:29:29+09:00</dc:date>
    <utime>1275845369</utime>
  </item>
    <item rdf:about="https://w.atwiki.jp/mad-scientist/pages/13.html">
    <title>xyzzy</title>
    <link>https://w.atwiki.jp/mad-scientist/pages/13.html</link>
    <description>
      xyzzyの使い方メモになります。

----

*バイナリファイルに書き込み
with-open-fileのオプションで:encoding :binaryを指定します。
バイナリデータへの変換はcode-charを使用します。

例）
H&#039;00～H&#039;FFのデータを書き出してみる。
 (with-open-file (out &quot;test.bin&quot; :direction :output :if-exist :supersede :encoding :binary)
   (dotimes (n 256)
 	(write-char (code-char n) out)))

----

*バイナリファイルの読み出し
例）
上の「バイナリファイルに書き込み」で作成したファイルを
読み出して表示してみる。
 (with-open-file (in &quot;test.bin&quot; :encoding :binary)
   (let ((ch))
 	(while (setf ch (read-char in nil))
 	  (print (char-code ch)))))

----

*ハッシュテーブルの中身を全部表示する
maphash関数を使用します。
例）
エンコード種類のハッシュテーブルの中身を表示してみる。
 (let ((alist nil))
   (maphash #&#039;(lambda (x y) (print (cons x y))) *mime-charset-name-hash-table*)
   alist)    </description>
    <dc:date>2010-06-07T02:28:36+09:00</dc:date>
    <utime>1275845316</utime>
  </item>
    <item rdf:about="https://w.atwiki.jp/mad-scientist/pages/15.html">
    <title>HEWのTips</title>
    <link>https://w.atwiki.jp/mad-scientist/pages/15.html</link>
    <description>
      ルネサスの統合開発環境「HEW」の便利？な使い方をご紹介いたします。

----

*外部エディタの設定
HEWでソースファイルを開くときに、一般のエディタを使うための設定をします。
（HEWのヘルプの、［目次］→［環境のカスタマイズ］→［外部エディタを使う］を参考にしました）

例として、[[xyzzy]]を使う場合の設定方法を下記に示します。
なお、今回使用したHEWのバージョンは4.04.01.001です。

メニューから、［基本設定］→［オプション...］をクリックします。

オプションダイアログで［エディタ］タブをクリックします。

［外部エディタの使用］をチェックします。
［変更...］ボタンをクリックします。

外部エディタダイアログが表示されます。
ここで、外部エディタのパスと、ファイルを開くときの引数、
および行番号を指定してファイルを開くときの引数を設定します。
↓xyzzyの場合はこんな感じになります。
#image(HEW-外部エディタ.png,width=527,height=183,center)

で、［OK］を押せば設定完了です。
これでHEWからxyzzyを使えるようになりました。

&amp;bold(){※注意}
ただし、HEWのシミュレータやデバッガを使う場合にはHEWの標準エディタを使う必要があります。
そのときはオプションダイアログで［外部エディタの使用］のチェックを外します。

HEWの標準エディタは、背景が白すぎて非常に目が疲れます．．．
せめて背景色が変更できればなー．．．あとキーバインドも。

----    </description>
    <dc:date>2010-06-07T02:25:33+09:00</dc:date>
    <utime>1275845133</utime>
  </item>
    <item rdf:about="https://w.atwiki.jp/mad-scientist/pages/17.html">
    <title>Willcom 03</title>
    <link>https://w.atwiki.jp/mad-scientist/pages/17.html</link>
    <description>
      *Willcom 03でTcl/Tkを使ってみる

[[eTcl&gt;http://www.evolane.com/software/etcl/]]はWindows Mobile上で動作するTcl/Tk環境だ。
こいつをWiilcom 03にインストールしてみる。

[[eTclの公式ページ&gt;http://www.evolane.com/software/etcl/]]のDownloadのところを見ると、
いろいろな環境向けのバイナリが置いてある。

Willcom 03のOSはWindows Moblie 6.0なので、
「Windows Mobile (2003, 2003SE, 5.0 and 6.0) - ARM/XScale」でいいだろう。
standard、compact、fullの３種類があるが、とりあえずstandardを選択してみる。
同じstandardでもWin32 installer、Cabinet file for PocketPC、Cabinet file for Smartphoneの３種類があるが、
Willcom 03本体でインストールするには「Cabinet file for PocketPC」をダウンロードする。

ダウンロードしたetcl-1.0-rc29-wince-arm-std-pocketpc.cabをWillcom 03にコピーして実行。
あとはインストーラの指示に従ってクリックしていけばおｋ。

インストールしたディレクトリに入っているデモプログラムで動作確認してみる。
こいつ、動くぞ（当たり前だが）

これでWillcom 03上で簡単にGUIプログラムが作れるようになったワケだ。

----

*Tcl/Tkで関数電卓アプリを作ってみた。

Willcom 03には電卓アプリがインストールされているが、こいつが非常にダサい。
Windows 3.1の時代にタイムスリップしたかのような古臭いデザインで、おまけにsinとかcosとか計算できない。
まーそういったわけで、Tcl/Tkを使ってmy電卓アプリを書いてみる。

Windows mobileで使うので、画面サイズは固定。
こんなときは「place」を使ってレイアウトすると吉。

ボタンの数は縦8個、横4個とした。
これ以上多くすると、ボタンのサイズが小さすぎて指で押しづらい。

1画面に表示できるボタンが少ないので、
sinとかasinとかlogとかはFUNCボタンで切り替えるようにしてみた。

で、下のがソースコード。普通のPCで実行すると妙にボタンがでかくて文字が小さく見えるが、
Willcom 03上だとちょうどいい大きさになる（はず）。
あと、πとかeとかの定数や16進数の計算なんかもそのうち折り込みたいなー。

 # button layout 
 set row_nums	3 ;	# [0-9] + - / * . e
 set row_exe	7 ;	# EXE CLR ( )
 set row_cursol	1 ;	# &lt;- -&gt; BS DEL
 set row_func	2 ;	# FUNC
 
 # button color
 set color_cursol  #FF8080
 set color_func    #FFFF80
 set color_arith   #80FF80
 set color_exe     #8080FF
 
 # font setting
 set font_args		{Tahoma 12}
 
 # button size
 set btn_w	120
 set btn_h	80
 
 # menu
 menu .m -type menubar
 . configure -menu .m
 .m	add command -label &quot;EXIT&quot; -font $font_args -command &quot;exit&quot;
 
 # entry
 entry .e -width 24 -font $font_args
 place .e -x 0 -y 0 -width [expr $btn_w * 4] -height $btn_h
 
 # number button
 for {set i 0} {$i &lt; 10} {incr i} {
 	button .b_$i -text $i -font $font_args -command &quot;insert-str $i&quot;
 }
 
 for {set i 1} {$i &lt; 10} {incr i} {
 	place .b_$i -x [expr $btn_w * (($i - 1) % 3)] -y [expr $btn_h * ($row_nums + 2 - (($i - 1) / 3))] -width $btn_w -height $btn_h
 }
 place	.b_0	 -x [expr $btn_w * 0]	-y [expr $btn_h * ($row_nums + 3)]	-width $btn_w	-height $btn_h
 
 button	.b_dot	-text &quot;.&quot;	-font $font_args	-command &quot;insert-str .&quot;
 place	.b_dot	 -x [expr $btn_w * 1]	-y [expr $btn_h * ($row_nums + 3)]	-width $btn_w	-height $btn_h
 
 button	.b_e	-text &quot;e&quot;	-font $font_args	-command &quot;insert-str e&quot;
 place	.b_e	 -x [expr $btn_w * 2]	-y [expr $btn_h * ($row_nums + 3)]	-width $btn_w	-height $btn_h
 
 # bracket
 button	.b_bra_l	-text &quot;(&quot;	-font $font_args -command &quot;insert-str (&quot;
 place	.b_bra_l	 -x 0					-y [expr $btn_h * $row_exe]	-width $btn_w	-height $btn_h
 
 button	.b_bra_r	-text &quot;)&quot;	-font $font_args -command &quot;insert-str )&quot;
 place	.b_bra_r	 -x [expr $btn_w * 1]	-y [expr $btn_h * $row_exe]	-width $btn_w	-height $btn_h
 
 # / * - +
 button	.b_div	-text &quot;/&quot;	-bg $color_arith	-font $font_args	-command &quot;insert-str /&quot;
 place	.b_div	 -x [expr $btn_w * 3]	-y [expr $btn_h * ($row_nums + 0)]	-width $btn_w	-height $btn_h
 
 button	.b_mul	-text &quot;*&quot;	-bg $color_arith	-font $font_args	-command &quot;insert-str *&quot;
 place	.b_mul	 -x [expr $btn_w * 3]	-y [expr $btn_h * ($row_nums + 1)]	-width $btn_w	-height $btn_h
 
 button	.b_sub	-text &quot;-&quot;	-bg $color_arith	-font $font_args	-command &quot;insert-str -&quot;
 place	.b_sub	 -x [expr $btn_w * 3]	-y [expr $btn_h * ($row_nums + 2)]	-width $btn_w	-height $btn_h
 
 button	.b_plus	-text &quot;+&quot;	-bg $color_arith	-font $font_args	-command &quot;insert-str +&quot;
 place	.b_plus	 -x [expr $btn_w * 3]	-y [expr $btn_h * ($row_nums + 3)]	-width $btn_w	-height $btn_h
 
 # execute
 button .b_exe -text &quot;EXE&quot; -bg $color_exe	-font $font_args -command &quot;exec-calc&quot;
 place	.b_exe	 -x [expr $btn_w * 3]	-y [expr $btn_h * $row_exe]	-width $btn_w	-height $btn_h
 
 # clear
 button .b_clr -text &quot;CLR&quot; -bg $color_exe	-font $font_args -command &quot;clear-line&quot;
 place	.b_clr	 -x [expr $btn_w * 2]	-y [expr $btn_h * $row_exe]	-width $btn_w	-height $btn_h
 
 # move
 button	.b_mov_l	-text &quot;&lt;-&quot;	-bg $color_cursol	-font $font_args -command &quot;event generate .e &lt;Left&gt;&quot;
 place	.b_mov_l	-x [expr $btn_w * 2]	-y [expr $btn_h * $row_cursol]	-width $btn_w	-height $btn_h
 
 button	.b_mov_r	-text &quot;-&gt;&quot;	-bg $color_cursol	-font $font_args -command &quot;event generate .e &lt;Right&gt;&quot;
 place	.b_mov_r	-x [expr $btn_w * 3]	-y [expr $btn_h * $row_cursol]	-width $btn_w	-height $btn_h
 
 button	.b_bs		-text &quot;BS&quot;	-bg $color_cursol	-font $font_args -command &quot;event generate .e &lt;BackSpace&gt;&quot;
 place	.b_bs		-x [expr $btn_w * 0]	-y [expr $btn_h * $row_cursol]	-width $btn_w	-height $btn_h
 
 button	.b_del		-text &quot;DEL&quot;	-bg $color_cursol	-font $font_args -command &quot;event generate .e &lt;Delete&gt;&quot;
 place	.b_del		-x [expr $btn_w * 1]	-y [expr $btn_h * $row_cursol]	-width $btn_w	-height $btn_h
 
 # other math func
 foreach n {sin cos tan asin acos atan sinh cosh tanh log log10 exp} {
 	button .b_$n -text $n -bg $color_func	-font $font_args -command &quot;sandwich-str $n&quot;
 }
 
 button	.b_func	-text FUNC	-bg $color_func	-font $font_args -command &quot;change_functions&quot;
 place	.b_func	-x [expr $btn_w * 0]	-y [expr $btn_h * $row_func]	-width $btn_w	-height $btn_h
 
 proc insert-str {str} {
 	.e insert insert $str
 	focus .e
 }
 
 proc sandwich-str {str} {
 	.e insert 0 &quot;(&quot;
 	.e insert 0 $str
 	.e insert end &quot;)&quot;
 	focus .e
 }
 
 proc exec-calc {} {
 	set txt [.e get]
 	.e delete 0 end
 	if {$txt != &quot;&quot;} {
 		.e insert insert [expr $txt]
 	}
 }
 
 proc clear-line {} { .e delete 0 end }
 
 set func_select	3
 proc change_functions {} {
 	global	row_func
 	global	func_select
 
 	set func_select [expr $func_select + 1]
 	if {$func_select &gt;= 4} {set func_select 0}
 	
 	switch $func_select {
 		0	{ set_functions_buttons {.b_sin .b_cos .b_tan} }
 		1	{ set_functions_buttons {.b_asin .b_acos .b_atan} }
 		2	{ set_functions_buttons {.b_sinh .b_cosh .b_tanh} }
 		3	{ set_functions_buttons {.b_log .b_log10 .b_exp} }
 	}
 }
 
 proc set_functions_buttons {btnlst} {
 	global	row_func btn_w btn_h
 	for {set i 0} {$i &lt; 3} {incr i} {
 		place	[lindex $btnlst $i]	-x [expr $btn_w * (1 + $i)]	-y [expr $btn_h * $row_func]	-width $btn_w	-height $btn_h
 		raise	[lindex $btnlst $i]
 	}
 }
 
 . configure -width 480 -height 640
 
 change_functions
 
 bind .e &lt;Return&gt; { exec-calc }
 
 focus .e    </description>
    <dc:date>2010-01-11T22:29:48+09:00</dc:date>
    <utime>1263216588</utime>
  </item>
    <item rdf:about="https://w.atwiki.jp/mad-scientist/pages/22.html">
    <title>Ruby</title>
    <link>https://w.atwiki.jp/mad-scientist/pages/22.html</link>
    <description>
      *Ruby Gemをプロキシ越しで使う
会社のパソコンでは、インターネットへアクセスするのに
プロキシサーバーを経由しなければなりません。

こういった環境でそのまま「gem」コマンドを使用すると、
サーバへ接続できずエラーとなります。

こんなときは、以下の1行を入力してからgemを使いましょう。
 c:\&gt;set http_proxy=http:// ＜プロキシサーバのアドレス＞ : ＜プロキシサーバのポート番号＞    </description>
    <dc:date>2010-01-11T22:27:38+09:00</dc:date>
    <utime>1263216458</utime>
  </item>
    <item rdf:about="https://w.atwiki.jp/mad-scientist/pages/21.html">
    <title>お問い合わせはこちら</title>
    <link>https://w.atwiki.jp/mad-scientist/pages/21.html</link>
    <description>
      管理人：カテ郎
E-mail：tachitsutetanaka@gmail.com    </description>
    <dc:date>2010-01-11T22:19:31+09:00</dc:date>
    <utime>1263215971</utime>
  </item>
    <item rdf:about="https://w.atwiki.jp/mad-scientist/pages/20.html">
    <title>TOPPERS（カスタマイズ）</title>
    <link>https://w.atwiki.jp/mad-scientist/pages/20.html</link>
    <description>
      [[TOPPERS]]のサンプルプログラムをターゲットに合わせてカスタマイズしてみる。

----
*ターゲットについて
-マイコンはSH7149を使用。
-ROM、RAMはマイコン内蔵のものを使用。
-クロック設定は、I : B : P = 80 : 40 : 40 [MHz]

開発コードネームは「KOKUBUNJI」。
コードネームをつけると、なんだかカッコよいような気がする。
そういえば、昔の拙者の上司は焼肉が大好きで、
コードネームを「ユッケ」や「ハラミ」にしていたなぁ。

----
*まずはコピペする。
jsp/config/sh2ディレクトリにあるapsh2f6a以下をコピーして、
「kokubunji」ディレクトリを作成する。
 % cd jsp/config/sh2
 % cp -r apsh2f6a kokubunji
あと、「apsh2f6a.h」を「kokubunji.h」にリネームする。
こいつをベースにカスタマイズしていく。

----
*各種ファイルの修正
kokubunjiディレクトリ内の各ファイルをターゲットに合わせて修正。

**hw_serial.h
 #include &quot;sh7149sci.h&quot;

**Makefile.config
まずSH7145になってるところをSH7149に変更。
 CDEFS := $(CDEFS) -DSH7149
 
 KERNEL_COBJS := $(KERNEL_COBJS) sys_config.o sh7149sci.o

ROM、RAMのアドレスを変更する。
 # ベクタテーブルの後ろ
     TEXT_START_ADDRESS=0x00000400
 # RAM領域の先頭アドレス(CS2)
     DATA_START_ADDRESS=0xFFFF9000


----
*SCIのドライバ
標準で添付されているsh7145用のSCIドライバを改造してSH7149用を作る。
**ヘッダの修正
sh7145sci.hをコピーしてsh7149sci.hを作る。
SH7149のSCIはSH7145とほとんど同じだが、レジスタのアドレスが異なる。
「コントロールレジスタのアドレスのオフセット」のところを下記のように修正。
 #define SCI_SCR    0x4
 #define SCI_SSR    0x8
 #define SCI_BRR    0x2
 #define SCI_SMR    0x0
 #define SCI_TDR    0x6
 #define SCI_RDR    0xA
 #define SCI_SDCR   0xC

あと、周辺クロックがSH7145と違うので、BRRの設定を変更しておく。
 #define SMR_CKS    0x0			/*  分周比          */
 #define BRR9600    129			/*  9600 ビットレート    */
 #define BRR19200   64			/*  19200 ビットレート    */
 #define BRR38400   32			/*  38400 ビットレート    */

**コードの修正
sh7145sci.cをコピーしてsh7149sci.cを作る。
ここでは、SCIのベースアドレスを修正する。
 const SIOPINIB siopinib_table[TNUM_PORT] = {
 	{0xffffc000, BRR9600, 0x0, 6}, /* SCI0 */
 }


----
*CMTのドライバ
sh7145cmt.hをコピーしてsh7149cmt.hを作る。
クロック周波数を変更。Pφ = 40 [MHz]を8分周するので5,000 [kHz]となる。
 #define TIMER_CLOCK     5000

レジスタのアドレスを変更する。
 #define CMSTR    (VH *)0xffffce00
 #define CMCSR_0  (VH *)0xffffce02
 #define CMCNT_0  (VH *)0xffffce04
 #define CMCOR_0  (VH *)0xffffce06    </description>
    <dc:date>2008-12-28T19:19:03+09:00</dc:date>
    <utime>1230459543</utime>
  </item>
    <item rdf:about="https://w.atwiki.jp/mad-scientist/pages/19.html">
    <title>TOPPERS</title>
    <link>https://w.atwiki.jp/mad-scientist/pages/19.html</link>
    <description>
      *[[TOPPERS（インストール）]]
開発環境のインストールからサンプルプログラムのビルドまで。

*[[TOPPERS（カスタマイズ）]]
サンプルプログラムをターゲットに合わせてカスタマイズしてみる。


----    </description>
    <dc:date>2008-12-25T21:59:34+09:00</dc:date>
    <utime>1230209974</utime>
  </item>
    <item rdf:about="https://w.atwiki.jp/mad-scientist/pages/18.html">
    <title>TOPPERS（インストール）</title>
    <link>https://w.atwiki.jp/mad-scientist/pages/18.html</link>
    <description>
      [[TOPPERS]]を使って組み込みソフトを作ってみる。
拙者は今まで日立のμITRONとT-Kernelを使ったことがあるが、TOPPERSは初めて。
まずはサンプルプログラムを動かすところから始めてみる。

----
*開発環境
基本的にはすべてフリーソフトを使う。なるべくお金を掛けない方針で。
ターゲットには会社で余ってるSH7149の基板を使う。

-ターゲット：SH2 (SH7149)
-クロスコンパイル環境：Cygwin＋GCC
-デバッグ環境：HEWシミュレータ

----
*ダウンロード
[[TOPPERSの公式ページ&gt;http://www.toppers.jp/index.html]]から必要なファイルをゲットする。

[[JSPカーネルのダウンロード&gt;http://www.toppers.jp/jsp-download.html]]から「JSPカーネル Release 1.4.3」（tar.gzのやつ）をダウンロードする。
（Windows用）と書いてあるやつは罠なのでダウンロードしちゃダメだ。こいつはソースファイルの改行コードがCRLFになっているので、CygwinのGCCでビルドするとマクロの改行のところでエラーになってしまう。

次に、[[JSPカーネルのページ&gt;http://www.toppers.jp/jsp-kernel.html]]の「開発環境」のとこにある「開発環境バイナリパッケージ（SH、Cygwin）」をゲットする。

----
*インストール
ここでは、Cygwinはすでに入っているものとする。

***カーネルソースなど
jsp-1.4.3.lzhを解凍してできた「jsp」ディレクトリをホームディレクトリにコピーする。
なお、jsp/doc/ディレクトリにあるuser.txtとgnu_install.txtにインストール方法が書いてある。

***クロス環境ツール
gnu_cygwin_sh.tar.gzをCygwinの/usr/local/に解凍する。
これで/usr/local/sh以下にコンパイラやリンカがインストールされる。
後は、/usr/local/sh/binにパスを通しておく。
bashを使っている場合は.bashrcに「PATH=/usr/local/sh/bin:$PATH」と書けばおｋ。

***コンフィギュレーションツール
コンフィギュレーションツールをマニュアルのとおりにビルドする。
 % cd jsp/cfg
 % make depend
 % make
何の問題も無くビルド完了。

----
*サンプルプログラムのビルド
***コンフィギュレーション
カーネルをSH2用にコンフィギュレーションする。jsp/configディレクトリに、様々なCPUと評価ボード向けのコンフィグファイルが入っている。
この中から、今回使用するSH7149に近いものを探してみると、SH7145用のやつがあった。アルファプロジェクト社のAP_SH2F_6Aという評価ボード用のものだ。こいつをちょっと改造してSH7149用にすれば良さそうだ。
ちなみに、このアルファプロジェクト社は、私が住んでいる静岡県浜松市にあるらしいぞ。

user.txtの例にならってコンフィギュレーションしてみる。
 % mkdir jsp/OBJ
 % cd jsp/OBJ
 % perl ../configure -C sh2 -S apsh2f6a

***Makefileの修正
ビルドする前に、Makefileの修正をひとつ。
デバッグ情報の形式を、HEWがサポートするDWARF2に変更する。
jsp/config/sh2/Makefile.configの19行目あたりにあるCOPTSを下記のように変更。
変更前：
 COPTS := $(COPTS) -Wall -g -O1 -m2 -mhitachi
変更後：
 COPTS := $(COPTS) -Wall -gdwarf-2 -O1 -m2 -mhitachi
これで、ELF/DWARF2形式のファイルが出力されるようになる。

***ビルド
コンフィギュレーションが終わったら、後はビルドするだけ。
 % make depend
 % make
けっこう時間がかかる。トイレに行って帰ってくるとちょうど良いくらいの時間だ。
そんなこんなでjsp.exeというファイルが出来上がる。

----

[[TOPPERS（シミュレーション）]]に続く。

----
どうでもいいけどTOPPERSってなんとなくVIPPERに似てる    </description>
    <dc:date>2008-12-25T21:20:31+09:00</dc:date>
    <utime>1230207631</utime>
  </item>
  </rdf:RDF>
