0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

RXマイコンのスタック

Last updated at Posted at 2024-08-26

RX210ではデフォルトで以下のようなリンカースクリプトが作られます。

        .ustack 0x200: AT(0x200)
        {
                _ustack = .;
        } > RAM
        .istack 0x100: AT(0x100)
        {
                _istack = .;
        } > RAM
        .data 0x204: AT(_mdata)
        {

ustackはユーザーモードのスタックでistackは例外および特権(スーパーバイザー)モードでのスタックです。

dataには初期化された変数とされてない変数(BSS)が含まれます。初期化された変数はROMからコピーされます。

スタックは物理メモリの最後ではなく先頭に設定されます。なのでサイズが重要です。こうすることでメモリサイズが変わったターゲットでも同じ設定でリンクできます。

実際のメモリ配置は以下のようになります。

RX-STACK.png

常に特権モードでユーザーモードに入らない場合は、ustackは使われないものと思われます。

GR-CIRTUSは物理メモリの最後にスタックを設定していました。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?