目次

ニュース

日記カテゴリ

書庫

組み込み系の話ですけれど、私の場合電源を入れたときに初期値が設定されていて、その値を変更するとき以外は、再度初期化をしないし、レジスタの初期化も特に行いません。

CPUの説明書にRESET時が0x0000になっている場合は
 pREG = 0x0000
のような記述をしません。

ところが、いま見ているブートローダ(MBRみたいなやつ)には、
 pREGA = 0x0000
 pREGB = 0x0000
            ...
 pREGZ = 0x0000
のようにCPUの設定レジスタを全部初期値で上書きしています。

もちろん、やらないほうがよいかっていうとやったほうが良いのだろうけれど^-^;

このスタイルだと膨大なレジスタを持っているやつとかは果てしなく作業量が増えてしまうと思うのだけれど、

・CPUがこれで良いと言っているのだからわざわざソフト処理しない
・とにかく、リセット時に全部初期化するソフト処理を行う

どっちのほうがよいと思われます?

投稿日時 : 2007年7月31日 9:02
Feedback
  • # re: 初期値レジスタの再初期化
    黒龍
    Posted @ 2007/07/31 9:11
    割り込みハンドラ未設定やウォッチドッグ等諸々の理由で電源投入以外のケースでリセットベクタに飛ぶことがあるので初期化コードは入れることが多いです。とはいえ全部じゃ無くてそこで使うものだけだったりしますが。
  • # re: 初期値レジスタの再初期化
    Mr.T
    Posted @ 2007/07/31 9:11
    Mr.Tです、こんにちは。

    えー、無駄な電力を使わない派(オイということで、
    ソフト処理しないに一票。
    #処理しないと悪いことってなんですか?
  • # re: 初期値レジスタの再初期化
    凪瀬
    Posted @ 2007/07/31 10:54
    電源投入時のメモリの不定な値が神がかり的な確率でウィルス的挙動のプログラムになってネットワークを震撼させる…
    というSFネタを昔考えたことを思い出しました。
  • # re: 初期値レジスタの再初期化
    ながせ
    Posted @ 2007/07/31 11:41
    >黒龍さん
    基本的には使うものだけ再設定で問題ないですよね?
    電源降下によるNMI割込み -> RESET割込み っていう大技もありますが。

    >Mr.Tさん
    処理しないと悪いこと。なんでしょー。
    電源投入時の一瞬のメモリの不定な..。もしくはレジスタの中身が壊れるとか。それ言い始めたらRAM自体が信用できん^^;

    >凪瀬さん
    なんかつい最近テレビで見たことのあるような。
    涼宮ハルヒの憂鬱っていうアニメだったかなぁ。
  • # re: 初期値レジスタの再初期化
    凪瀬
    Posted @ 2007/07/31 15:29
    いや、ハルヒのはIT的にはありえない話だからたんなるファンタジー。
    ハルヒという少女が描いたエンブレムはたかだか数kByteの容量だけども、実際には莫大な情報を持っていて、ネットに巣食う情報思念体の残骸がそこに取り付いてエンブレムを見たものを襲うような内容だったかと。

    私のネタはサルにタイプライターの話と程近い、ありえないほど小さな確率のありえる話。いや、どうせファンタジーなんだけどさw
  • # re: 初期値レジスタの再初期化
    黒龍
    Posted @ 2007/07/31 17:36
    やっぱり○○レジスタも使っちゃおうとかなったときに所期か漏れせずにすむのでリセットベクタは全初期化したほうがいいかもしれませんね。ワーク(メモリ)の初期化も行うはずなのでそれに比べれば微々たるクロック数なので。
  • # re: 初期値レジスタの再初期化
    ながせ
    Posted @ 2007/07/31 21:42
    >凪瀬さん
    lim(x→0)とx=0とはまったく違うものということですね。
    前に「なぜ0で割ってはいけないのか」という話をおもいだしました。

    >黒龍さん
    Vectorテーブルは初期化したほうがよいですね、というかまとめて書くから自動的に初期化されるのかしら。
  • # Just desire to say your article is as surprising. The clarity in your post is simply spectacular and i can assume you are an expert on this subject. Fine with your permission allow me to grab your feed to keep up to date with forthcoming post. Thanks a
    Just desire to say your article is as surprising.
    Posted @ 2019/05/16 5:20
    Just desire to say your article is as surprising.
    The clarity in your post is simply spectacular and i can assume you
    are an expert on this subject. Fine with your permission allow
    me to grab your feed to keep up to date with forthcoming post.
    Thanks a million and please continue the gratifying work.
  • # You should be a part of a contest for one of the best blogs on the internet. I most certainly will highly recommend this blog!
    You should be a part of a contest for one of the b
    Posted @ 2019/06/06 13:05
    You should be a part of a contest for one of the best blogs on the internet.
    I most certainly will highly recommend this blog!
  • # Write more, thats all I have to say. Literally, it seems as though you relied on the video to make your point. You obviously know what youre talking about, why waste your intelligence on just posting videos to your weblog when you could be giving us so
    Write more, thats all I have to say. Literally, it
    Posted @ 2019/06/07 21:31
    Write more, thats all I have to say. Literally, it seems as though you relied on the video to make your point.
    You obviously know what youre talking about, why waste your intelligence on just posting videos to your weblog
    when you could be giving us something informative to
    read?
  • # Hello just wanted to give you a quick heads up. The text in your content seem to be running off the screen in Chrome. I'm not sure if this is a format issue or something to do with browser compatibility but I thought I'd post to let you know. The desig
    Hello just wanted to give you a quick heads up. Th
    Posted @ 2019/08/02 15:08
    Hello just wanted to give you a quick heads up. The text in your content seem to be running off the screen in Chrome.

    I'm not sure if this is a format issue or something to do with browser
    compatibility but I thought I'd post to let you know.
    The design and style look great though! Hope you
    get the issue resolved soon. Kudos plenty of fish natalielise
タイトル
名前
Url
コメント 

Blog 利用状況

コミュニティ

プロファイル