SSブログ

ZedBoard Linux (3) [FPGA]

FPGAをカスタマイズしてみます。
…じゃなくて、標準デザインで色々付いてるPLのハードウェアを全部無くして、PSブロックだけで動作させます。自分のロジックを足すときのベースになります。だいたいZynqのチュートリアルに出てる手順です。

標準デザインではProject NavigatorやPlanAheadを使わず、XPSだけでFPGAを作っています。あまり一般的では無いと思います。XPSで扱える形式(pcore)でしか作れず、階層化も困難です。マイコン形式のプロセッサを中心としたシステムがトップデザインになる場合は便利なのでしょう(Suzakuもこの形式だったと記憶してます)。自分としてはあまり便利と思わないのですが…
XPSもプロセッサをただの部品として扱い、接続することをメインに考えたツールになれば良いのになぁと思います。その点AlteraのQsys、SOPC Builderは好みです。

ということで、プロジェクトのトップはPlanAheadで作成します。
テンプレートで入ってるZedBoardをターゲットにして空のプロジェクトを作ります。Add Sources → Add or Create Embedded Sources → Create Sub-Design、「ps_module」とか名前付けてFinishするとXPSが立ち上がります。「PSを追加するか?」というダイアログが出てくるので、ここではYesです。
Image 001.png
ボードやLinuxへのインパクトは少なくしたいので、PSの設定は標準のデザインと同じにしたいところです。標準の設定をImportするのが一番簡単ですかね。色々な設定を忘れずにすみます。
「Import」アイコンを押すとこんな画面が出てきます。
Image 002.png
「User Template」の所に標準デザインのxmlを足します。これを選んでOKすると設定が反映されます。「System Template」の「ZedBoard Development Board Template」もだいたい同じ内容でした。
Image 003.png

ちょっと変更します。EMIO GPIOをFPGA内部で使えるようにします。
Image 004.png
EMIO GPIOを有効にして本数を指定します。
Image 005.png
外部ポートに出します。このときI/Oを出した場合はFPGAのI/Oピンに接続することになります。内部で使う場合は_I、_O、_Tをそれぞれ出します。_Iは入力、_Oは出力、_Tも出力として使えます。
アドレスは標準のまま。
Image 006.png
PLに渡すクロックは適当に設定します。外部の33.333MHzを基準にした周波数が作れます。
Image 007.png

XPSを閉じるとPlanAheadに戻ります。
できた「Design Sources」の「ps_module」を右クリックして「Create Top HDL」を選びます。「ps_module_stub.v(vhd)」ができあがります。これをそのままトップとして使ってもかまいませんし、別途top.vを作ってもかまいません。_stubはPSを変更して「Create Top HDL」を行うたびに上書きされてしまうので、別途トップを作り、コピペすることにします。
module top
    (
        inout    wire    [53:0]    MIO,
        input    wire            PS_SRSTB,
        input    wire            PS_CLK,
        input    wire            PS_PORB,
        inout    wire            DDR_Clk,
        inout    wire            DDR_Clk_n,
        inout    wire            DDR_CKE,
        inout    wire            DDR_CS_n,
        inout    wire            DDR_RAS_n,
        inout    wire            DDR_CAS_n,
        output    wire            DDR_WEB,
        inout    wire    [2:0]    DDR_BankAddr,
        inout    wire    [14:0]    DDR_Addr,
        inout    wire            DDR_ODT,
        inout    wire            DDR_DRSTB,
        inout    wire    [31:0]    DDR_DQ,
        inout    wire    [3:0]    DDR_DM,
        inout    wire    [3:0]    DDR_DQS,
        inout    wire    [3:0]    DDR_DQS_n,
        inout    wire            DDR_VRN,
        inout    wire            DDR_VRP
    );

    wire    [63:0]    EMIO_GPIO_I;
    wire    [63:0]    EMIO_GPIO_O;
    wire    [63:0]    EMIO_GPIO_T;
    wire            FCLK_CLK0;
    wire            FCLK_CLK1;
    wire            FCLK_CLK2;
    wire            FCLK_CLK3;

    (* BOX_TYPE = "user_black_box" *)
    ps_module
    ps_module_i (
        .processing_system7_0_MIO            (MIO            ),
        .processing_system7_0_PS_SRSTB_pin    (PS_SRSTB        ),
        .processing_system7_0_PS_CLK_pin    (PS_CLK            ),
        .processing_system7_0_PS_PORB_pin    (PS_PORB        ),
        .processing_system7_0_DDR_Clk        (DDR_Clk        ),
        .processing_system7_0_DDR_Clk_n        (DDR_Clk_n        ),
        .processing_system7_0_DDR_CKE        (DDR_CKE        ),
        .processing_system7_0_DDR_CS_n        (DDR_CS_n        ),
        .processing_system7_0_DDR_RAS_n        (DDR_RAS_n        ),
        .processing_system7_0_DDR_CAS_n        (DDR_CAS_n        ),
        .processing_system7_0_DDR_WEB_pin    (DDR_WEB        ),
        .processing_system7_0_DDR_BankAddr    (DDR_BankAddr    ),
        .processing_system7_0_DDR_Addr        (DDR_Addr        ),
        .processing_system7_0_DDR_ODT        (DDR_ODT        ),
        .processing_system7_0_DDR_DRSTB        (DDR_DRSTB        ),
        .processing_system7_0_DDR_DQ        (DDR_DQ            ),
        .processing_system7_0_DDR_DM        (DDR_DM            ),
        .processing_system7_0_DDR_DQS        (DDR_DQS        ),
        .processing_system7_0_DDR_DQS_n        (DDR_DQS_n        ),
        .processing_system7_0_DDR_VRN        (DDR_VRN        ),
        .processing_system7_0_DDR_VRP        (DDR_VRP        ),
        .processing_system7_0_GPIO_I_pin    (EMIO_GPIO_I    ),
        .processing_system7_0_GPIO_O_pin    (EMIO_GPIO_O    ),
        .processing_system7_0_GPIO_T_pin    (EMIO_GPIO_T    ),
        .processing_system7_0_FCLK_CLK0_pin    (FCLK_CLK0        ),
        .processing_system7_0_FCLK_CLK1_pin    (FCLK_CLK1        ),
        .processing_system7_0_FCLK_CLK2_pin    (FCLK_CLK2        ),
        .processing_system7_0_FCLK_CLK3_pin    (FCLK_CLK3        )
    );

endmodule
PL内部ではなにもしていません。ハードマクロ側のピン名はどうでも良いみたいですw。

このままインプリします。ハードマクロ側のピンや制約は自動生成されます。というかピンは固定なので動きませんが。
なんとまぁ、これだけでCritical Warningが6個も出ます。PORBとSRSTBとCLKにIBUFが入らないよ~というワーニング。ハードマクロ側のピンなので手が出ません。Xilinxのアンサーでは「無視してくれ」とのこと。昔から似たようなバグがあり続けて一向に直る気配が無いんですが…
こういう、誰もが必ず当たるところにバグがあるから「Xilinxってまともに検証してないでしょ?他の所もバグだらけなんじゃね?」って疑ってしまうんですよ~実際あちらこちらにバグあるし。
CriticalでもWarningなので、そのままインプリは進みます。PLが空なので、実はビットストリームいりません。Zynqはハードマクロだけで動けます。

できあがったら、File → Export → Export Hardware for SDKを選びます。デフォルトでは「プロジェクト名.sdk\SDK\SDK_Export」にSDKのワークスペースができます。後はこれを元に(1)と同じ手順でFSBL~BOOT.BINを作ります。
今度は試しにWindows上のSDKで作ってみます。u-boot.elfはLinuxで作ったのをコピーしておきます。
Image 008.pngImage 009.pngImage 010.png
操作は全く同じ。「.\FSBL\bootimage\u-boot.bin」ができるのでこれをBOOT.BINにします。

