FC2カウンター FPGAの部屋 SDKでDevice Treeを生成する1(Device Tree の概要)
fc2ブログ

FPGAやCPLDの話題やFPGA用のツールの話題などです。 マニアックです。 日記も書きます。

FPGAの部屋

FPGAの部屋の有用と思われるコンテンツのまとめサイトを作りました。Xilinx ISEの初心者の方には、FPGAリテラシーおよびチュートリアルのページをお勧めいたします。

SDKでDevice Treeを生成する1(Device Tree の概要)

Device Tree とは、Linuxカーネルにハードウェアの情報を伝えるファイルのことだそうだ。英語では、OMAPpediaDevice Tree、日本語では、Device Tree を参照した。
Device Tree はLinux の起動メッセージ(dmesg) を見る限りは、U-Bootで読み込んでいると思うのだがどうだろうか?
下にZedBoardの起動メッセージの一部を示す。

U-Boot 2012.04.01-00297-gc319bf9-dirty (Sep 13 2012 - 09:30:49)

DRAM: 512 MiB
WARNING: Caches not enabled
MMC: SDHCI: 0
Using default environment

In: serial
Out: serial
Err: serial
Net: zynq_gem
Hit any key to stop autoboot: 0
Copying Linux from SD to RAM...
Device: SDHCI
Manufacturer ID: 73
OEM: 4247
Name: NCard
Tran Speed: 25000000
Rd Block Len: 512
SD version 1.0
High Capacity: Yes
Capacity: 7.5 GiB
Bus Width: 1-bit
reading zImage

2449976 bytes read
reading devicetree_ramdisk.dtb

5817 bytes read

reading ramdisk8M.image.gz

3699284 bytes read
## Starting application at 0x00008000 ...
Uncompressing Linux... done, booting the kernel.
[ 0.000000] Booting Linux on physical CPU 0


LinuxをUncompressing する前に、devicetree_ramdisk.dtbを読んでいる。
ちなみに、.dtb は、”device tree blob”と呼ばれるバイナリファイルで、カーネルにマージされるそうだ。このファイルは、Digilent社のZedBoardのWebページThis zip file contains the Out Of Box (OOB) SD card image and source.(ZIPファイル注意)の ZedBoard_OOB_Desin/sd_image の下にある。そのDevice Tree のソースファイルは、devicetree_ramdisk.dts で ZedBoard_OOB_Desin/linux にある。.dts は、”device tree source”の略だそうだ。
.dts はDTC (Device Tree Compiler) でコンパイルされて .dtb に変換される。逆変換もできるそうだ。DTCについては、DTC (Device Tree Compiler) を参照した。
dtc は、linux-digilent-master/scripts/dtc に下にある。これについては、XilinxのPowerPC U-boot の Building A Device Tree Blob を参考にした。

devicetree_ramdisk.dts の一部を見てみよう。AXI VDMAの記述を見ることにした。下に引用する。

        axi_vdma: axivdma@43000000 {
            #address-cells = <0x1>;
            #size-cells = <0x1>;
            #dma-cells = <0x1>;
            compatible = "xlnx,axi-vdma";
            reg = <0x43000000 0x1000>;
            xlnx,include-sg = <0x0>;
            xlnx,num-fstores = <0x3>;

            dma-channel@43000000 {
                compatible = "xlnx,axi-vdma-mm2s-channel";
                interrupts = <0x0 0x3b 0x4>;
                xlnx,datawidth = <0x40>;
                xlnx,genlock-mode = <0x0>;
                xlnx,include-dre = <0x0>;
            };
        };


AXI VDMAのレジスタのアドレスと領域も書かれている。XPSプロジェクトのAddressタブの画像を下に示す。
ISE_for_Linux_88_130310.png

自分で作ったXPSプロジェクトのカスタムIPの情報を devicetree_ramdisk.dts に追加して、dtc でコンパイルし、devicetree_ramdisk.dtb にして使用することを目的とする。
  1. 2013年03月10日 05:08 |
  2. Linux
  3. | トラックバック:0
  4. | コメント:0

コメント

コメントの投稿


管理者にだけ表示を許可する

トラックバック URL
https://marsee101.blog.fc2.com/tb.php/2407-2c9ce0a3
この記事にトラックバックする(FC2ブログユーザー)