LoginSignup
2
1

More than 5 years have passed since last update.

Spartan6でmicroblaze mcs を動かす②SDK編

Last updated at Posted at 2017-10-08

Spartan6でmicroblaze mcs を動かす①ISE編のつづき

SDKプロジェクトの生成

FileNewApplication Projectを選択
sdk1.jpg

Project Name⇒好きな名前でOK
Target Hardwareで "Creare New"を選択(New Hardware Projectに移行し、ハードウェア情報を生成します)
sdk2.jpg

Project name⇒好きな名前でOK
BrowseからCPU情報をもつXMLファイルを選択する。
(CORE generaterでCPUを生成した際のワークディレクトリにあるXMLファイルを選択します)
sdk3.jpg

プログラムのテンプレートを選択します。
なにを選んでもOKですが、今回は"Hello world"をひな形にします。
sdk4.jpg

BMMファイルの編集

ハードウェアプロジェクトのディレクトリ(今回の例ではmcs_infoというディレクトリ)にsystem_bd.bmmというファイルがデフォルトで生成されています。

このBMMファイルは、Cのプログラムで使うメモリ領域と FPGA内部メモリ(BRAM)との関係示しています。
自動生成されたままだと、BRAMのロケーション(具体的な場所)が示されていないため、プログラムをアップロードする際にエラーになりますので、手動で編集します。

エラーになる原因は、FPGAの回路データ(bitファイル)にCで書いたプログラムの実行ファイル(elfファイル)を入れ込む処理(data2mem.exeが実行されるとき)をする際に、”elfファイルを張り付ける先のメモリの場所が分からないよ”的なエラーで怒られます。

編集後のBMMファイルを下記に示します。
編集した箇所は各行の LOC=X*Y*; の部分です。XYの数字はISEで合成する際に使用したUCFファイルの数値と合っていればOKです。