DeviceTreeの編集。
やっぱりまだよくわからない点が多いので、標準の「devicetree.dts」を編集します。といってもハードマクロに載ってるペリフェラル以外を削除していくだけです。「ps7_ddr_0」や「ps7_axi_interconnect_0」など、「ps7_」で始まってるのはハードマクロのペリフェラルです。アドレスも決まってるので変更する必要ないです。それ以外のエントリー「axi_vdma_0」「axi_iic_hdmi」などを削除します。
/*
 * digilent-zed.dts - Default Device Tree for ZedBoard
 * 
 * (C) Copyright 2012 Digilent, Inc.
 * 
 * Code based on Device Tree Generator version: 1.1
 *
 * (C) Copyright 2007-2012 Xilinx, Inc.
 * (C) Copyright 2007-2012 Michal Simek
 * (C) Copyright 2007-2012 PetaLogix Qld Pty Ltd
 *
 * Michal SIMEK 
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation; either version 2 of
 * the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 * MA 02111-1307 USA
 *
 * CAUTION: This file is automatically generated by libgen.
 * Version: Xilinx EDK 14.4 EDK_P.49d
 * Today is: Wednesday, the 26 of December, 2012; 15:18:18
 *
 * XPS project directory: device-tree_bsp_0
 */

/dts-v1/;
/ {
	#address-cells = <1>;
	#size-cells = <1>;
	compatible = "xlnx,zynq-zed";
	model = "Xilinx Zynq ZED";

	aliases {
		ethernet0 = &ps7_ethernet_0;
		serial0 = &ps7_uart_1;
	};

	chosen {
		/*bootargs = "console=ttyPS0,115200 root=/dev/mmcblk0p2 rw earlyprintk rootfstype=ext4 rootwait devtmpfs.mount=1";*/
		bootargs = "console=ttyPS0,115200 root=/dev/ram rw initrd=0x800000,8M earlyprintk rootwait devtmpfs.mount=1";
		linux,stdout-path = "/axi@0/serial@e0001000";
	};

	cpus {
		#address-cells = <1>;
		#cpus = <0x2>;
		#size-cells = <0>;
		ps7_cortexa9_0: cpu@0 {
			clock-frequency = <666666687>;
			compatible = "xlnx,ps7-cortexa9-1.00.a";
			d-cache-line-size = <0x20>;
			d-cache-size = <0x8000>;
			device_type = "cpu";
			i-cache-line-size = <0x20>;
			i-cache-size = <0x8000>;
			model = "ps7_cortexa9,1.00.a";
			reg = <0>;
			timebase-frequency = <333333343>;
			xlnx,cpu-1x-clk-freq-hz = <0x69f6bcb>;
			xlnx,cpu-clk-freq-hz = <0x27bc86bf>;
		};
		ps7_cortexa9_1: cpu@1 {
			clock-frequency = <666666687>;
			compatible = "xlnx,ps7-cortexa9-1.00.a";
			d-cache-line-size = <0x20>;
			d-cache-size = <0x8000>;
			device_type = "cpu";
			i-cache-line-size = <0x20>;
			i-cache-size = <0x8000>;
			model = "ps7_cortexa9,1.00.a";
			reg = <1>;
			timebase-frequency = <333333343>;
			xlnx,cpu-1x-clk-freq-hz = <0x69f6bcb>;
			xlnx,cpu-clk-freq-hz = <0x27bc86bf>;
		};
	};

	ps7_ddr_0: memory@0 {
		device_type = "memory";
		reg = < 0x0 0x20000000 >;
	};

	ps7_axi_interconnect_0: axi@0 {
		#address-cells = <1>;
		#size-cells = <1>;
		compatible = "xlnx,ps7-axi-interconnect-1.00.a", "simple-bus";
		ranges;

		/* PS system internal devices */
		ps7_afi_0: ps7-afi@f8008000 {
			compatible = "xlnx,ps7-afi-1.00.a";
			reg = < 0xf8008000 0x1000 >;
		};
		ps7_afi_1: ps7-afi@f8009000 {
			compatible = "xlnx,ps7-afi-1.00.a";
			reg = < 0xf8009000 0x1000 >;
		};
		ps7_afi_2: ps7-afi@f800a000 {
			compatible = "xlnx,ps7-afi-1.00.a";
			reg = < 0xf800a000 0x1000 >;
		};
		ps7_afi_3: ps7-afi@f800b000 {
			compatible = "xlnx,ps7-afi-1.00.a";
			reg = < 0xf800b000 0x1000 >;
		};

		ps7_ddrc_0: ps7-ddrc@f8006000 {
			compatible = "xlnx,ps7-ddrc-1.00.a";
			reg = < 0xf8006000 0x1000 >;
			xlnx,has-ecc = <0x0>;
		};

		ps7_dev_cfg_0: ps7-dev-cfg@f8007000 {
			compatible = "xlnx,ps7-dev-cfg-1.00.a";
			interrupt-parent = <&ps7_scugic_0>;
			interrupts = < 0 8 4 >;
			reg = < 0xf8007000 0x1000 >;
		};

		ps7_dma_ns: ps7-dma@f8004000 {
			compatible = "xlnx,ps7-dma-1.00.a", "arm,pl330";
			interrupt-parent = <&ps7_scugic_0>;
			interrupts = < 0 13 4 0 14 4 0 15 4 0 16 4 0 17 4 0 40 4 0 41 4 0 42 4 0 43 4 >;
			reg = < 0xf8004000 0x1000 >;
		};

		ps7_dma_s: ps7-dma@f8003000 {
			compatible = "xlnx,ps7-dma-1.00.a", "arm,pl330";
			interrupt-parent = <&ps7_scugic_0>;
			interrupts = < 0 13 4 0 14 4 0 15 4 0 16 4 0 17 4 0 40 4 0 41 4 0 42 4 0 43 4 >;
			reg = < 0xf8003000 0x1000 >;
		};

		ps7_ethernet_0: ps7-ethernet@e000b000 {
			#address-cells = <1>;
			#size-cells = <0>;
			compatible = "xlnx,ps7-ethernet-1.00.a";
			interrupt-parent = <&ps7_scugic_0>;
			interrupts = < 0 22 4 >;
			local-mac-address = [ 00 0a 35 00 00 00 ];
			phy-handle = <&phy0>;
			reg = < 0xe000b000 0x1000 >;
			xlnx,enet-clk-freq-hz = <0x7735940>;
			xlnx,enet-reset = <0xffffffff>;
			xlnx,enet-slcr-1000mbps-div0 = <0x8>;
			xlnx,enet-slcr-1000mbps-div1 = <0x1>;
			xlnx,enet-slcr-100mbps-div0 = <0x8>;
			xlnx,enet-slcr-100mbps-div1 = <0x5>;
			xlnx,enet-slcr-10mbps-div0 = <0x8>;
			xlnx,enet-slcr-10mbps-div1 = <0x32>;
			xlnx,eth-mode = <0x1>;
			xlnx,has-mdio = <0x1>;
			xlnx,ptp-enet-clock = <111111115>;

			mdio {
				#address-cells = <1>;
				#size-cells = <0>;
				phy0: phy@0 {
					compatible = "marvell,88e1510";
					device_type = "ethernet-phy";
					reg = <0>;
					marvell,reg-init = <0x3 0x10 0xff00 0x1e 0x3 0x11 0xfff0 0xa>;
				};
			};
		};

		ps7_gpio_0: ps7-gpio@e000a000 {
			#gpio-cells = <2>;
			compatible = "xlnx,ps7-gpio-1.00.a";
			emio-gpio-width = <60>;
			gpio-controller;
			gpio-mask-high = <0xc0000>;
			gpio-mask-low = <0xfe81>;
			interrupt-parent = <&ps7_scugic_0>;
			interrupts = < 0 20 4 >;
			reg = < 0xe000a000 0x1000 >;
		};

		ps7_iop_bus_config_0: ps7-iop-bus-config@e0200000 {
			compatible = "xlnx,ps7-iop-bus-config-1.00.a";
			reg = < 0xe0200000 0x1000 >;
		};

		ps7_pl310_0: ps7-pl310@f8f02000 {
			arm,data-latency = < 3 2 2 >;
			arm,tag-latency = < 2 2 2 >;
			cache-level = < 2 >;
			cache-unified;
			compatible = "xlnx,ps7-pl310-1.00.a", "arm,pl310-cache";
			reg = < 0xf8f02000 0x1000 >;
		};

		ps7_qspi_0: ps7-qspi@e000d000 {
			bus-num = <0>;
			compatible = "xlnx,ps7-qspi-1.00.a";
			interrupt-parent = <&ps7_scugic_0>;
			interrupts = < 0 19 4 >;
			is-dual = <0>;
			num-chip-select = <1>;
			reg = < 0xe000d000 0x1000 >;
			speed-hz = <200000000>;
			xlnx,fb-clk = <0x1>;
			xlnx,qspi-clk-freq-hz = <0xbebc200>;
			xlnx,qspi-mode = <0x0>;
		};

		ps7_qspi_linear_0: ps7-qspi-linear@fc000000 {
			compatible = "xlnx,ps7-qspi-linear-1.00.a";
			reg = < 0xfc000000 0x1000000 >;
			xlnx,qspi-clk-freq-hz = <0xe4e1c0>;
		};

		ps7_scugic_0: ps7-scugic@f8f01000 {
			#address-cells = < 2 >;
			#interrupt-cells = < 3 >;
			#size-cells = < 1 >;
			compatible = "xlnx,ps7-scugic-1.00.a", "arm,cortex-a9-gic", "arm,gic";
			interrupt-controller;
			linux,phandle = < 0x1 >;
			phandle = < 0x1 >;
			reg = < 0xf8f01000 0x1000 0xf8f00100 0x100 >;
		};

		ps7_scutimer_0: ps7-scutimer@f8f00600 {
			clock-frequency = <333333343>;
			compatible = "xlnx,ps7-scutimer-1.00.a", "arm,cortex-a9-twd-timer";
			interrupt-parent = <&ps7_scugic_0>;
			interrupts = < 1 13 769 >;
			reg = < 0xf8f00600 0x20 >;
		};

		ps7_scuwdt_0: ps7-scuwdt@f8f00620 {
			clock-frequency = <333333343>;
			/* clock-frequency = <111111111>; */
			compatible = "xlnx,ps7-scuwdt-1.00.a";
			device_type = "watchdog";
			interrupt-parent = <&ps7_scugic_0>;
			interrupts = < 1 14 769 >;
			reg = < 0xf8f00620 0xe0 >;
		};

		ps7_sd_0: ps7-sdio@e0100000 {
			clock-frequency = <50000000>;
			compatible = "xlnx,ps7-sdio-1.00.a", "generic-sdhci";
			interrupt-parent = <&ps7_scugic_0>;
			interrupts = < 0 24 4 >;
			reg = < 0xe0100000 0x1000 >;
			xlnx,has-cd = <0x1>;
			xlnx,has-power = <0x0>;
			xlnx,has-wp = <0x1>;
			xlnx,sdio-clk-freq-hz = <0x2faf080>;
			/* clock-frequency = <0x1fc9f08>; */
		};

		ps7_slcr_0: ps7-slcr@f8000000 {
			compatible = "xlnx,ps7-slcr-1.00.a";
			reg = < 0xf8000000 0x1000 >;
		};

		ps7_ttc_0: ps7-ttc@f8001000 {
			clock-frequency = <111111115>;
			clock-frequency-timer0 = <111111115>;
			clock-frequency-timer1 = <111111115>;
			clock-frequency-timer2 = <111111115>;
			compatible = "xlnx,ps7-ttc-1.00.a";
			interrupt-parent = <&ps7_scugic_0>;
			interrupts = < 0 10 4 0 11 4 0 12 4 >;
			reg = < 0xf8001000 0x1000 >;
			xlnx,ttc-clk0-clksrc = <0x0>;
			xlnx,ttc-clk0-freq-hz = <0x69f6bcb>;
			xlnx,ttc-clk1-clksrc = <0x0>;
			xlnx,ttc-clk1-freq-hz = <0x69f6bcb>;
			xlnx,ttc-clk2-clksrc = <0x0>;
			xlnx,ttc-clk2-freq-hz = <0x69f6bcb>;
		};

		ps7_uart_1: serial@e0001000 {
			clock = <50000000>;
			clock-frequency = <50000000>;
			compatible = "xlnx,ps7-uart-1.00.a", "xlnx,xuartps";
			current-speed = <115200>;
			device_type = "serial";
			interrupt-parent = <&ps7_scugic_0>;
			interrupts = < 0 50 4 >;
			port-number = <0>;
			reg = < 0xe0001000 0x1000 >;
			xlnx,has-modem = <0x0>;
			xlnx,uart-clk-freq-hz = <0x2faf080>;
		};

		ps7_usb_0: ps7-usb@e0002000 {
			compatible = "xlnx,ps7-usb-1.00.a";
			dr_mode = "host";
			interrupt-parent = <&ps7_scugic_0>;
			interrupts = < 0 21 4 >;
			phy_type = "ulpi";
			reg = < 0xe0002000 0x1000 >;
			xlnx,usb-reset = <0xffffffff>;
		};

		ps7_xadc: ps7_xadc@f8007100 {
			compatible = "xlnx,ps7-xadc-1.00.a";
			interrupts = < 0 7 4 >;
			reg = < 0xf8007100 0x20 >;
		};

	};
};
以前と同様に
~/linux-digilent/scripts/dtc/dtc -I dts -O dtb -o devicetree.dtb devicetree.dts
でdtbにコンパイル。

