GCC for RXにおけるmotファイルのアドレス指定について

はじめまして、こんにちは。エスです。初投稿です。

e2 studio上で、ビルド後にmotファイル(モトローラS形式ファイル)を出力しているのですが、このmotファイルの内容を指定したアドレス範囲(例:FFF0 0000h~FFFF FFFFh)のみ含むように出力させたいと考えてます。

ツールチェインがCC-RXの場合は、プロジェクトのプロパティから「C/C++ビルド」→「ツール設定」→「Converter」→「出力」で「モトローラS形式ファイルを出力する」にチェックを入れ、「分割出力ファイル (Stype用)」に
「-output=Sample.mot=fff00000-ffffffff」と入力することにより、FFF0 0000h~FFFF FFFFhの範囲のみのsample.motという名前のmotファイルを出力することができました。

GCCの場合、設定方法が分からず困っています。

GCCプロジェクトのプロパティを開き、「C/C++ビルド」→「設定」→「ツール設定」→「Objcopy」→「General」で「OutFormat」を「Motorola S-record(srec)」に選択し、「User defines option」になにかしらを入れるのではないかと思っているのですが、そのなにかしらが分かっていません。

有識者の方、ご教授お願い致します。

Parents
  • エスさん、こんにちは。NoMaYと申します。

    e2 studioで、User defined option欄に、以下のオプションを記述することでセクション単位で制御することになります。オプションではアドレス単位で制御出来なかったと思いますけれども、リンカスクリプトでセクション配置アドレスを制御することにより、間接的にですけれども、アドレス単位で制御出来るようになります。

    objcopy
    sourceware.org/binutils/docs-2.40/binutils/objcopy.html

    -j sectionpattern
    --only-section=sectionpattern

        Copy only the indicated sections from the input file to the output file. This option may be given more than once. Note that using this option inappropriately may make the output file unusable. Wildcard characters are accepted in sectionpattern.

        If the first character of sectionpattern is the exclamation point (!) then matching sections will not be copied, even if earlier use of --only-section on the same command line would otherwise copy it. For example:

          --only-section=.text.* --only-section=!.text.foo

        will copy all sectinos matching ’.text.*’ but not the section ’.text.foo’.


    -R sectionpattern
    --remove-section=sectionpattern

        Remove any section matching sectionpattern from the output file. This option may be given more than once. Note that using this option inappropriately may make the output file unusable. Wildcard characters are accepted in sectionpattern. Using both the -j and -R options together results in undefined behaviour.

        If the first character of sectionpattern is the exclamation point (!) then matching sections will not be removed even if an earlier use of --remove-section on the same command line would otherwise remove it. For example:

          --remove-section=.text.* --remove-section=!.text.foo

        will remove all sections matching the pattern ’.text.*’, but will not remove the section ’.text.foo’.


  • NoMaYさん

    ご教授ありがとうございます。

    これから試してみようと思います。

Reply Children
No Data