FC2カウンター FPGAの部屋 2013年03月14日
FC2ブログ

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

FPGAの部屋

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

DTCでDevice Tree をコンパイルする1

前回、SDKにXilinxのDevice Tree Generator をプラグインして、xilinx.dts を生成することができた。今回はDTC (Device Tree Compiler) を使って、xilinx.dts をコンパイルして、xilinx.dtb を生成して、実際にDevice Tree として使えるかどうかを確かめる。

さて、それでは、xilinx.dts を見てみよう。
1.xilinx.dts は、ZedBoard_OOB_Design/hw/xps_proj/SDK/SDK_Export/device-tree_bsp_0/ps7_cortexa9_0/libsrc/device-tree_v0_00_x ディレクトリにある。
ISE_for_Linux_107_130314.png

2.”~/HDL/ZedBoard/linux-digilent-master/scripts/dtc/dtc -O dtb -I dts -o xilinx.dtb xilinx.dts”コマンドを実行した。

3.xilinx.dtb が生成された。(xilinx.dts は 12,527バイト、xilinx.dtb は 9,684バイト)
ISE_for_Linux_108_130314.png

4.”cp xilinx.dtb devicetree_ramdisk.dtb”コマンドで、devicetree_ramdisk.dtb にコピーした。

5.SDカードのdevicetree_ramdisk.dtb をdevicetree_ramdisk_org.dtb にリネームして、4.のdevicetree_ramdisk.dtb をコピーした。
ISE_for_Linux_109_130314.png

6.SDカードをZedBoardに挿入して、ZedBoardを起動した。

7.エラーが出てしまった。エラー内容を下に示す。

Error: unrecognized/unsupported device tree compatible list:
[ 'xlnx,zynq-zc770' ]

Available machine support:

ID (hex) NAME
00000d32 Xilinx Zynq Platform
00000d32 Xilinx Zynq Platform

Please check your kernel config and/or bootloader.


ISE_for_Linux_110_130314.png

・ZedBoard_OOB_Design/linux/devicetree_ramdisk.dts とxilinx.dts を比較してみた。
最初に、ZedBoard_OOB_Design/linux/devicetree_ramdisk.dts の最初の部分を下に示す。

/dts-v1/;