これで必要なファイルがそろったので、SDカードにコピーします。zImageとramdiskは前のままです。
U-Boot 2012.04.01 (Sep 25 2013 - 00:19:21)

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: 1d
OEM: 4144
Name: SD
Tran Speed: 25000000
Rd Block Len: 512
SD version 1.10
High Capacity: No
Capacity: 1.9 GiB
Bus Width: 4-bit
reading zImage

2527040 bytes read
reading devicetree.dtb

6481 bytes read
reading ramdisk8M.image.gz

3698068 bytes read
## Starting application at 0x00008000 ...
Uncompressing Linux... done, booting the kernel.
[    0.000000] Booting Linux on physical CPU 0
[    0.000000] Linux version 3.6.0-digilent-13.01-00002-g06b3889 (develop@vm-ubuntu) (gcc version 4.7.2 (Sourcery CodeBench Lite 2012.09-104) ) #1 SMP PREEMPT Wed Sep 25 00:32:40 JST 2013
[    0.000000] CPU: ARMv7 Processor [413fc090] revision 0 (ARMv7), cr=18c5387d
[    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[    0.000000] Machine: Xilinx Zynq Platform, model: Xilinx Zynq ZED
[    0.000000] Memory policy: ECC disabled, Data cache writealloc
[    0.000000] PERCPU: Embedded 7 pages/cpu @c1408000 s6976 r8192 d13504 u32768
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 130048
[    0.000000] Kernel command line: console=ttyPS0,115200 root=/dev/ram rw initrd=0x800000,8M earlyprintk rootwait devtmpfs.mount=1
[    0.000000] PID hash table entries: 2048 (order: 1, 8192 bytes)
[    0.000000] Dentry cache hash table entries: 65536 (order: 6, 262144 bytes)
[    0.000000] Inode-cache hash table entries: 32768 (order: 5, 131072 bytes)
[    0.000000] Memory: 512MB = 512MB total
[    0.000000] Memory: 506432k/506432k available, 17856k reserved, 0K highmem
[    0.000000] Virtual kernel memory layout:
[    0.000000]     vector  : 0xffff0000 - 0xffff1000   (   4 kB)
[    0.000000]     fixmap  : 0xfff00000 - 0xfffe0000   ( 896 kB)
[    0.000000]     vmalloc : 0xe0800000 - 0xfd000000   ( 456 MB)
[    0.000000]     lowmem  : 0xc0000000 - 0xe0000000   ( 512 MB)
[    0.000000]     pkmap   : 0xbfe00000 - 0xc0000000   (   2 MB)
[    0.000000]     modules : 0xbf000000 - 0xbfe00000   (  14 MB)
[    0.000000]       .text : 0xc0008000 - 0xc0473a60   (4527 kB)
[    0.000000]       .init : 0xc0474000 - 0xc0499b40   ( 151 kB)
[    0.000000]       .data : 0xc049a000 - 0xc04d4ae0   ( 235 kB)
[    0.000000]        .bss : 0xc04d4b04 - 0xc04ee100   ( 102 kB)
[    0.000000] Preemptible hierarchical RCU implementation.
[    0.000000]  Dump stacks of tasks blocking RCU-preempt GP.
[    0.000000]  RCU restricting CPUs from NR_CPUS=4 to nr_cpu_ids=2.
[    0.000000] NR_IRQS:512
[    0.000000] Zynq clock init
[    0.000000] xlnx,ps7-ttc-1.00.a #0 at 0xe0800000, irq=43
[    0.000000] sched_clock: 32 bits at 100 Hz, resolution 10000000ns, wraps every 4294967286ms
[    0.000000] Console: colour dummy device 80x30
[    0.090000] Calibrating delay loop... 1332.01 BogoMIPS (lpj=6660096)
[    0.090000] pid_max: default: 32768 minimum: 301
[    0.090000] Mount-cache hash table entries: 512
[    0.090000] CPU: Testing write buffer coherency: ok
[    0.090000] CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
[    0.090000] hw perfevents: enabled with ARMv7 Cortex-A9 PMU driver, 7 counters available
[    0.090000] Setting up static identity map for 0x32be88 - 0x32bebc
[    0.090000] L310 cache controller enabled
[    0.090000] l2x0: 8 ways, CACHE_ID 0x410000c8, AUX_CTRL 0x72360000, Cache size: 524288 B
[    0.130000] Map SLCR registers
[    0.130000] CPU1: Booted secondary processor
[    0.220000] CPU1: thread -1, cpu 1, socket 0, mpidr 80000001
[    0.220000] Brought up 2 CPUs
[    0.220000] SMP: Total of 2 processors activated (2664.03 BogoMIPS).
[    0.220000] devtmpfs: initialized
[    0.220000] NET: Registered protocol family 16
[    0.220000] DMA: preallocated 256 KiB pool for atomic coherent allocations
[    0.220000] xgpiops e000a000.ps7-gpio: gpio at 0xe000a000 mapped to 0xe084a000
[    0.230000] registering platform device 'pl330' id 0
[    0.230000] registering platform device 'arm-pmu' id 0
[    0.230000] registering platform device 'zynq-dvfs' id 0
[    0.230000]
[    0.230000] ###############################################
[    0.230000] #                                             #
[    0.230000] #                Board ZED Init               #
[    0.230000] #                                             #
[    0.230000] ###############################################
[    0.230000]
[    0.230000] hw-breakpoint: found 5 (+1 reserved) breakpoint and 1 watchpoint registers.
[    0.230000] hw-breakpoint: maximum watchpoint size is 4 bytes.
[    0.250000] xslcr xslcr.0: at 0xF8000000 mapped to 0xF8000000
[    0.260000] bio: create slab  at 0
[    0.270000] SCSI subsystem initialized
[    0.270000] usbcore: registered new interface driver usbfs
[    0.270000] usbcore: registered new interface driver hub
[    0.270000] usbcore: registered new device driver usb
[    0.270000] Advanced Linux Sound Architecture Driver Version 1.0.25.
[    0.270000] Switching to clocksource xttcpss_timer1
[    0.280000] NET: Registered protocol family 2
[    0.280000] TCP established hash table entries: 16384 (order: 5, 131072 bytes)
[    0.280000] TCP bind hash table entries: 16384 (order: 5, 131072 bytes)
[    0.280000] TCP: Hash tables configured (established 16384 bind 16384)
[    0.280000] TCP: reno registered
[    0.280000] UDP hash table entries: 256 (order: 1, 8192 bytes)
[    0.280000] UDP-Lite hash table entries: 256 (order: 1, 8192 bytes)
[    0.280000] NET: Registered protocol family 1
[    0.280000] RPC: Registered named UNIX socket transport module.
[    0.280000] RPC: Registered udp transport module.
[    0.280000] RPC: Registered tcp transport module.
[    0.280000] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    0.280000] Trying to unpack rootfs image as initramfs...
[    0.280000] rootfs image is not initramfs (no cpio magic); looks like an initrd
[    0.320000] Freeing initrd memory: 8192K
[    0.320000] pl330 dev 0 probe success
[    0.320000] msgmni has been set to 1005
[    0.320000] io scheduler noop registered
[    0.320000] io scheduler deadline registered
[    0.320000] io scheduler cfq registered (default)
[    0.320000] e0001000.serial: ttyPS0 at MMIO 0xe0001000 (irq = 82) is a xuartps
[    0.830000] console [ttyPS0] enabled
[    0.840000] xdevcfg f8007000.ps7-dev-cfg: ioremap f8007000 to e0850000 with size 1000
[    0.840000] [drm] Initialized drm 1.1.0 20060810
[    0.860000] brd: module loaded
[    0.870000] loop: module loaded
[    0.870000] xqspips e000d000.ps7-qspi: master is unqueued, this is deprecated
[    0.880000] xqspips e000d000.ps7-qspi: at 0xE000D000 mapped to 0xE0852000, irq=51
[    0.890000] libphy: XEMACPS mii bus: probed
[    0.900000] xemacps e000b000.ps7-ethernet: pdev->id -1, baseaddr 0xe000b000, irq 54
[    0.900000] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    0.910000] usb_hcd_xusbps_probe: No OTG assigned!
[    0.910000] usb_hcd_xusbps_probe: OTG now assigned!
[    0.920000] xusbps-ehci xusbps-ehci.0: Xilinx PS USB EHCI Host Controller
[    0.930000] xusbps-ehci xusbps-ehci.0: new USB bus registered, assigned bus number 1
[    0.960000] xusbps-ehci xusbps-ehci.0: irq 53, io mem 0x00000000
[    0.980000] xusbps-ehci xusbps-ehci.0: USB 2.0 started, EHCI 1.00
[    0.980000] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
[    0.990000] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    1.000000] usb usb1: Product: Xilinx PS USB EHCI Host Controller
[    1.000000] usb usb1: Manufacturer: Linux 3.6.0-digilent-13.01-00002-g06b3889 ehci_hcd
[    1.010000] usb usb1: SerialNumber: xusbps-ehci.0
[    1.010000] hub 1-0:1.0: USB hub found
[    1.020000] hub 1-0:1.0: 1 port detected
[    1.020000] Initializing USB Mass Storage driver...
[    1.030000] usbcore: registered new interface driver usb-storage
[    1.030000] USB Mass Storage support registered.
[    1.040000] mousedev: PS/2 mouse device common for all mice
[    1.040000] sdhci: Secure Digital Host Controller Interface driver
[    1.050000] sdhci: Copyright(c) Pierre Ossman
[    1.060000] sdhci-pltfm: SDHCI platform and OF driver helper
[    1.060000] mmc0: Invalid maximum block size, assuming 512 bytes
[    1.110000] mmc0: SDHCI controller on e0100000.ps7-sdio [e0100000.ps7-sdio] using ADMA
[    1.120000] usbcore: registered new interface driver usbhid
[    1.130000] usbhid: USB HID core driver
[    1.140000] TCP: cubic registered
[    1.150000] NET: Registered protocol family 17
[    1.150000] VFP support v0.3: implementor 41 architecture 3 part 30 variant 9 rev 4
[    1.160000] Registering SWP/SWPB emulation handler
[    1.160000] registered taskstats version 1
[    1.170000] drivers/rtc/hctosys.c: unable to open rtc device (rtc0)
[    1.170000] mmc0: SD Status: Invalid Allocation Unit size.
[    1.180000] mmc0: new high speed SD card at address b368
[    1.180000] mmcblk0: mmc0:b368 SD    1.86 GiB
[    1.190000] ALSA device list:
[    1.190000]  mmcblk0: p1
[    1.190000]   No soundcards found.
[    1.200000] RAMDISK: gzip image found at block 0
[    1.510000] EXT4-fs (ram0): couldn't mount as ext3 due to feature incompatibilities
[    1.570000] EXT4-fs (ram0): mounting ext2 file system using the ext4 subsystem
[    1.570000] EXT4-fs (ram0): warning: mounting unchecked fs, running e2fsck is recommended
[    1.580000] EXT4-fs (ram0): mounted filesystem without journal. Opts: (null)
[    1.590000] VFS: Mounted root (ext2 filesystem) on device 1:0.
[    1.590000] devtmpfs: mounted
[    1.600000] Freeing init memory: 148K
Starting rcS...
++ Mounting filesystem
++ Setting up mdev
++ Configure static IP 192.168.1.10
++ Starting telnet daemon
++ Starting http daemon
++ Starting ftp daemon
++ Starting dropbear (ssh) daemon
++ Starting OLED Display
insmod: can't read '/lib/modules/3.6.0-digilent-13.01-00002-g06b3889/pmodoled-gpio.ko': No such file or directory
++ Exporting LEDs & SWs
rcS Complete
zynq> [    6.820000] xemacps e000b000.ps7-ethernet: Set clk to 124999998 Hz
[    6.820000] xemacps e000b000.ps7-ethernet: link up (1000/FULL)
なんか普通に立ち上がっちゃったので、逆に不安ですが…HDMIにペンギンマークも出ませんし、OLEDにロゴも出てこないので、変更後のハードウェアになってるみたいです。
zynq> pwd
/proc/device-tree/axi@0
zynq> ls -l
total 0
-r--r--r--    1 root     0                4 Jan  1 00:07 #address-cells
-r--r--r--    1 root     0                4 Jan  1 00:07 #size-cells
-r--r--r--    1 root     0               44 Jan  1 00:07 compatible
-r--r--r--    1 root     0                4 Jan  1 00:07 name
dr-xr-xr-x    2 root     0                0 Jan  1 00:07 ps7-afi@f8008000
dr-xr-xr-x    2 root     0                0 Jan  1 00:07 ps7-afi@f8009000
dr-xr-xr-x    2 root     0                0 Jan  1 00:07 ps7-afi@f800a000
dr-xr-xr-x    2 root     0                0 Jan  1 00:07 ps7-afi@f800b000
dr-xr-xr-x    2 root     0                0 Jan  1 00:07 ps7-ddrc@f8006000
dr-xr-xr-x    2 root     0                0 Jan  1 00:07 ps7-dev-cfg@f8007000
dr-xr-xr-x    2 root     0                0 Jan  1 00:07 ps7-dma@f8003000
dr-xr-xr-x    2 root     0                0 Jan  1 00:07 ps7-dma@f8004000
dr-xr-xr-x    3 root     0                0 Jan  1 00:07 ps7-ethernet@e000b000
dr-xr-xr-x    2 root     0                0 Jan  1 00:07 ps7-gpio@e000a000
dr-xr-xr-x    2 root     0                0 Jan  1 00:07 ps7-iop-bus-config@e0200000
dr-xr-xr-x    2 root     0                0 Jan  1 00:07 ps7-pl310@f8f02000
dr-xr-xr-x    2 root     0                0 Jan  1 00:07 ps7-qspi-linear@fc000000
dr-xr-xr-x    2 root     0                0 Jan  1 00:07 ps7-qspi@e000d000
dr-xr-xr-x    2 root     0                0 Jan  1 00:07 ps7-scugic@f8f01000
dr-xr-xr-x    2 root     0                0 Jan  1 00:07 ps7-scutimer@f8f00600
dr-xr-xr-x    2 root     0                0 Jan  1 00:07 ps7-scuwdt@f8f00620
dr-xr-xr-x    2 root     0                0 Jan  1 00:07 ps7-sdio@e0100000
dr-xr-xr-x    2 root     0                0 Jan  1 00:07 ps7-slcr@f8000000
dr-xr-xr-x    2 root     0                0 Jan  1 00:07 ps7-ttc@f8001000
dr-xr-xr-x    2 root     0                0 Jan  1 00:07 ps7-usb@e0002000
dr-xr-xr-x    2 root     0                0 Jan  1 00:07 ps7_xadc@f8007100
-r--r--r--    1 root     0                0 Jan  1 00:07 ranges
dr-xr-xr-x    2 root     0                0 Jan  1 00:07 serial@e0001000
こう見るとハードマクロのペリフェラル以外が消えてますし、どうやら効いてるみたいです。

