回答

收藏

【创龙TLZ7x-EasyEVM评估板】 二、 ZYNQ7020初探

其他 其他 3590 人阅读 | 0 人回复 | 2020-05-18

本帖最后由 人生如梦_3019120 于 2020-5-17 23:29 编辑

一、板子上电
可以先预览下文档,这样比较稳妥。光盘目录下用户手册/2-1-开发板快速体验.pdf

上电后,由于没有安装驱动,串口还不能识别。 安装串口驱动后会发现有两个串口,一个是ps端的串口,一个是pl端的串口。

二、uboot
  • uboot 输出日志如下:
  1. U-Boot 2017.01-gf812dfb (Aug 28 2018 - 13:56:47 +0800)

  2. Model: Zynq ZC702 Development Board
  3. Board: Xilinx Zynq
  4. I2C:   ready
  5. DRAM:  ECC disabled 512 MiB
  6. MMC:   sdhci_transfer_data: Error detected in status(0x208000)!
  7. sdhci@e0100000: 0 (SD), sdhci@e0101000: 1 (eMMC)
  8. SF: Detected n25q256 with page size 256 Bytes, erase size 4 KiB, total 32 MiB
  9. *** Warning - bad CRC, using default environment

  10. In:    serial@e0001000
  11. Out:   serial@e0001000
  12. Err:   serial@e0001000
  13. Model: Zynq ZC702 Development Board
  14. Board: Xilinx Zynq
  15. Net:   No ethernet found.
  16. Hit any key to stop autoboot:  0
复制代码

    可知 uboot 才用的是比较老的2017年版本。uboot 支持 sd卡和eMMC。

    sdhci_transfer_data: Error detected in status(0x208000)! 可知 mmc 某个设备没有正确识别。

    通过下面操作可知 eMMC 有问题或者板子就没有eMMC。

    mmc 一系列命令简介
  1. Zynq> ? mmc
  2. mmc - MMC sub system

  3. Usage:
  4. mmc info - display info of the current MMC device
  5. mmc read addr blk# cnt
  6. mmc write addr blk# cnt
  7. mmc erase blk# cnt
  8. mmc rescan
  9. mmc part - lists available partition on current mmc device
  10. mmc dev [dev] [part] - show or set current mmc device [partition]
  11. mmc list - lists available devices
  12. mmc hwpartition [args...] - does hardware partitioning
  13. arguments (sizes in 512-byte blocks):
  14.     [user [enh start cnt] [wrrel {on|off}]] - sets user data area attributes
  15.     [gp1|gp2|gp3|gp4 cnt [enh] [wrrel {on|off}]] - general purpose partition
  16.     [check|set|complete] - mode, complete set partitioning completed
  17. WARNING: Partitioning is a write-once setting once it is set to complete.
  18. Power cycling is required to initialize partitions after set to complete.
  19. mmc setdsr <value> - set DSR register value

  20. //查看有哪些mmc 设备。
  21. Zynq> mmc list
  22. sdhci@e0100000: 0 (SD)
  23. sdhci@e0101000: 1 (eMMC)

  24. //查看 当前mmc 设备分区。
  25. Zynq> mmc part

  26. Partition Map for MMC device 0  --   Partition Type: DOS

  27. Part    Start Sector    Num Sectors     UUID            Type
  28. 1     2048            6215680         000db5af-01     0c Boot
  29. 2     6217728         12433408        000db5af-02     83
  30. 3     18651136        12433408        000db5af-03     83

  31. // 选择 某个mmc 设备
  32. Zynq> mmc dev 1
  33. sdhci_transfer_data: Error detected in status(0x208000)!
  34. switch to partitions #0, OK
  35. mmc1(part 0) is current device
复制代码

  • 板子信息
  1. arch_number = 0x00000000
  2. boot_params = 0x00000000
  3. DRAM bank   = 0x00000000
  4. -> start    = 0x00000000
  5. -> size     = 0x20000000
  6. baudrate    = 115200 bps
  7. TLB addr    = 0x1FFF0000
  8. relocaddr   = 0x1FF43000
  9. reloc off   = 0x1BF43000
  10. irq_sp      = 0x1EB22ED0
  11. sp start    = 0x1EB22EC0
  12. ARM frequency = 666 MHz
  13. DSP frequency = 0 MHz
  14. DDR frequency = 533 MHz
  15. Early malloc usage: 49c / 800
