Nios® V プロセッサー・ソフトウェア開発者ハンドブック

ID 743810
日付 7/08/2024
Public
ドキュメント目次

5.2.3.3.2. 新しい領域とセクションの作成に向けたリンカー領域の分割

この例は、Nios V プロセッサー命令マネージャーに接続された on_chip_mem という名前のオンチップメモリーを含む任意のハードウェア・デザインで動作します。

# Get region information for on_chip_mem memory region. # Returned as a list. set region_info [get_memory_region on_chip_mem] # Extract fields from region information list. set region_name [lindex $region_info 0] set slave [lindex $region_info 1] set offset [lindex $region_info 2] set span [lindex $region_info 3] # Remove the existing memory region. delete_memory_region $region_name # Compute memory ranges for replacement regions. set split_span 1024 set new_span [expr $span-$split_span] set split_offset [expr $offset+$new_span] # Create two memory regions out of the original region. add_memory_region on_chip_mem $slave $offset $new_span add_memory_region isrs_region $slave $split_offset $split_span add_section_mapping .isrs isrs_region 

上記の Tcl スクリプトは、on_chip_mem という名前の領域から 1 KB の RAM を分割し、それに isrs_region という名前を付けてから、add_section_mapping を呼び出して .isrs セクションを isrs_region に追加します。

新しい領域とセクションの作成 Tcl スクリプトの使用

Tcl スクリプトを使用するには、次の手順を実行します。
  1. 上記の例に示すように、Tcl スクリプトを作成します。
  2. 次の引数を niosv-bsp コマンドラインに追加します。

    --script=<script name>.tcl

  3. cmakemake を実行してアプリケーションをリビルドします。

オブジェクト・ダンプ・ファイルからの抜粋

cmake と make が正常に完了したら、オブジェクト・ダンプ・ファイル <project_name> .objdump を調べることができます。オブジェクト・ダンプ・ファイルは、新しい .isrs セクションが on_chip_mem あることを示しています。このオブジェクト・ダンプ・ファイルの抜粋は、アドレス範囲が 0x00010000 ~ 0x00019fff のオンチップメモリーを備えたハードウェア・デザインを示しています。

カスタマイズされたリンカーセクションは次のとおりです。
  • デフォルトのリンカーセクション (0x00010000 から 0x000192bf まで)
  • on_chip_mem 残りの on_chip_mem (0x000192c0 ~ 0x00019bff の範囲)
  • isrs カスタマイズされたリンカー領域 (0x00019c00 から 0x00019fff までの範囲)
Sections: Idx Name Size VMA LMA File off Algn . . 2 .isrs 00000000 00019c00 00019c00 00008770 2**0 CONTENTS . . 8 .on_chip_mem 00000000 000192c0 000192c0 00008770 2**0 CONTENTS . . SYMBOL TABLE: 00010000 l d .entry 00000000 .entry 00010020 l d .exceptions 00000000 .exceptions 00019c00 l d .isrs 00000000 .isrs 000102a0 l d .text 00000000 .text 00015cc0 l d .rodata 00000000 .rodata 00015cfc l d .rwdata 00000000 .rwdata 0001776c l d .init_array.00000 00000000 .init_array.00000 000191dc l d .bss 00000000 .bss 000192c0 l d .on_chip_mem 00000000 .on_chip_mem 
Linker.x からの抜粋

Linker.x からの抜粋

MEMORY { reset : ORIGIN = 0x10000, LENGTH = 32 on_chip_mem : ORIGIN = 0x10020, LENGTH = 39904 isrs_region : ORIGIN = 0x19c00, LENGTH = 1024 }