まぁ、色々謎のままですが、これでPLが空っぽのLinux環境ができたので、自分の回路を足していくことになります。

IEのフォントサイズ

何となく、IEで記事を見てみたら、<pre>で囲まれた文字が小さすぎてつぶれてました。
検索してみたらまさにそのものが。
http://abc001.blog.so-net.ne.jp/2012-08-25-1
ありがとうございます。

ZedBoard Linux (2) [FPGA]

とりあえず標準状態にはなったので、いじるのに関係しそうな所を眺めてみます。

ramdiskのイメージの中身を変更する方法。ramdisk8M.image.gzを解凍し、作業用の./mntフォルダにマウントさせます。変更後、アンマウントして再圧縮します。
$ gunzip ramdisk8M.image.gz
$ sudo mount -o loop ramdisk8M.image mnt
$ cd mnt
mntの中身を変更
$ sudo umount mnt
$ gzip ramdisk8M.image
IPアドレスの変更は./etc/init.d/rcS、マウントの設定は./etc/fstab、など、この辺はLinux通りですかね。
それほど頻繁に行うわけでは無いですが、ROM化するまでrootfsをNFSにした方が便利そうです。

u-bootの設定。「~/u-boot-digilent/include/configs」下の「zynq_zed.h」に色々設定が見られます。30行目付近を抜粋。
#define CONFIG_ZED /* Community Board */

