在线咨询
eetop公众号 创芯大讲堂 创芯人才网
切换到宽版

EETOP 创芯网论坛 (原名:电子顶级开发网)

手机号码,快捷登录

手机号码,快捷登录

找回密码

  登录   注册  

快捷导航
搜帖子
查看: 9053|回复: 2

[活动] 【zynq征文】基于ZedBoard Linux应用设计

[复制链接]
发表于 2013-2-27 09:27:34 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?注册

x
本帖最后由 huxiaokai2005 于 2013-2-27 09:43 编辑

在之前几节分别介绍了基于zynq的Linux启动所需文件的生成方法,本节则总结一下,在ZedBoard上实测一下Linux应用。
        《基于zynq的交叉编译平台》:准备工作,建立交叉编译环境
        《u-boot image生成》:生成u-boot文件(BOOT.BIN)
        《Linux内核编译》:生成Linux内核镜像文件(zImage)
        《设备树生成》:生成设备树文件(devicetree.dtb)
        《基于zynq的Linux根文件系统生成》:生成根文件系统文件(ramdisk8M.image.gz)
        Linux启动所需文件生成后信息如图1所示:

Snap1.jpg

图1

        将以上文件拷贝到SD卡中,ZedBoard上电,在串口终端中打印出的信息如下:




  1. U-Boot 2012.04.01 (Jan 07 2013 - 13:42:00)

  2. DRAM:  512 MiB
  3. WARNING: Caches not enabled
  4. MMC:   SDHCI: 0
  5. Using default environment

  6. In:    serial
  7. Out:   serial
  8. Err:   serial
  9. Net:   zynq_gem
  10. Hit any key to stop autoboot:  0
  11. Copying Linux from SD to RAM...
  12. Device: SDHCI
  13. Manufacturer ID: 12
  14. OEM: 3456
  15. Name: SMI   
  16. Tran Speed: 25000000
  17. Rd Block Len: 512
  18. SD version 2.0
  19. High Capacity: Yes
  20. Capacity: 3.7 GiB
  21. Bus Width: 4-bit
  22. reading zImage

  23. 2479640 bytes read
  24. reading devicetree.dtb

  25. 9648 bytes read
  26. reading ramdisk8M.image.gz

  27. 3694108 bytes read
  28. ## Starting application at 0x00008000 ...
  29. Uncompressing Linux... done, booting the kernel.
  30. [    0.000000] Booting Linux on physical CPU 0
  31. [    0.000000] Linux version 3.3.0-digilent-12.07-zed-beta (tinghui.wang@DIGILENT_LINUX) (gcc version 4.6.1 (Sourcery CodeBench Lite 2011.09-50) ) #2 SMP PREEMPT Thu Jul 12 21:01:42 PDT 2012
  32. [    0.000000] CPU: ARMv7 Processor [413fc090] revision 0 (ARMv7), cr=18c5387d
  33. [    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
  34. [    0.000000] Machine: Xilinx Zynq Platform, model: Xilinx Zynq ZED
  35. [    0.000000] bootconsole [earlycon0] enabled
  36. [    0.000000] Memory policy: ECC disabled, Data cache writealloc
  37. [    0.000000] BUG: mapping for 0xf8f00000 at 0xfe00c000 out of vmalloc space
  38. [    0.000000] BUG: mapping for 0xe0000000 at 0xfe000000 out of vmalloc space
  39. [    0.000000] BUG: mapping for 0xffff1000 at 0xfe200000 out of vmalloc space
  40. [    0.000000] PERCPU: Embedded 7 pages/cpu @c148b000 s5696 r8192 d14784 u32768
  41. [    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 125824
  42. [    0.000000] Kernel command line: console=ttyPS0,115200 root=/dev/ram rw initrd=0x800000,8M earlyprintk rootwait devtmpfs.mount=1
  43. [    0.000000] PID hash table entries: 2048 (order: 1, 8192 bytes)
  44. [    0.000000] Dentry cache hash table entries: 65536 (order: 6, 262144 bytes)
  45. [    0.000000] Inode-cache hash table entries: 32768 (order: 5, 131072 bytes)
  46. [    0.000000] Memory: 240MB 256MB = 496MB total
  47. [    0.000000] Memory: 489848k/489848k available, 34440k reserved, 0K highmem
  48. [    0.000000] Virtual kernel memory layout:
  49. [    0.000000]     vector  : 0xffff0000 - 0xffff1000   (   4 kB)
  50. [    0.000000]     fixmap  : 0xfff00000 - 0xfffe0000   ( 896 kB)
  51. [    0.000000]     vmalloc : 0xe0800000 - 0xfd000000   ( 456 MB)
  52. [    0.000000]     lowmem  : 0xc0000000 - 0xe0000000   ( 512 MB)
  53. [    0.000000]     pkmap   : 0xbfe00000 - 0xc0000000   (   2 MB)
  54. [    0.000000]     modules : 0xbf000000 - 0xbfe00000   (  14 MB)
  55. [    0.000000]       .text : 0xc0008000 - 0xc042f040   (4253 kB)
  56. [    0.000000]       .init : 0xc0430000 - 0xc0456640   ( 154 kB)
  57. [    0.000000]       .data : 0xc0458000 - 0xc0485dc0   ( 184 kB)
  58. [    0.000000]        .bss : 0xc0485de4 - 0xc049d734   (  95 kB)
  59. [    0.000000] Preemptible hierarchical RCU implementation.
  60. [    0.000000]  Verbose stalled-CPUs detection is disabled.
  61. [    0.000000] NR_IRQS:128
  62. [    0.000000] xlnx,ps7-ttc-1.00.a #0 at 0xe0800000, irq=43
  63. [    0.000000] Console: colour dummy device 80x30
  64. [    0.000000] Calibrating delay loop... 1332.01 BogoMIPS (lpj=6660096)
  65. [    0.090000] pid_max: default: 32768 minimum: 301
  66. [    0.090000] Mount-cache hash table entries: 512
  67. [    0.090000] CPU: Testing write buffer coherency: ok
  68. [    0.100000] CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
  69. [    0.100000] smp_twd: clock not found: -2
  70. [    0.110000] Calibrating local timer... 333.57MHz.
  71. [    0.170000] hw perfevents: enabled with ARMv7 Cortex-A9 PMU driver, 7 counters available
  72. [    0.170000] Setting up static identity map for 0x2f8d48 - 0x2f8d7c
  73. [    0.270000] CPU1: Booted secondary processor
  74. [    0.360000] CPU1: thread -1, cpu 1, socket 0, mpidr 80000001
  75. [    0.360000] Brought up 2 CPUs
  76. [    0.360000] SMP: Total of 2 processors activated (2664.03 BogoMIPS).
  77. [    0.370000] devtmpfs: initialized
  78. [    0.370000] ------------[ cut here ]------------
  79. [    0.380000] WARNING: at arch/arm/mm/dma-mapping.c:198 consistent_init+0x70/0x104()
  80. [    0.380000] Modules linked in:
  81. [    0.390000] [<c0012920>] (unwind_backtrace+0x0/0xe0) from [<c001e924>] (warn_slowpath_common+0x4c/0x64)
  82. [    0.400000] [<c001e924>] (warn_slowpath_common+0x4c/0x64) from [<c001e954>] (warn_slowpath_null+0x18/0x1c)
  83. [    0.410000] [<c001e954>] (warn_slowpath_null+0x18/0x1c) from [<c04345a8>] (consistent_init+0x70/0x104)
  84. [    0.420000] [<c04345a8>] (consistent_init+0x70/0x104) from [<c000858c>] (do_one_initcall+0x90/0x160)
  85. [    0.420000] [<c000858c>] (do_one_initcall+0x90/0x160) from [<c043085c>] (kernel_init+0x84/0x128)
  86. [    0.430000] [<c043085c>] (kernel_init+0x84/0x128) from [<c000dfcc>] (kernel_thread_exit+0x0/0x8)
  87. [    0.440000] ---[ end trace 1b75b31a2719ed1c ]---
  88. [    0.450000] ------------[ cut here ]------------
  89. [    0.450000] WARNING: at arch/arm/mm/dma-mapping.c:198 consistent_init+0x70/0x104()
  90. [    0.460000] Modules linked in:
  91. [    0.460000] [<c0012920>] (unwind_backtrace+0x0/0xe0) from [<c001e924>] (warn_slowpath_common+0x4c/0x64)
  92. [    0.470000] [<c001e924>] (warn_slowpath_common+0x4c/0x64) from [<c001e954>] (warn_slowpath_null+0x18/0x1c)
  93. [    0.480000] [<c001e954>] (warn_slowpath_null+0x18/0x1c) from [<c04345a8>] (consistent_init+0x70/0x104)
  94. [    0.490000] [<c04345a8>] (consistent_init+0x70/0x104) from [<c000858c>] (do_one_initcall+0x90/0x160)
  95. [    0.500000] [<c000858c>] (do_one_initcall+0x90/0x160) from [<c043085c>] (kernel_init+0x84/0x128)
  96. [    0.510000] [<c043085c>] (kernel_init+0x84/0x128) from [<c000dfcc>] (kernel_thread_exit+0x0/0x8)
  97. [    0.520000] ---[ end trace 1b75b31a2719ed1d ]---
  98. [    0.520000] NET: Registered protocol family 16
  99. [    0.540000] L310 cache controller enabled
  100. [    0.540000] l2x0: 8 ways, CACHE_ID 0x410000c8, AUX_CTRL 0x72360000, Cache size: 524288 B
  101. [    0.550000] registering platform device 'pl330' id 0
  102. [    0.550000] registering platform device 'arm-pmu' id 0
  103. [    0.560000]
  104. [    0.560000] ###############################################
  105. [    0.560000] #                                             #
  106. [    0.570000] #                Board ZED Init               #
  107. [    0.570000] #                                             #
  108. [    0.580000] ###############################################
  109. [    0.580000]
  110. [    0.590000] hw-breakpoint: found 5 (+1 reserved) breakpoint and 1 watchpoint registers.
  111. [    0.590000] hw-breakpoint: maximum watchpoint size is 4 bytes.
  112. [    0.620000] xslcr xslcr.0: at 0xF8000000 mapped to 0xE0808000
  113. [    0.640000] bio: create slab <bio-0> at 0
  114. [    0.640000] gpiochip_add: registered GPIOs 0 to 245 on device: xgpiops
  115. [    0.650000] xgpiops e000a000.ps7-gpio: gpio at 0xe000a000 mapped to 0xe080a000
  116. [    0.650000] SCSI subsystem initialized
  117. [    0.660000] usbcore: registered new interface driver usbfs
  118. [    0.660000] usbcore: registered new interface driver hub
  119. [    0.670000] usbcore: registered new device driver usb
  120. [    0.670000] Advanced Linux Sound Architecture Driver Version 1.0.24.
  121. [    0.680000] Switching to clocksource xttcpss_timer1
  122. [    0.690000] NET: Registered protocol family 2
  123. [    0.690000] IP route cache hash table entries: 4096 (order: 2, 16384 bytes)
  124. [    0.700000] TCP established hash table entries: 16384 (order: 5, 131072 bytes)
  125. [    0.700000] TCP bind hash table entries: 16384 (order: 5, 196608 bytes)
  126. [    0.710000] TCP: Hash tables configured (established 16384 bind 16384)
  127. [    0.720000] TCP reno registered
  128. [    0.720000] UDP hash table entries: 256 (order: 1, 8192 bytes)
  129. [    0.730000] UDP-Lite hash table entries: 256 (order: 1, 8192 bytes)
  130. [    0.730000] NET: Registered protocol family 1
  131. [    0.740000] Trying to unpack rootfs image as initramfs...
  132. [    0.740000] rootfs image is not initramfs (no cpio magic); looks like an initrd
  133. [    0.780000] Freeing initrd memory: 8192K
  134. [    0.780000] xscugtimer xscugtimer.0: ioremap fe00c200 to e080c200 with size 400
  135. [    0.790000] pl330 dev 0 probe success
  136. [    0.800000] msgmni has been set to 972
  137. [    0.800000] io scheduler noop registered
  138. [    0.800000] io scheduler deadline registered
  139. [    0.800000] io scheduler cfq registered (default)
  140. [    0.810000] e0001?俽聮倐倐console [ttyPS0] enabled, bootconsole disabled
  141. [    0.820000] console [ttyPS0] enabled, bootconsole disabled
  142. [    0.820000] xdevcfg f8007000.ps7-dev-cfg: ioremap f8007000 to e0810000 with size 1000
  143. [    0.840000] [drm] Initialized drm 1.1.0 20060810
  144. [    0.850000] brd: module loaded
  145. [    0.860000] loop: module loaded
  146. [    0.860000] xqspips e000d000.ps7-qspi: at 0xE000D000 mapped to 0xE0812000, irq=51
  147. [    0.870000] GEM: BASEADDRESS hw: e000b000 virt: e0814000
  148. [    0.880000] XEMACPS mii bus: probed
  149. [    0.880000] eth0, pdev->id -1, baseaddr 0xe000b000, irq 54
  150. [    0.890000] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
  151. [    0.890000] usb_hcd_xusbps_probe: No OTG assigned!
  152. [    0.900000] usb_hcd_xusbps_probe: OTG now assigned!
  153. [    0.900000] xusbps-ehci xusbps-ehci.0: Xilinx PS USB EHCI Host Controller
  154. [    0.910000] xusbps-ehci xusbps-ehci.0: new USB bus registered, assigned bus number 1
  155. [    0.950000] xusbps-ehci xusbps-ehci.0: irq 53, io mem 0x00000000
  156. [    0.970000] xusbps-ehci xusbps-ehci.0: USB 2.0 started, EHCI 1.00
  157. [    0.970000] hub 1-0:1.0: USB hub found
  158. [    0.980000] hub 1-0:1.0: 1 port detected
  159. [    0.980000] Initializing USB Mass Storage driver...
  160. [    0.980000] usbcore: registered new interface driver usb-storage
  161. [    0.990000] USB Mass Storage support registered.
  162. [    1.000000] Xilinx PS USB Device Controller driver (Apr 01, 2011)
  163. [    1.000000] mousedev: PS/2 mouse device common for all mice
  164. [    1.010000] Linux video capture interface: v2.00
  165. [    1.010000] gspca_main: v2.14.0 registered
  166. [    1.020000] usbcore: registered new interface driver uvcvideo
  167. [    1.020000] USB Video Class driver (1.1.1)
  168. [    1.030000] sdhci: Secure Digital Host Controller Interface driver
  169. [    1.030000] No connectors reported connected with modes
  170. [    1.030000] [drm] Cannot find any crtc or sizes - going 1024x768
  171. [    1.040000] drivers/gpu/drm/analog/analog_drm_fbdev.c:analog_drm_fbdev_probe[241]
  172. [    1.050000] sdhci: Copyright(c) Pierre Ossman
  173. [    1.050000] sdhci-pltfm: SDHCI platform and OF driver helper
  174. [    1.070000] usbcore: registered new interface driver usbhid
  175. [    1.070000] usbhid: USB HID core driver
  176. [    1.070000] adv7511 0-0039: Failed to add route DAI IN->TMDS
  177. [    1.090000] Console: switching to colour frame buffer device 128x48
  178. [    1.090000] asoc: adv7511 <-> 75c00000.axi-spdif-tx mapping ok
  179. [    1.090000] axi-spdif 75c00000.axi-spdif-tx: Failed to set DAI format: -22
  180. [    1.100000] ALSA device list:
  181. [    1.100000]   #0: HDMI monitor
  182. [    1.100000] TCP cubic registered
  183. [    1.100000] NET: Registered protocol family 17
  184. [    1.100000] VFP support v0.3: implementor 41 architecture 3 part 30 variant 9 rev 4
  185. [    1.100000] Registering SWP/SWPB emulation handler
  186. [    1.160000] fb0:  frame buffer device
  187. [    1.160000] drm: registered panic notifier
  188. [    1.160000] registered taskstats version 1
  189. [    1.160000] drivers/rtc/hctosys.c: unable to open rtc device (rtc0)
  190. [    1.180000] RAMDISK: gzip image found at block 00110530 on minor 0
  191. [    1.490000] EXT4-fs (ram0): couldn't mount as ext3 due to feature incompatibilities
  192. [    1.560000] EXT4-fs (ram0): mounting ext2 file system using the ext4 subsystem
  193. [    1.560000] EXT4-fs (ram0): warning: mounting unchecked fs, running e2fsck is recommended
  194. [    1.570000] EXT4-fs (ram0): mounted filesystem without journal. Opts: (null)
  195. [    1.580000] VFS: Mounted root (ext2 filesystem) on device 1:0.
  196. [    1.580000] devtmpfs: mounted
  197. [    1.590000] Freeing init memory: 152K
  198. Starting rcS...
  199. ++ Mounting filesystem
  200. ++ Setting up mdev
  201. ++ Configure static IP 192.168.1.10
  202. [    1.800000] GEM: lp->tx_bd ffdfb000 lp->tx_bd_dma 18fd8000 lp->tx_skb d82011c0
  203. [    1.800000] GEM: lp->rx_bd ffdfc000 lp->rx_bd_dma 18fd9000 lp->rx_skb d82012c0
  204. [    1.810000] GEM: MAC 0x00350a00, 0x00002201, 00:0a:35:00:01:22
  205. [    1.820000] GEM: phydev d8b83800, phydev->phy_id 0x1410dd1, phydev->addr 0x0
  206. [    1.830000] eth0, phy_addr 0x0, phy_id 0x01410dd1
  207. [    1.830000] eth0, attach [Marvell 88E1510] phy driver
  208. ++ Starting telnet daemon
  209. ++ Starting http daemon
  210. ++ Starting ftp daemon
  211. ++ Starting dropbear (ssh) daemon
  212. ++ Starting OLED Display
  213. [    1.880000] pmodoled-gpio-spi [zed_oled] SPI Probing
  214. ++ Exporting LEDs & SWs
  215. rcS Complete
  216. zynq>


复制代码

        
        以下介绍一下生成Linux应用,并且在ZedBooard执行:
        在EDK中打开配置完的系统,然后点击Export Design打开SDK,如图2所示,选择Include bitstream and BMM file

Snap2.jpg

图2

        在SDK中新建xilinx c project,如图3所示。

Snap3.jpg

图3

        Target Software中选择Linux,则可以生成基于Linux的应用工程,选择Linux Hello World模板工程。

Snap4.jpg

图4

        修改Helloworld.c中代码,如下:




  1. #include <stdio.h>

  2. int main()
  3. {
  4.     printf("ZedBoard Test! - Hoki 2013.02.26\n");

  5.     return 0;
  6. }


复制代码

        Build Project,在./Debug目录下生成.elf可执行文件,如图5所示

Snap5.jpg

图5

        然后通过网口终端连接ZedBoard,首先需要将PC本地网卡IP修改为与ZedBoard同一段,通过ifconfig查看ZedBoard的IP为192.168.1.10,将PC的IP设置为192.168.1.11,如图6,连上网口口,成功连接。

Snap6.jpg

图6

        通过FTP上传生成的.eif文件,并且执行,成功打印出信息,如图7所示,在第一次执行程序是被告知/bin/sh: ./linux_hello_world_0.elf: Permission denied,在网上搜索了些解决方法,是文件权限不够,先用chmod命令改变文件权限,然后.eif文件可正确执行了。

Snap7.jpg

图7

发表于 2015-6-5 14:04:01 | 显示全部楼层
发表于 2016-7-16 22:52:08 | 显示全部楼层
讲的挺不错的,我需要好好学习下
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

站长推荐 上一条 /2 下一条


小黑屋| 手机版| 关于我们| 联系我们| 在线咨询| 隐私声明| EETOP 创芯网
( 京ICP备:10050787号 京公网安备:11010502037710 )

GMT+8, 2024-12-23 01:40 , Processed in 0.027227 second(s), 11 queries , Gzip On, Redis On.

eetop公众号 创芯大讲堂 创芯人才网
快速回复 返回顶部 返回列表