复制代码
  • uboot 支持命令如下:
  1. ?       - alias for 'help'
  2. base    - print or set address offset
  3. bdinfo  - print Board Info structure
  4. boot    - boot default, i.e., run 'bootcmd'
  5. bootd   - boot default, i.e., run 'bootcmd'
  6. bootefi - Boots an EFI payload from memory
  7. bootelf - Boot from an ELF image in memory
  8. bootm   - boot application image from memory
  9. bootp   - boot image via network using BOOTP/TFTP protocol
  10. bootvx  - Boot vxWorks from an ELF image
  11. bootz   - boot Linux zImage image from memory
  12. clk     - CLK sub-system
  13. cmp     - memory compare
  14. coninfo - print console devices and information
  15. cp      - memory copy
  16. crc32   - checksum calculation
  17. dcache  - enable or disable data cache
  18. dfu     - Device Firmware Upgrade
  19. dhcp    - boot image via network using DHCP/TFTP protocol
  20. dm      - Driver model low level access
  21. echo    - echo args to console
  22. editenv - edit environment variable
  23. eeprom  - EEPROM sub-system
  24. env     - environment handling commands
  25. exit    - exit script
  26. ext2load- load binary file from a Ext2 filesystem
  27. ext2ls  - list files in a directory (default /)
  28. ext4load- load binary file from a Ext4 filesystem
  29. ext4ls  - list files in a directory (default /)
  30. ext4size- determine a file's size
  31. ext4write- create a file in the root directory
  32. false   - do nothing, unsuccessfully
  33. fatinfo - print information about filesystem
  34. fatload - load binary file from a dos filesystem
  35. fatls   - list files in a directory (default /)
  36. fatsize - determine a file's size
  37. fatwrite- write file into a dos filesystem
  38. fdt     - flattened device tree utility commands
  39. fpga    - loadable FPGA image support
  40. fstype  - Look up a filesystem type
  41. go      - start application at address 'addr'
  42. gpio    - query and control gpio pins
  43. help    - print command description/usage
  44. i2c     - I2C sub-system
  45. icache  - enable or disable instruction cache
  46. iminfo  - print header information for application image
  47. imxtract- extract a part of a multi-image
  48. itest   - return true/false on integer compare
  49. load    - load binary file from a filesystem
  50. loadb   - load binary file over serial line (kermit mode)
  51. loads   - load S-Record file over serial line
  52. loadx   - load binary file over serial line (xmodem mode)
  53. loady   - load binary file over serial line (ymodem mode)
  54. loop    - infinite loop on address range
  55. ls      - list files in a directory (default /)
  56. md      - memory display
  57. mdio    - MDIO utility commands
  58. mii     - MII utility commands
  59. mm      - memory modify (auto-incrementing address)
  60. mmc     - MMC sub system
  61. mmcinfo - display MMC info
  62. mw      - memory write (fill)
  63. nfs     - boot image via network using NFS protocol
  64. nm      - memory modify (constant address)
  65. ping    - send ICMP ECHO_REQUEST to network host
  66. printenv- print environment variables
  67. reset   - Perform RESET of the CPU
  68. run     - run commands in an environment variable
  69. save    - save file to a filesystem
  70. saveenv - save environment variables to persistent storage
  71. setenv  - set environment variables
  72. sf      - SPI flash sub-system
  73. showvar - print local hushshell variables
  74. size    - determine a file's size
  75. sleep   - delay execution for some time
  76. source  - run script from memory
  77. spl     - SPL configuration
  78. test    - minimal test like /bin/sh
  79. tftpboot- boot image via network using TFTP protocol
  80. tftpput - TFTP put command, for uploading files to a server
  81. thordown- TIZEN "THOR" downloader
  82. true    - do nothing, successfully
  83. usb     - USB sub-system
  84. usbboot - boot from USB device
  85. version - print monitor, compiler and linker version
复制代码
   可知包含 FAT 格式文件系统操作命令。
        可用于在 uboot 中对 SD 卡或者 EMMC 中存储的文件进行操作。
    可知包含 EXT 格式文件系统操作命令。可以通过如下命令查看
  1. Zynq> ext4ls mmc 0:2
  2.     <DIR>       4096 .
  3.     <DIR>       4096 ..
  4.     <DIR>      16384 lost+found
  5.     <DIR>       4096 etc
  6.     <DIR>       4096 run
  7.     <DIR>       4096 bin
  8.     <DIR>       4096 sys
  9.     <DIR>       4096 dev
  10.     <DIR>       4096 proc
  11.     <DIR>       4096 sbin
  12.     <DIR>       4096 var
  13.     <DIR>       4096 www
  14.     <DIR>       4096 boot
  15.     <DIR>       4096 usr
  16.     <DIR>       4096 lib
  17.     <DIR>       4096 home
  18.     <SYM>          8 tmp
  19.     <DIR>       4096 mnt
  20.     <DIR>       4096 media
  21.     <DIR>       4096 opt
复制代码
   网络命令 ping,nfs,tftpboot。通过这几个命令更新 内核根文件系统还是比较方便的。