/* Default environment */
#define CONFIG_IPADDR   192.168.1.10
#define CONFIG_SERVERIP 192.168.1.50

#undef CONFIG_ZYNQ_XIL_LQSPI

/* No NOR Flash available on ZedBoard */
#define CONFIG_SYS_NO_FLASH
#define CONFIG_ENV_IS_NOWHERE

#undef CONFIG_EXTRA_ENV_SETTINGS
#define CONFIG_EXTRA_ENV_SETTINGS 	\
	"ethaddr=00:0a:35:00:01:22\0"	\
	"kernel_size=0x140000\0" 	\
	"ramdisk_size=0x200000\0" 	\
	"qspiboot=sf probe 0 0 0;" \
		"sf read 0x8000 0x100000 0x2c0000;" \
		"sf read 0x1000000 0x3c0000 0x40000;" \
		"sf read 0x800000 0x400000 0x800000;" \
		"go 0x8000\0" \
	"sdboot_linaro=echo Copying Linux from SD to RAM...;" \
		"mmcinfo;" \
		"fatload mmc 0 0x8000 zImage;" \
		"fatload mmc 0 0x1000000 devicetree_linaro.dtb;" \
		"go 0x8000\0" \
	"sdboot=echo Copying Linux from SD to RAM...;" \
		"mmcinfo;" \
		"fatload mmc 0 0x8000 zImage;" \
		"fatload mmc 0 0x1000000 devicetree.dtb;" \
		"fatload mmc 0 0x800000 ramdisk8M.image.gz;" \
		"go 0x8000\0" \
	"jtagboot=echo TFTPing Linux to RAM...;" \
		"tftp 0x8000 zImage;" \
		"tftp 0x1000000 devicetree.dtb;" \
		"tftp 0x800000 ramdisk8M.image.gz;" \
		"go 0x8000\0"