/ {
    model = "Xilinx Zynq ZED";
    compatible = "xlnx,zynq-zed";
    #address-cells = <0x1>;
    #size-cells = <0x1>;
    interrupt-parent = <&gic>;


次に、xilinx.dts の最初の部分を下に示す。

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


Zynqボードの記述が違っているのがわかる。xilinx.dts は zc770ボード用のようだ。

xilinx.dts をZedBoard_OOB_Design/linux/devicetree_ramdisk.dts と同様に変更して、DTCでコンパイルをし、SDカードにdevicetree_ramdisk.dts としてコピーしたところ、正常にLinuxが起動した。
ISE_for_Linux_111_130314.png

起動メッセージを下に示す。

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

2450208 bytes read
reading devicetree_ramdisk.dtb

9688 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
[ 0.000000] Linux version 3.6.0-digilent-13.01 (masaaki@masaaki-VirtualBox) (gcc version 4.6.3 (Sourcery CodeBench Lite 2012.03-79) ) #6 SMP PREEMPT Fri Mar 8 19:52:15 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] bootconsole [earlycon0] enabled
[ 0.000000] Memory policy: ECC disabled, Data cache writealloc
[ 0.000000] BUG: mapping for 0xe0001000 at 0xfe001000 out of vmalloc space
[ 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 rootfstype=ext4 rootwait devtmpfs.mount=0
[ 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: 506760k/506760k available, 17528k 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 - 0xc0423984 (4207 kB)
[ 0.000000] .init : 0xc0424000 - 0xc0449b40 ( 151 kB)
[ 0.000000] .data : 0xc044a000 - 0xc04828e0 ( 227 kB)
[ 0.000000] .bss : 0xc0482904 - 0xc04990b0 ( 90 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.010000] Calibrating delay loop... 1332.01 BogoMIPS (lpj=6660096)
[ 0.100000] pid_max: default: 32768 minimum: 301
[ 0.100000] Mount-cache hash table entries: 512
[ 0.100000] CPU: Testing write buffer coherency: ok
[ 0.110000] CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
[ 0.110000] hw perfevents: enabled with ARMv7 Cortex-A9 PMU driver, 7 counters available
[ 0.110000] Setting up static identity map for 0x2ed340 - 0x2ed374
[ 0.120000] L310 cache controller enabled
[ 0.120000] l2x0: 8 ways, CACHE_ID 0x410000c8, AUX_CTRL 0x72360000, Cache size: 524288 B
[ 0.190000] Map SLCR registers
[ 0.190000] CPU1: Booted secondary processor
[ 0.280000] CPU1: thread -1, cpu 1, socket 0, mpidr 80000001
[ 0.280000] Brought up 2 CPUs
[ 0.280000] SMP: Total of 2 processors activated (2664.03 BogoMIPS).
[ 0.290000] devtmpfs: initialized
[ 0.290000] NET: Registered protocol family 16
[ 0.300000] DMA: preallocated 256 KiB pool for atomic coherent allocations
[ 0.310000] xgpiops e000a000.ps7-gpio: gpio at 0xe000a000 mapped to 0xe084a000
[ 0.310000] registering platform device 'pl330' id 0
[ 0.320000] registering platform device 'arm-pmu' id 0
[ 0.320000] registering platform device 'zynq-dvfs' id 0
[ 0.330000]
[ 0.330000] ###############################################
[ 0.330000] # #
[ 0.340000] # Board ZED Init #
[ 0.340000] # #
[ 0.350000] ###############################################
[ 0.350000]
[ 0.360000] hw-breakpoint: found 5 (+1 reserved) breakpoint and 1 watchpoint registers.
[ 0.370000] hw-breakpoint: maximum watchpoint size is 4 bytes.
[ 0.390000] xslcr xslcr.0: at 0xF8000000 mapped to 0xF8000000
[ 0.410000] bio: create slab at 0
[ 0.410000] SCSI subsystem initialized
[ 0.410000] usbcore: registered new interface driver usbfs
[ 0.420000] usbcore: registered new interface driver hub
[ 0.420000] usbcore: registered new device driver usb
[ 0.430000] Advanced Linux Sound Architecture Driver Version 1.0.25.
[ 0.430000] Switching to clocksource xttcpss_timer1
[ 0.450000] NET: Registered protocol family 2
[ 0.450000] TCP established hash table entries: 16384 (order: 5, 131072 bytes)
[ 0.460000] TCP bind hash table entries: 16384 (order: 5, 131072 bytes)
[ 0.460000] TCP: Hash tables configured (established 16384 bind 16384)
[ 0.470000] TCP: reno registered
[ 0.470000] UDP hash table entries: 256 (order: 1, 8192 bytes)
[ 0.480000] UDP-Lite hash table entries: 256 (order: 1, 8192 bytes)
[ 0.490000] NET: Registered protocol family 1
[ 0.490000] Trying to unpack rootfs image as initramfs...
[ 0.500000] rootfs image is not initramfs (no cpio magic); looks like an initrd
[ 0.540000] Freeing initrd memory: 8192K
[ 0.540000] pl330 dev 0 probe success
[ 0.540000] msgmni has been set to 1005
[ 0.540000] io scheduler noop registered
[ 0.550000] io scheduler deadline registered
[ 0.550000] io scheduler cfq registered (default)
[ 0.560000] e0001rェイconsole [ttyPS0] enabled, bootconsole disabled
[ 0.560000] console [ttyPS0] enabled, bootconsole disabled
[ 0.570000] xdevcfg f8007000.ps7-dev-cfg: ioremap f8007000 to e084e000 with size 1000
[ 0.580000] [drm] Initialized drm 1.1.0 20060810
[ 0.600000] brd: module loaded
[ 0.600000] loop: module loaded
[ 0.610000] xqspips e000d000.ps7-qspi: master is unqueued, this is deprecated
[ 0.620000] xqspips e000d000.ps7-qspi: at 0xE000D000 mapped to 0xE0850000, irq=51
[ 0.630000] libphy: XEMACPS mii bus: probed
[ 0.630000] xemacps e000b000.ps7-ethernet: pdev->id -1, baseaddr 0xe000b000, irq 54
[ 0.640000] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[ 0.650000] xusbps-ehci xusbps-ehci.0: Xilinx PS USB EHCI Host Controller
[ 0.650000] xusbps-ehci xusbps-ehci.0: new USB bus registered, assigned bus number 1
[ 0.690000] xusbps-ehci xusbps-ehci.0: irq 53, io mem 0x00000000
[ 0.710000] xusbps-ehci xusbps-ehci.0: USB 2.0 started, EHCI 1.00
[ 0.710000] hub 1-0:1.0: USB hub found
[ 0.720000] hub 1-0:1.0: 1 port detected
[ 0.720000] Initializing USB Mass Storage driver...
[ 0.720000] usbcore: registered new interface driver usb-storage
[ 0.730000] USB Mass Storage support registered.
[ 0.740000] mousedev: PS/2 mouse device common for all mice
[ 0.740000] sdhci: Secure Digital Host Controller Interface driver
[ 0.750000] sdhci: Copyright(c) Pierre Ossman
[ 0.750000] sdhci-pltfm: SDHCI platform and OF driver helper
[ 0.760000] mmc0: Invalid maximum block size, assuming 512 bytes
[ 0.810000] mmc0: SDHCI controller on e0100000.ps7-sdio [e0100000.ps7-sdio] using ADMA
[ 0.820000] usbcore: registered new interface driver usbhid
[ 0.830000] usbhid: USB HID core driver
[ 0.840000] TCP: cubic registered
[ 0.840000] NET: Registered protocol family 17
[ 0.850000] VFP support v0.3: implementor 41 architecture 3 part 30 variant 9 rev 4
[ 0.860000] Registering SWP/SWPB emulation handler
[ 0.860000] registered taskstats version 1
[ 0.870000] drivers/rtc/hctosys.c: unable to open rtc device (rtc0)
[ 0.870000] ALSA device list:
[ 0.880000] No soundcards found.
[ 0.880000] RAMDISK: gzip image found at block 0
[ 0.890000] mmc0: new high speed SDHC card at address b368
[ 0.910000] mmcblk0: mmc0:b368 NCard 7.48 GiB
[ 0.910000] mmcblk0: p1
[ 1.220000] EXT4-fs (ram0): warning: mounting unchecked fs, running e2fsck is recommended
[ 1.220000] EXT4-fs (ram0): mounted filesystem without journal. Opts: (null)
[ 1.230000] VFS: Mounted root (ext4 filesystem) on device 1:0.
[ 1.240000] Freeing init memory: 148K
Starting rcS...
++ Mounting filesystem
++ Setting up mdev
++ Configure static IP 192.168.3.130
++ 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/pmodoled-gpio.ko': No such file or directory
++ Exporting LEDs & SWs
rcS Complete
zynq> [ 3.480000] xemacps e000b000.ps7-ethernet: Set clk to 124999998 Hz
[ 3.480000] xemacps e000b000.ps7-ethernet: link up (1000/FULL)


DRMが抜けてしまった。フレームバッファの領域が確保されていないようだ。
  1. 2013年03月14日 05:41 |
  2. Linux
  3. | トラックバック:0
  4. | コメント:0