三、linux
1.开机日志问题
  • 选择EMMC后输出如下
  1. Device: sdhci@e0101000
  2. Manufacturer ID: 13
  3. OEM: 14e
  4. Name: Q2J54
  5. Tran Speed: 25000000
  6. Rd Block Len: 512
  7. MMC version 5.0
  8. High Capacity: Yes
  9. Capacity: 3.6 GiB
  10. Bus Width: 4-bit
  11. Erase Group Size: 512 KiB
  12. HC WP Group Size: 8 MiB
  13. User Capacity: 3.6 GiB WRREL
  14. Boot Capacity: 16 MiB ENH
  15. RPMB Capacity: 512 KiB ENH
  16. reading uEnv.txt
  17. ** Unable to read file uEnv.txt **
  18. Copying Linux from SD to RAM...
  19. 3806216 bytes read in 414 ms (8.8 MiB/s)
  20. 18021 bytes read in 94 ms (186.5 KiB/s)
  21. ## Booting kernel from Legacy Image at 02080000 ...
  22. Image Name:   Linux-4.9.0-xilinx-gee6f0c1
  23. Image Type:   ARM Linux Kernel Image (uncompressed)
  24. Data Size:    3806152 Bytes = 3.6 MiB
  25. Load Address: 02080000
  26. Entry Point:  02080000
  27. Verifying Checksum ... OK
  28. ## Flattened Device Tree blob at 02000000
  29. Booting using the fdt blob at 0x2000000
  30. Loading Kernel Image ... OK
  31. Loading Device Tree to 1eb1a000, end 1eb21664 ... OK
复制代码
  • 默认SD卡输出如下:
  1. Hit any key to stop autoboot:  0
  2. Device: sdhci@e0100000
  3. Manufacturer ID: 3
  4. OEM: 5344
  5. Name: SS16G
  6. Tran Speed: 50000000
  7. Rd Block Len: 512
  8. SD version 3.0
  9. High Capacity: Yes
  10. Capacity: 14.8 GiB
  11. Bus Width: 4-bit
  12. Erase Group Size: 512 Bytes
  13. reading uEnv.txt
  14. ** Unable to read file uEnv.txt **
  15. Copying Linux from SD to RAM...
  16. 3806216 bytes read in 414 ms (8.8 MiB/s)
  17. 18021 bytes read in 94 ms (186.5 KiB/s)
  18. ## Booting kernel from Legacy Image at 02080000 ...
  19. Image Name:   Linux-4.9.0-xilinx-gee6f0c1
  20. Image Type:   ARM Linux Kernel Image (uncompressed)
  21. Data Size:    3806152 Bytes = 3.6 MiB
  22. Load Address: 02080000
  23. Entry Point:  02080000
  24. Verifying Checksum ... OK
  25. ## Flattened Device Tree blob at 02000000
  26. Booting using the fdt blob at 0x2000000
  27. Loading Kernel Image ... OK
  28. Loading Device Tree to 1eb1a000, end 1eb21664 ... OK
复制代码
   打印的居然都是 Copying Linux from SD to RAM...
    有如下打印输出还是很不错的。
  1. 3806216 bytes read in 414 ms (8.8 MiB/s)
  2. 18021 bytes read in 94 ms (186.5 KiB/s)
复制代码

2.led 控制
底板只有一个是留个PS端控制,通过如下命令可以查看,其中 user-led0 是底板上的led。
  1. root@Zynq-Tronlong:~# ls -l /sys/class/leds/
  2. lrwxrwxrwx    1 root     root             0 Jan  1  1970 disc -> ../../devices/soc0/leds/leds/disc
  3. lrwxrwxrwx    1 root     root             0 Jan  1  1970 heartbeat -> ../../devices/soc0/leds/leds/hear                                                             tbeat
  4. lrwxrwxrwx    1 root     root             0 Jan  1  1970 mmc0:: -> ../../devices/soc0/amba/e0100000.sdh                                                             ci/leds/mmc0::
  5. lrwxrwxrwx    1 root     root             0 Jan  1  1970 mmc1:: -> ../../devices/soc0/amba/e0101000.sdh                                                             ci/leds/mmc1::
  6. lrwxrwxrwx    1 root     root             0 Jan  1  1970 user-led0 -> ../../devices/soc0/leds/leds/user                                                             -led0
复制代码
可以通过下面的命令控制led 亮灭
  1. root@Zynq-Tronlong:~# echo 0 > /sys/class/leds/user-led0/brightness
  2. root@Zynq-Tronlong:~# echo 1 > /sys/class/leds/user-led0/brightness
复制代码
3.key 值获取
底板只有一个key提供给了PS端, 通过hexdump 获取按键信息如下。
  1. root@Zynq-Tronlong:~# hexdump /dev/input/event0
  2. 0000000 7351 5cbd 4143 0002 0001 0094 0001 0000
  3. 0000010 7351 5cbd 4143 0002 0000 0000 0000 0000
  4. 0000020 7351 5cbd 9c93 0005 0001 0094 0000 0000
  5. 0000030 7351 5cbd 9c93 0005 0000 0000 0000 0000
复制代码
其中 0094 是事件编码与设备树code 一致。其前面的 0001 表示 EV_KEY事件。其后面的 0001/0000 表示按键按下/松开。0x20字节表示一次按键事件。
关注下面的标签,发现更多相似文章
分享到:
回复

使用道具 举报

您需要登录后才可以回帖 注册/登录

本版积分规则

关闭

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