イメージをコピーしてカーネルにジャンプする部分です。IPアドレスとかサーバーのアドレスもここら辺で変えられるようです。
・0x0000_8000:zImage
・0x0100_0000 :devicetree.dtb
・0x0080_0000: ramdisk8M.image.gz
にロードしてるのがわかります。「sdboot」とかがマクロのように定義され、u-bootのコマンドラインから「run sdboot」とすると定義した処理が行われます(手でひとつずつ打っても同じです)。
u-bootが立ち上がり、なにもせず数秒経つと自動的に上のマクロのどれかが実行されます。どれを実行するかを選択しているのは「modeboot」変数で、「\u-boot-digilent\board\xilinx\zynq_common\board.c」で設定されているようです。80行目付近。
int board_late_init (void)
{
	u32 boot_mode;

	boot_mode = (XIo_In32(BOOT_MODE_REG) & BOOT_MODES_MASK);
	switch(boot_mode) {
	case QSPI_MODE:
		setenv("modeboot", "run qspiboot");
		break;
	case NAND_FLASH_MODE:
		setenv("modeboot", "run nandboot");
		break;
	case NOR_FLASH_MODE:
		setenv("modeboot", "run norboot");
		break;
	case SD_MODE:
		setenv("modeboot", "run sdboot");
		break;
	case JTAG_MODE:
		setenv("modeboot", "run jtagboot");
		break;
	default:
		setenv("modeboot", "");
		break;
	}

	return 0;
}
ブートモードジャンパーの値で切り替えてます。通常LinuxはSDからブートしているので、「sdboot」が選ばれるという仕組みです。
これらの設定は「~/u-boot-digilent/include/autoconf.mk」に集められます。このファイルはmake時に自動生成されます。どんな設定がどんな名前で定義されてるのか、このファイルとREADMEから追いかけるようにしています。

一方、devicetree.dts。標準のdtsの48行目付近。
chosen {
	/*bootargs = "console=ttyPS0,115200 root=/dev/mmcblk0p2 rw earlyprintk rootfstype=ext4 rootwait devtmpfs.mount=1";*/
	bootargs = "console=ttyPS0,115200 root=/dev/ram rw initrd=0x800000,8M earlyprintk rootwait devtmpfs.mount=1";
	linux,stdout-path = "/axi@0/serial@e0001000";
};
ここでLinuxカーネルのブート引数を設定してます。シリアルポートの設定や、先にコピーしたramdiskのアドレスなども与えています。コメントアウトされてる設定はSDカードをパーティション分けして、rootにマウントさせてます。この方法は大容量のファイルシステムが使えますし、設定を保存しておくこともできます。けど、いきなりバンと電源を切ってしまうようなシステムだとちょっと怖いです。

SDからu-bootをブートして、nfsかtftpでzImageとdevicetree.dtbをダウンロードして、rootファイルシステムをnfsサーバーに置く、などはこの辺を設定すれば良さそうです。
※標準のカーネルだとnfsが無効になってるようなので、再コンパイルは必要。

……「devicetree.dtbは0x0100_0000にあるぞ」はどこでカーネルに教えてるんでしょう?カーネルは知る必要ない?いやいや、そんなことは…というかdevicetreeの仕組み自体よくわかってないので、もっと勉強が必要ですね。

ZedBoard Linux (1) [FPGA]

ZedBoardでLinuxを実行するまでのメモ。

まずは変更を加えずに、標準の環境ができるまでにします。
Digilentのホームページから「ZedBoard_ELHoT」「ZedBoard_Linux_Design」の2つを落としておきます。手順書やソースファイルなどが入っています。
ISE14.6を使用(元のドキュメントでは14.4)。VMware+Ubuntu 12.04 LTS。ホストはWindows7。

ARMのGCCなどを個別に集めても構築できるらしいですが、Xilinxのツールを入れてしまいます。
XilinxのDownloadページから「Software Development Kit」をダウンロード。約1.7GB。でかい。
$ tar xvf Xilinx_SDK_2013.2_0616_1.tar
$ cd Xilinx_SDK_2013.2_0616_1
$ sudo sh xsetup
デフォルトでは「/opt/Xilinx/SDK/2013.02/」にインストールされます。

毎回忘れる、カーネルコンフィグメニューに必要なncurses-devをインストール。
$ sudo apt-get install ncurses-dev

以下はログインするたびに実行。デフォルトで設定するようにしてもOK。
XilinxのSDK環境変数設定。
$ source /opt/Xilinx/SDK/2013.2/settings32.sh
ついでにARMクロスコンパイル用の環境設定スクリプトも作成&実行。
$ cat armenv.sh
#!/bin/bash 
export CCOMPILER=arm-xilinx-linux-gnueabi-gcc
export ARCH=arm
export CROSS_COMPILE=arm-xilinx-linux-gnueabi-
$ source ./armenv.sh

Linuxのソースを取得、構築。
$ git clone https://github.com/Digilent/linux-digilent
これまた結構でかいので時間かかります。「~/linux-digilent」フォルダができます。
標準のコンフィグは「~/linux-digilent/arch/arm/configs/digilent_zed_defconfig」です。これを「.config」にコピーしても良いです。
$ cd linux-digilent
$ cp ./arch/arm/configs/digilent_zed_defconfig .config
$ make menuconfig
$ make
「~/linux-digilent/arch/arm/boot/zImage」にカーネルイメージができます。

u-bootの作成。
$ git clone https://github.com/Digilent/u-boot-digilent
「~/u-boot-digilent」フォルダができます。
「~/u-boot-digilent/include/configs/zynq_zed.h」がZedBoardの設定ファイルです。必要に応じて編集します。
$ make zynq_zed_config
$ make
makeが終わると「u-boot」ができます。これを「u-boot.elf」とかにリネームしてコピー。

Device Tree Generatorを導入。
SDK上でハードウェアからdtsファイルを作ってくれるツールです。自分でハードウェアをカスタマイズしたときは、このツールでdtsファイルを作ります。
$ git clone git://git.xilinx.com/device-tree.git bsp/device-tree_v0_00_x
$ sudo cp -r bsp/device-tree_v0_00_x/ /opt/Xilinx/SDK/2013.2/sw/lib/bsp/
「~/bsp/device-tree_v0_00_x」フォルダができるので、SDKの標準リポジトリにコピー。
ちなみに、このフォルダをWindowsの「C:\Xilinx\SDK\2013.2\sw\lib\bsp」にコピーすればWindowsのSDKでもDevice Tree Generatorが使えます。