system_bd.bmm
ADDRESS_MAP CPU MICROBLAZE-LE 100
  ADDRESS_SPACE lmb_bram COMBINED [0x00000000:0x0000ffff]
    ADDRESS_RANGE RAMB16
      BUS_BLOCK
        mcs_0/U0/lmb_bram_I/RAM_Inst/Using_B16_S1.The_BRAMs[0].RAMB16_S1_1  [31:31] INPUT = CPU.lmb_bram_0.mem   LOC=X0Y30;
        mcs_0/U0/lmb_bram_I/RAM_Inst/Using_B16_S1.The_BRAMs[1].RAMB16_S1_1  [30:30] INPUT = CPU.lmb_bram_1.mem   LOC=X1Y30;
        mcs_0/U0/lmb_bram_I/RAM_Inst/Using_B16_S1.The_BRAMs[2].RAMB16_S1_1  [29:29] INPUT = CPU.lmb_bram_2.mem   LOC=X2Y30;
        mcs_0/U0/lmb_bram_I/RAM_Inst/Using_B16_S1.The_BRAMs[3].RAMB16_S1_1  [28:28] INPUT = CPU.lmb_bram_3.mem   LOC=X3Y30;
        mcs_0/U0/lmb_bram_I/RAM_Inst/Using_B16_S1.The_BRAMs[4].RAMB16_S1_1  [27:27] INPUT = CPU.lmb_bram_4.mem   LOC=X0Y28;
        mcs_0/U0/lmb_bram_I/RAM_Inst/Using_B16_S1.The_BRAMs[5].RAMB16_S1_1  [26:26] INPUT = CPU.lmb_bram_5.mem   LOC=X1Y28;
        mcs_0/U0/lmb_bram_I/RAM_Inst/Using_B16_S1.The_BRAMs[6].RAMB16_S1_1  [25:25] INPUT = CPU.lmb_bram_6.mem   LOC=X2Y28;
        mcs_0/U0/lmb_bram_I/RAM_Inst/Using_B16_S1.The_BRAMs[7].RAMB16_S1_1  [24:24] INPUT = CPU.lmb_bram_7.mem   LOC=X3Y28;
        mcs_0/U0/lmb_bram_I/RAM_Inst/Using_B16_S1.The_BRAMs[8].RAMB16_S1_1  [23:23] INPUT = CPU.lmb_bram_8.mem   LOC=X0Y26;
        mcs_0/U0/lmb_bram_I/RAM_Inst/Using_B16_S1.The_BRAMs[9].RAMB16_S1_1  [22:22] INPUT = CPU.lmb_bram_9.mem   LOC=X1Y26;
        mcs_0/U0/lmb_bram_I/RAM_Inst/Using_B16_S1.The_BRAMs[10].RAMB16_S1_1 [21:21] INPUT = CPU.lmb_bram_10.mem  LOC=X2Y26;
        mcs_0/U0/lmb_bram_I/RAM_Inst/Using_B16_S1.The_BRAMs[11].RAMB16_S1_1 [20:20] INPUT = CPU.lmb_bram_11.mem  LOC=X3Y26;
        mcs_0/U0/lmb_bram_I/RAM_Inst/Using_B16_S1.The_BRAMs[12].RAMB16_S1_1 [19:19] INPUT = CPU.lmb_bram_12.mem  LOC=X0Y24;
        mcs_0/U0/lmb_bram_I/RAM_Inst/Using_B16_S1.The_BRAMs[13].RAMB16_S1_1 [18:18] INPUT = CPU.lmb_bram_13.mem  LOC=X1Y24;
        mcs_0/U0/lmb_bram_I/RAM_Inst/Using_B16_S1.The_BRAMs[14].RAMB16_S1_1 [17:17] INPUT = CPU.lmb_bram_14.mem  LOC=X2Y24;
        mcs_0/U0/lmb_bram_I/RAM_Inst/Using_B16_S1.The_BRAMs[15].RAMB16_S1_1 [16:16] INPUT = CPU.lmb_bram_15.mem  LOC=X3Y24;
        mcs_0/U0/lmb_bram_I/RAM_Inst/Using_B16_S1.The_BRAMs[16].RAMB16_S1_1 [15:15] INPUT = CPU.lmb_bram_16.mem  LOC=X0Y22;
        mcs_0/U0/lmb_bram_I/RAM_Inst/Using_B16_S1.The_BRAMs[17].RAMB16_S1_1 [14:14] INPUT = CPU.lmb_bram_17.mem  LOC=X1Y22;
        mcs_0/U0/lmb_bram_I/RAM_Inst/Using_B16_S1.The_BRAMs[18].RAMB16_S1_1 [13:13] INPUT = CPU.lmb_bram_18.mem  LOC=X2Y22;
        mcs_0/U0/lmb_bram_I/RAM_Inst/Using_B16_S1.The_BRAMs[19].RAMB16_S1_1 [12:12] INPUT = CPU.lmb_bram_19.mem  LOC=X3Y22;
        mcs_0/U0/lmb_bram_I/RAM_Inst/Using_B16_S1.The_BRAMs[20].RAMB16_S1_1 [11:11] INPUT = CPU.lmb_bram_20.mem  LOC=X0Y20;
        mcs_0/U0/lmb_bram_I/RAM_Inst/Using_B16_S1.The_BRAMs[21].RAMB16_S1_1 [10:10] INPUT = CPU.lmb_bram_21.mem  LOC=X1Y20;
        mcs_0/U0/lmb_bram_I/RAM_Inst/Using_B16_S1.The_BRAMs[22].RAMB16_S1_1 [9:9]   INPUT = CPU.lmb_bram_22.mem  LOC=X2Y20;
        mcs_0/U0/lmb_bram_I/RAM_Inst/Using_B16_S1.The_BRAMs[23].RAMB16_S1_1 [8:8]   INPUT = CPU.lmb_bram_23.mem  LOC=X3Y20;
        mcs_0/U0/lmb_bram_I/RAM_Inst/Using_B16_S1.The_BRAMs[24].RAMB16_S1_1 [7:7]   INPUT = CPU.lmb_bram_24.mem  LOC=X0Y18;
        mcs_0/U0/lmb_bram_I/RAM_Inst/Using_B16_S1.The_BRAMs[25].RAMB16_S1_1 [6:6]   INPUT = CPU.lmb_bram_25.mem  LOC=X1Y18;
        mcs_0/U0/lmb_bram_I/RAM_Inst/Using_B16_S1.The_BRAMs[26].RAMB16_S1_1 [5:5]   INPUT = CPU.lmb_bram_26.mem  LOC=X2Y18;
        mcs_0/U0/lmb_bram_I/RAM_Inst/Using_B16_S1.The_BRAMs[27].RAMB16_S1_1 [4:4]   INPUT = CPU.lmb_bram_27.mem  LOC=X3Y18;
        mcs_0/U0/lmb_bram_I/RAM_Inst/Using_B16_S1.The_BRAMs[28].RAMB16_S1_1 [3:3]   INPUT = CPU.lmb_bram_28.mem  LOC=X0Y16;
        mcs_0/U0/lmb_bram_I/RAM_Inst/Using_B16_S1.The_BRAMs[29].RAMB16_S1_1 [2:2]   INPUT = CPU.lmb_bram_29.mem  LOC=X1Y16;
        mcs_0/U0/lmb_bram_I/RAM_Inst/Using_B16_S1.The_BRAMs[30].RAMB16_S1_1 [1:1]   INPUT = CPU.lmb_bram_30.mem  LOC=X2Y16;
        mcs_0/U0/lmb_bram_I/RAM_Inst/Using_B16_S1.The_BRAMs[31].RAMB16_S1_1 [0:0]   INPUT = CPU.lmb_bram_31.mem  LOC=X3Y16;
      END_BUS_BLOCK;
    END_ADDRESS_RANGE;
  END_ADDRESS_SPACE;
END_ADDRESS_MAP;

ここまででSDKの下準備が完了です。

2
1
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
2
1