独自のメモリエリアの定義
このセクションの内容:
選択したデフォルトの設定ファイルには、ROMおよびRAM領域が事前に定義されています。この例は、以下の例の出発点として使用されます。特に指定がない限り、すべての例は 32 ビットモード用です。
/* Define the addressable memory. Optional in 32-bit mode. */
define memory with size = 4G;
/* Define a region named ROM with start address 0 and to be 64 Kbytes large */
define region ROM = [from 0 size 0x10000];
/* Define a region named RAM with start address 0x20000 and to be 64 Kbytes large */
define region RAM = [from 0x20000 size 0x10000];各領域定義は、実際のハードウェアに合わせて調整する必要があります。
リンク後のコードおよびデータがどのくらいのメモリを占有するかを確認するには、マップファイルのメモリ概要(コマンドラインオプション‑‑map)を参照してください。
領域の追加
領域を追加するには、define regionディレクティブを使用します。以下に例を示します。
/* Define a 2nd ROM region to start at address 0x80000 and to be 128 Kbytes large */ define region ROM2 = [from 0x80000 size 0x20000];
異なるエリアを1つの領域にマージする
領域が複数のエリアで構成されている場合、Region式を使用して、異なるエリアを1つの領域にマージできます。以下に例を示します。
/* Define the 2nd ROM region to have two areas. The first with the
start address 0x80000 and 128 Kbytes large, and the 2nd with the start
address 0xC0000 and 32 Kbytes large */
define region ROM2 = [from 0x80000 size 0x20000]
| [from 0xC0000 size 0x08000];以下の例も同じです。
define region ROM2 = [from 0x80000 to 0xC7FFF]
–[from 0xA0000 to 0xBFFFF];