FSBLを作成。SDKを立ち上げます。
$ xsdk
(Xilinx SDK:15612): LIBDBUSMENU-GTK-CRITICAL **: watch_submenu: assertion `GTK_IS_MENU_SHELL(menu)' failed
というエラーが出て、SDKのメニューが表示されない。ググったところ、
$ export UBUNTU_MENUPROXY=0
としてからSDKを立ち上げればば良いらしいです。先の「~/armenv.sh」に追加記述しておいてもOK。

標準の「hw_platform」のフォルダをコピーしておきます。ついでに「system.bit」を「hw_platform」の中にコピーします。本来これらはPlanAheadからExportされます。
このフォルダの中の「system.xml」を元にHardware Platform Specificationを作成します。
New → Others → Xilinx → Hardware Platform Specification を選びます。
Screenshot_1.png
コピーしたフォルダの「system.xml」を指定します。
Screenshot_2.png
Finishで「hw_platform」フォルダができます。

New → Application Projectで新しく「FSBL」というプロジェクトを作ります。テンプレートとしてFSBLを選びます。設定はデフォルトのまま。
Screenshot_3.pngScreenshot_4.png
自動的にBuildが始まりますが、gmakeを呼んでいてBuildに失敗するので、makeにシンボリックリンクさせます。ホントはどう対処するのが正しいんだろ?
$ sudo ln -s /usr/bin/make /usr/bin/gmake
再度Build。「FSBL.elf」ができます。
※ZedBoardではUSBのリセットをFSBLで行うようになっています。手順書に書いてありますがここでは割愛。

ブートイメージを作ります。
SDK上で「FSBL」が選択された状態で、Xilinx Tools → Create Zynq Boot Imageを選択します。
「FSBL.elf」と「system.bit」と「u-boot.elf」を選択し、Createします。
Screenshot_5.png
デフォルトでは「~/workspace/FSBL/bootimage/u-boot.bin」というファイルができます。
これを「BOOT.BIN」にリネームして、SDカードにコピーします。
※多分このSDKの作業はWindows上でも同じように動作するはずです。

Device Tree Blobを作成します。
「devicetree.dts」が標準のソースファイルです。コンパイル済みの「devicetree.dtb」をそのまま使っても同じです。
自分でカスタマイズしたハードウェア用にdtsを作るときは、先に入れたDevice Tree Generatorを使うようです。New → Board Support Packageでdevice-treeを選択します。
Screenshot_6.png
オプション設定。とりあえずコンソールをUARTに割り当てます。
Screenshot_7.png
「ps7_coretex9_0/libsrc/device-tree_xxx/xilinx.dts」が生成されます。「xilinx.dts」と標準の「devicetree.dts」を見比べてみると、生成されたdtsに後で人が色々手を加えてあるようです。dtsの変更はまた今度、今回は標準のdtsを使います。
dtbへのコンパイル。
~/linux-digilent/scripts/dtc/dtc -I dts -O dtb -o devicetree.dtb devicetree.dts


これまで作った
・BOOT.BIN (FSBL+ビットストリーム+u-boot)
・zImage (Linuxカーネル)
・devicetree.dtb
・ramdisk8M.image.gz (これは標準のまま)
の4つをSDカードにコピーします。ファイル名はコード内で決め打ちなのでこのままです。BOOT.BIN以外はソースを書き換えればファイル名の変更はできます。
後はSDカードをZedBoardに挿して、シリアルポートをつないで、電源を入れれば立ち上がる、はず。
U-Boot 2012.04.01 (Sep 25 2013 - 00:19:21)

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: 1d
OEM: 4144
Name: SD
Tran Speed: 25000000
Rd Block Len: 512
SD version 1.10
High Capacity: No
Capacity: 1.9 GiB
Bus Width: 4-bit
reading zImage

2527040 bytes read
reading devicetree.dtb

9648 bytes read
reading ramdisk8M.image.gz

3694324 bytes read
## Starting application at 0x00008000 ...
Uncompressing Linux... done, booting the kernel.
[    0.000000] Booting Linux on physical CPU 0
[    0.000000] Linux version 3.6.0-digilent-13.01-00002-g06b3889 (develop@vm-ubuntu) (gcc version 4.7.2 (Sourcery CodeBench Lite 2012.09-104) ) #1 SMP PREEMPT Wed Sep 25 00:32:40 JST 2013
[    0.000000] CPU: ARMv7 Processor [413fc090] revision 0 (ARMv7), cr=18c5387d
[    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[    0.000000] Machine: Xilinx Zynq Platform, model: Xilinx Zynq ZED
[    0.000000] Memory policy: ECC disabled, Data cache writealloc
[    0.000000] PERCPU: Embedded 7 pages/cpu @c140a000 s6976 r8192 d13504 u32768
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 130048
[    0.000000] Kernel command line: console=ttyPS0,115200 root=/dev/ram rw initrd=0x800000,8M earlyprintk rootwait devtmpfs.mount=1
[    0.000000] PID hash table entries: 2048 (order: 1, 8192 bytes)
[    0.000000] Dentry cache hash table entries: 65536 (order: 6, 262144 bytes)
[    0.000000] Inode-cache hash table entries: 32768 (order: 5, 131072 bytes)
[    0.000000] Memory: 512MB = 512MB total
[    0.000000] Memory: 506424k/506424k available, 17864k reserved, 0K highmem
[    0.000000] Virtual kernel memory layout:
[    0.000000]     vector  : 0xffff0000 - 0xffff1000   (   4 kB)
[    0.000000]     fixmap  : 0xfff00000 - 0xfffe0000   ( 896 kB)
[    0.000000]     vmalloc : 0xe0800000 - 0xfd000000   ( 456 MB)
[    0.000000]     lowmem  : 0xc0000000 - 0xe0000000   ( 512 MB)
[    0.000000]     pkmap   : 0xbfe00000 - 0xc0000000   (   2 MB)
[    0.000000]     modules : 0xbf000000 - 0xbfe00000   (  14 MB)
[    0.000000]       .text : 0xc0008000 - 0xc0473a60   (4527 kB)
[    0.000000]       .init : 0xc0474000 - 0xc0499b40   ( 151 kB)
[    0.000000]       .data : 0xc049a000 - 0xc04d4ae0   ( 235 kB)
[    0.000000]        .bss : 0xc04d4b04 - 0xc04ee100   ( 102 kB)
[    0.000000] Preemptible hierarchical RCU implementation.
[    0.000000]  Dump stacks of tasks blocking RCU-preempt GP.
[    0.000000]  RCU restricting CPUs from NR_CPUS=4 to nr_cpu_ids=2.
[    0.000000] NR_IRQS:512
[    0.000000] Zynq clock init
[    0.000000] xlnx,ps7-ttc-1.00.a #0 at 0xe0800000, irq=43
[    0.000000] sched_clock: 32 bits at 100 Hz, resolution 10000000ns, wraps every 4294967286ms
[    0.000000] Console: colour dummy device 80x30
[    0.090000] Calibrating delay loop... 1332.01 BogoMIPS (lpj=6660096)
[    0.090000] pid_max: default: 32768 minimum: 301
[    0.090000] Mount-cache hash table entries: 512
[    0.090000] CPU: Testing write buffer coherency: ok
[    0.090000] CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
[    0.090000] hw perfevents: enabled with ARMv7 Cortex-A9 PMU driver, 7 counters available
[    0.090000] Setting up static identity map for 0x32be88 - 0x32bebc
[    0.090000] L310 cache controller enabled
[    0.090000] l2x0: 8 ways, CACHE_ID 0x410000c8, AUX_CTRL 0x72360000, Cache size: 524288 B
[    0.130000] Map SLCR registers
[    0.130000] CPU1: Booted secondary processor
[    0.220000] CPU1: thread -1, cpu 1, socket 0, mpidr 80000001
[    0.220000] Brought up 2 CPUs
[    0.220000] SMP: Total of 2 processors activated (2664.03 BogoMIPS).
[    0.220000] devtmpfs: initialized
[    0.220000] NET: Registered protocol family 16
[    0.220000] DMA: preallocated 256 KiB pool for atomic coherent allocations
[    0.220000] xgpiops e000a000.ps7-gpio: gpio at 0xe000a000 mapped to 0xe084a000
[    0.230000] registering platform device 'pl330' id 0
[    0.230000] registering platform device 'arm-pmu' id 0
[    0.230000] registering platform device 'zynq-dvfs' id 0
[    0.230000]
[    0.230000] ###############################################
[    0.230000] #                                             #
[    0.230000] #                Board ZED Init               #
[    0.230000] #                                             #
[    0.230000] ###############################################
[    0.230000]
[    0.230000] hw-breakpoint: found 5 (+1 reserved) breakpoint and 1 watchpoint registers.
[    0.230000] hw-breakpoint: maximum watchpoint size is 4 bytes.
[    0.250000] xslcr xslcr.0: at 0xF8000000 mapped to 0xF8000000
[    0.270000] bio: create slab  at 0
[    0.270000] SCSI subsystem initialized
[    0.270000] usbcore: registered new interface driver usbfs
[    0.270000] usbcore: registered new interface driver hub
[    0.270000] usbcore: registered new device driver usb
[    0.270000] Advanced Linux Sound Architecture Driver Version 1.0.25.
[    0.270000] Switching to clocksource xttcpss_timer1
[    0.280000] NET: Registered protocol family 2
[    0.280000] TCP established hash table entries: 16384 (order: 5, 131072 bytes)
[    0.280000] TCP bind hash table entries: 16384 (order: 5, 131072 bytes)
[    0.280000] TCP: Hash tables configured (established 16384 bind 16384)
[    0.280000] TCP: reno registered
[    0.280000] UDP hash table entries: 256 (order: 1, 8192 bytes)
[    0.280000] UDP-Lite hash table entries: 256 (order: 1, 8192 bytes)
[    0.280000] NET: Registered protocol family 1
[    0.280000] RPC: Registered named UNIX socket transport module.
[    0.280000] RPC: Registered udp transport module.
[    0.280000] RPC: Registered tcp transport module.
[    0.280000] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    0.280000] Trying to unpack rootfs image as initramfs...
[    0.280000] rootfs image is not initramfs (no cpio magic); looks like an initrd
[    0.320000] Freeing initrd memory: 8192K
[    0.320000] pl330 dev 0 probe success
[    0.320000] msgmni has been set to 1005
[    0.320000] io scheduler noop registered
[    0.320000] io scheduler deadline registered
[    0.320000] io scheduler cfq registered (default)
[    0.320000] e0001000.serial: ttyPS0 at MMIO 0xe0001000 (irq = 82) is a xuartps
[    0.840000] console [ttyPS0] enabled
[    0.840000] xdevcfg f8007000.ps7-dev-cfg: ioremap f8007000 to e0850000 with size 1000
[    0.850000] [drm] Initialized drm 1.1.0 20060810
[    0.860000] brd: module loaded
[    0.870000] loop: module loaded
[    0.880000] xqspips e000d000.ps7-qspi: master is unqueued, this is deprecated
[    0.880000] xqspips e000d000.ps7-qspi: at 0xE000D000 mapped to 0xE0852000, irq=51
[    0.890000] libphy: XEMACPS mii bus: probed
[    0.900000] xemacps e000b000.ps7-ethernet: pdev->id -1, baseaddr 0xe000b000, irq 54
[    0.910000] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    0.910000] usb_hcd_xusbps_probe: No OTG assigned!
[    0.920000] usb_hcd_xusbps_probe: OTG now assigned!
[    0.920000] xusbps-ehci xusbps-ehci.0: Xilinx PS USB EHCI Host Controller
[    0.930000] xusbps-ehci xusbps-ehci.0: new USB bus registered, assigned bus number 1
[    0.970000] xusbps-ehci xusbps-ehci.0: irq 53, io mem 0x00000000
[    0.990000] xusbps-ehci xusbps-ehci.0: USB 2.0 started, EHCI 1.00
[    0.990000] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
[    1.000000] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    1.010000] usb usb1: Product: Xilinx PS USB EHCI Host Controller
[    1.010000] usb usb1: Manufacturer: Linux 3.6.0-digilent-13.01-00002-g06b3889 ehci_hcd
[    1.020000] usb usb1: SerialNumber: xusbps-ehci.0
[    1.020000] hub 1-0:1.0: USB hub found
[    1.030000] hub 1-0:1.0: 1 port detected
[    1.030000] Initializing USB Mass Storage driver...
[    1.040000] usbcore: registered new interface driver usb-storage
[    1.040000] USB Mass Storage support registered.
[    1.050000] mousedev: PS/2 mouse device common for all mice
[    1.060000] sdhci: Secure Digital Host Controller Interface driver
[    1.060000] sdhci: Copyright(c) Pierre Ossman
[    1.070000] sdhci-pltfm: SDHCI platform and OF driver helper
[    1.070000] mmc0: Invalid maximum block size, assuming 512 bytes
[    1.080000] No connectors reported connected with modes
[    1.090000] [drm] Cannot find any crtc or sizes - going 1024x768
[    1.110000] Console: switching to colour frame buffer device 128x48
[    1.120000] mmc0: SDHCI controller on e0100000.ps7-sdio [e0100000.ps7-sdio] using ADMA
[    1.130000] usbcore: registered new interface driver usbhid
[    1.130000] usbhid: USB HID core driver
[    1.130000] spi_gpio spi_gpio.2: master is unqueued, this is deprecated
[    1.130000] pmodoled-gpio-spi [zed_oled] SPI Probing
[    1.180000] fb0:  frame buffer device
[    1.180000] drm: registered panic notifier
[    1.190000] [drm] Initialized analog_drm 1.0.0 20110530 on minor 0
[    1.200000] mmc0: SD Status: Invalid Allocation Unit size.
[    1.210000] mmc0: new high speed SD card at address b368
[    1.210000] mmcblk0: mmc0:b368 SD    1.86 GiB
[    1.220000]  mmcblk0: p1
[    1.300000] adv7511 0-0039: Failed to add route DAI IN->TMDS
[    1.310000] adv7511-hdmi-snd adv7511_hdmi_snd.2:  adv7511 <-> 75c00000.axi-spdif-tx mapping ok
[    1.320000] TCP: cubic registered
[    1.320000] NET: Registered protocol family 17
[    1.330000] VFP support v0.3: implementor 41 architecture 3 part 30 variant 9 rev 4
[    1.330000] Registering SWP/SWPB emulation handler
[    1.340000] registered taskstats version 1
[    1.340000] drivers/rtc/hctosys.c: unable to open rtc device (rtc0)
[    1.350000] ALSA device list:
[    1.350000]   #0: HDMI monitor
[    1.360000] RAMDISK: gzip image found at block 0
[    1.680000] EXT4-fs (ram0): couldn't mount as ext3 due to feature incompatibilities
[    1.710000] EXT4-fs (ram0): mounting ext2 file system using the ext4 subsystem
[    1.710000] EXT4-fs (ram0): warning: mounting unchecked fs, running e2fsck is recommended
[    1.720000] EXT4-fs (ram0): mounted filesystem without journal. Opts: (null)
[    1.730000] VFS: Mounted root (ext2 filesystem) on device 1:0.
[    1.730000] devtmpfs: mounted
[    1.740000] Freeing init memory: 148K
Starting rcS...
++ Mounting filesystem
++ Setting up mdev
++ Configure static IP 192.168.1.10
++ Starting telnet daemon
++ Starting http daemon
++ Starting ftp daemon
++ Starting dropbear (ssh) daemon
++ Starting OLED Display
insmod: can't read '/lib/modules/3.6.0-digilent-13.01-00002-g06b3889/pmodoled-gpio.ko': No such file or directory
++ Exporting LEDs & SWs
rcS Complete
zynq> [    6.980000] xemacps e000b000.ps7-ethernet: Set clk to 124999998 Hz
[    6.980000] xemacps e000b000.ps7-ethernet: link up (1000/FULL)
立ち上がりました。なんかinsmodでエラーが出ちゃってますが、これは後でどうにかなるでしょう。
標準ではIPアドレスが192.168.1.10決め打ちです。環境に合わせ、一時的に変更します。
zynq> ifconfig eth0 down
zynq> ifconfig eth0 192.168.0.201
zynq> ifconfig eth0 up
zynq> [  358.170000] xemacps e000b000.ps7-ethernet: Set clk to 124999998 Hz
[  358.170000] xemacps e000b000.ps7-ethernet: link up (1000/FULL)

develop@vm-ubuntu:~$ ssh root@192.168.0.201
root@192.168.0.201's password: root
zynq> 
とかやるとリモートでログインできます。ブラウザでhttp://192.168.0.201/を見るとWelcomeページが表示されます。

とりあえず動いたので、これから自分の目的に合わせてカスタマイズしていくことになります。

この広告は前回の更新から一定期間経過したブログに表示されています。更新すると自動で解除されます。