Forums: Help (Thread #8476)

3052FのRAM上でのHOS (2005-08-23 18:00 by Anonymous #15980)

Miwです。

beshioさんのサンプルをつかってAki-H8-3052FのRAM上でHOSを試してみました。

Cygwin 1.5.18-1
gcc h8300-hms-gcc 3.2.3
Win2k

でやってみました。
その結果、サンプルのままだと、vector.sで定義されたラベルと、hosrommap.xでの値が一致しないようです。
そこで、
1.vector.sの定義で値を直接いれる
2.hosの関数アドレスを#defineで定義するヘッダーファイルhosrom.hを作る。
3.gccのライブラリについては、-lgccで対応する。
とやってみたところ、動作するmotファイルができました。

一方、
4.vector.sはそのまま。hosrommap.xのラベルの先頭にに'_'を追加
5.そのままmake
を行ったところ、motファイルは無事できましたが、
実行するとOSタイマの割り込みがかかったところで暴走しているようです。


それぞれのmapファイルを比べたところ、以下の部分が違ってました。

先の方法:
*(.rodata)
.rodata 0x000fe402 0x4 crt0.o
0x000fe402 kernel_int_sp
.rodata 0x000fe406 0x18 kernel_cfg_rom.o

後の方法:
*(.rodata)
.rodata 0x000fe402 0x4 crt0.o
.rodata 0x000fe406 0x18 kernel_cfg_rom.o

あとは、hosrommap.xの中身に'_'がついているかどうかの違いがありました。

なぜここの違いがでるのか、わかりませんが、これが原因で動作しないのかもしれないですね。

Reply to #15980×

You can not use Wiki syntax
You are not logged in. To discriminate your posts from the rest, you need to pick a nickname. (The uniqueness of nickname is not reserved. It is possible that someone else could use the exactly same nickname. If you want assurance of your identity, you are recommended to login before posting.) Login

RE: 3052FのRAM上でのHOS (2005-08-24 01:27 by beshio #15990)

Miwさん、

私の環境に関しての説明が無かったために色々とご苦労をお掛けしまして申し訳ありません。

まずCygwinですが、

$ uname -a
CYGWIN_NT-5.1 athlon-64fx 1.5.18(0.132/4/2) 2005-07-02 20:30 i686 unknown unknown Cygwin

のようになっております。Cygwinは適宜アップデートを繰り返しておりますが、それによってH8のビルドが出来なくなったことは無いので、あまり関係が無いかもしれません。

次にH8の環境ですが、これは下記URLの記述と完全に同じことをCygwin上で行っております。

http://www.kikaiken.org/lib/junk/h8dev-doc-linux/index.html

2005/8/24現在、上記URLは有効のようです。

使用しているソースは
binutils-2.15.tar.gz
gcc-3.4.1.tar.gz
newlib-1.12.0.tar.gz

現在私のgccは

$ gcc --version
gcc (GCC) 3.4.4 (cygming special) (gdc 0.12, using dmd 0.125)
Copyright (C) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

となっております。H8の環境をビルドしたときのバージョンは今では分かりませんが、今年のことなので多分3.4.4と思われます。

以上、ご参考までに。

べしお
Reply to #15980

Reply to #15990×

You can not use Wiki syntax
You are not logged in. To discriminate your posts from the rest, you need to pick a nickname. (The uniqueness of nickname is not reserved. It is possible that someone else could use the exactly same nickname. If you want assurance of your identity, you are recommended to login before posting.) Login

RE: 3052FのRAM上でのHOS (2005-08-24 13:46 by Anonymous #16003)

beshioさん:

Miwです、こんにちは。
HOSサンプル、使わせていただいております。
やはりgccの環境のちがいですかね?
たんとか対症療法的に動作させております。
のちほど、紹介していただいた3.4.4とか、elf形式の5.0.2などでも試してみますね。
今後ともよろしくお願いします。

hamayanさん:
私のところでは、hosrommap.xの中身は
_apploadaddr = 0x000fe0e4;
romcrt0 = 0x00008000;

となってます。kernel_int_spはアンダースコア無しでした。

m-arai さんのご提案のように、hosrommap.xの全ての行に'_'をつけたしたところ、mapファイルには_kernel_int_spが設定されていませんでした。
そこで、kernel_int_spだけもとにもどしてコンパイルしたところ、mapファイルの出力は

*(.rodata)
.rodata 0x000fe402 0x4 crt0.o
0x000fe402 kernel_int_sp
となり、無事実行もできました。

関数名はアンダースコア付き、変数は無し、ってことなのでしょうかね??

ちなみに、hos-v4_for_gcc_2で作ったROMに焼きこむサンプルのmapファイルをみたところ、HOSの関数名や変数名はアンダースコアはないようです。

Reply to #15990

Reply to #16003×

You can not use Wiki syntax
You are not logged in. To discriminate your posts from the rest, you need to pick a nickname. (The uniqueness of nickname is not reserved. It is possible that someone else could use the exactly same nickname. If you want assurance of your identity, you are recommended to login before posting.) Login

RE: 3052FのRAM上でのHOS (2005-08-24 19:50 by m-arai #16005)

Cの生成するシンボル情報の生成則に、
変数だから関数だからという違いはありません。

ここで問題なのは3点だと思われます。

1. mapファイルの出力形式

問題になっている環境
.text 0x000fe12c 0x130 sample.o
0x000fe16e Initialize

beshioさんの想定する環境
.text 0x00000240 0x124 sample.o
0x00000276 _Initialize

2. 1の問題により、ROM化の為に二重化されたkernel_int_spの、
本来hosrommap.xには出力されない(genhosmapで弾いている)
情報がhosrommap.xに洩れ出る→あるべき先頭の'_'が無い問題を
避ける対処で、不幸にも_kernel_int_spが現出

3. crt0.sの_kernel_int_spと衝突して不具合の原因となっているが、
そのことについてldが報告してくれないので分からない。

こんなところではないでしょうか。
Reply to #16003

Reply to #16005×

You can not use Wiki syntax
You are not logged in. To discriminate your posts from the rest, you need to pick a nickname. (The uniqueness of nickname is not reserved. It is possible that someone else could use the exactly same nickname. If you want assurance of your identity, you are recommended to login before posting.) Login

RE: 3052FのRAM上でのHOS (2005-08-26 11:02 by Anonymous #16030)

m-arai様:

Miwです、こんにちは。

うちのhos-v4_for_gcc_2の環境で普通につくったsample.motのmapファイルをみたら、

.text 0x00000240 0x124 sample.o
0x00000276 Initialize
となってました。

僕のところだと_がつかない設定になっているんですね。
もうちょっと調べてみます。

Reply to #16005

Reply to #16030×

You can not use Wiki syntax
You are not logged in. To discriminate your posts from the rest, you need to pick a nickname. (The uniqueness of nickname is not reserved. It is possible that someone else could use the exactly same nickname. If you want assurance of your identity, you are recommended to login before posting.) Login

RE: 3052FのRAM上でのHOS (2005-08-28 16:55 by Anonymous #16071)

Miwです。

beshioさんに教えてもらったgccでやってみたところ、キチンといけました。
何が違ったのかは、ぼちぼち調べることにして(^^;、
いろいろやってみますね。

ありがとうございました。
Reply to #16003

Reply to #16071×

You can not use Wiki syntax
You are not logged in. To discriminate your posts from the rest, you need to pick a nickname. (The uniqueness of nickname is not reserved. It is possible that someone else could use the exactly same nickname. If you want assurance of your identity, you are recommended to login before posting.) Login

RE: 3052FのRAM上でのHOS (2005-08-24 06:39 by hamayan #15992)

大分見えて来たかもしれませんね。

0x000fe402 kernel_int_sp
ですが、すでにご存知の様に、今まで実行してきたタスクコンテキストから、非タスクコンテキスト部に切り替える時に、タスクコンテキスト部のスタックを保存する領域なので、当然ここが見つからなければ、暴走します。おそらく非タスクコンテキスト部から、タスクコンテキスト部に戻った時に。
つまりこれは、pacint.sから参照されている領域です。

HOSのサンプルでは、crt0で領域の確保を行っていたりしますが、pacint.sからの参照が解決されるようになんとかすれば良いと言う事になります。
Reply to #15980

Reply to #15992×

You can not use Wiki syntax
You are not logged in. To discriminate your posts from the rest, you need to pick a nickname. (The uniqueness of nickname is not reserved. It is possible that someone else could use the exactly same nickname. If you want assurance of your identity, you are recommended to login before posting.) Login

RE: 3052FのRAM上でのHOS (2005-08-24 06:42 by hamayan #15993)

追伸
kernel_int_sp は、
_kernel_int_sp と、アンダースコアが有った様な。
Reply to #15992

Reply to #15993×

You can not use Wiki syntax
You are not logged in. To discriminate your posts from the rest, you need to pick a nickname. (The uniqueness of nickname is not reserved. It is possible that someone else could use the exactly same nickname. If you want assurance of your identity, you are recommended to login before posting.) Login