Fast Development Kit(FDK)-u-boot功能和使用

Fast Development Kit(FDK)是本人实践中总结的一套开发工具,包括了常用的工具集,已经制作好发布在根文件系统中,目前支持Xilinx zynq,Xilinx zynqmp,NXP t2080,海思 hi3531d等。

参考

Fast Development Kit(FDK)-嵌入式Linux开发包

FPGA

针对xilinx zynq/zynqmp,首先配置tftp server,FPGA配置文件名由环境变量fpga_img指定。FPGA配置文件肯能在flash中,也可能在emmc上,怎样才能知道配置文件是在flash还是文件系统里呢?目前新版本都是在文件系统内,2018年7月之前的请联系项目组确认。

  • FPGA配置文件在flash中:固化FPGA采用run update_fpga
  • FPGA配置文件在文件系统中(例如emmc上的ext4):固化FPGA采用run update_ext4_fpga

在u-boot下加载FPGA配置文件,可在u-boot下调试FPGA程序,

  • FPGA配置文件在flash中:加载FPGA采用run fpga_boot
  • FPGA配置文件在文件系统中(例如emmc上的ext4):加载FPGA采用run ext4_fpga_boot

env

环境变量操作,打印环境变量使用env print或者使用快捷命令printenv,设置环境变量使用env set,或者使用快捷命令setenv

zynq-uboot> env
env - environment handling commands

Usage:
env default [-f] -a - [forcibly] reset default environment
env default [-f] var [...] - [forcibly] reset variable(s) to their default values
env delete [-f] var [...] - [forcibly] delete variable(s)
env edit name - edit environment variable
env exists name - tests for existence of variable
env export [-t | -b | -c] [-s size] addr [var ...] - export environment
env import [-d] [-t [-r] | -b | -c] addr [size] - import environment
env print [-a | name ...] - print environment
env run var [...] - run commands in an environment variable
env save - save environment
env set [-f] name [arg ...]

常用设置,

setenv ipaddr x.x.x.x # 设置ip地址
setenv serverip x.x.x.x # 设置服务器ip地址
setenv gatewayip x.x.x.x # 设置网关地址
setenv ethaddr xx:xx:xx:xx:xx:xx # 设置mac地址,第一个网口
setenv eth1addr xx:xx:xx:xx:xx:xx # 多网口
setenv eth2addr xx:xx:xx:xx:xx:xx # 多网口
setenv board_sn xxxx # 设置板卡序列号

X/Y/Zmodem

通过loadx/loady/loadz命令可以通过X/Y/Zmodem协议来下载文件到内存,在没有网络的情况下,可用于调试,速度很慢,生产环境不建议使用。

ping

通过ping命令,来判断网络通断。

zynq-uboot> ping
ping - send ICMP ECHO_REQUEST to network host

Usage:
ping pingAddress

mdio

通过mii命令,可以读写phy寄存器,经常用来诊断网络不通问题。

zynq-uboot> mii
mii - MII utility commands

Usage:
mii device                     - list available devices
mii device <devname>           - set current device
mii info   <addr>              - display MII PHY info
mii read   <addr> <reg>        - read  MII PHY <addr> register <reg>
mii write  <addr> <reg> <data> - write MII PHY <addr> register <reg>
mii dump   <addr> <reg>        - pretty-print <addr> <reg> (0-5 only)
Addr and/or reg may be ranges, e.g. 2-7.

usb

通过usb命令,可以显示当前系统的usb设备,并进行简单的读写,可用于一些简单的调试。

zynq-uboot> usb
usb - USB sub-system

Usage:
usb start - start (scan) USB controller
usb reset - reset (rescan) USB controller
usb stop [f] - stop USB [f]=force stop
usb tree - show USB device tree
usb info [dev] - show available USB devices
usb test [dev] [port] [mode] - set USB 2.0 test mode
    (specify port 0 to indicate the device's upstream port)
    Available modes: J, K, S[E0_NAK], P[acket], F[orce_Enable]
usb storage - show details of USB storage devices
usb dev [dev] - show or set current USB storage device
usb part [dev] - print partition table of one or all USB storage    devices
usb read addr blk# cnt - read `cnt' blocks starting at block `blk#'
    to memory address `addr'
usb write addr blk# cnt - write `cnt' blocks starting at block `blk#'
    from memory address `addr'

pci

通过pci命令来访问pci配置空间和pci设备bar空间,调试使用,且使用场景很少。

i2c

调试i2c接口芯片,在操作系统启动之前完成硬件初始化,

zynq-uboot> i2c
i2c - I2C sub-system

Usage:
i2c bus [muxtype:muxaddr:muxchannel] - show I2C bus info
crc32 chip address[.0, .1, .2] count - compute CRC32 checksum
i2c dev [dev] - show or set current I2C bus
i2c loop chip address[.0, .1, .2] [# of objects] - looping read of device
i2c md chip address[.0, .1, .2] [# of objects] - read from I2C device
i2c mm chip address[.0, .1, .2] - write to I2C device (auto-incrementing)
i2c mw chip address[.0, .1, .2] value [count] - write to I2C device (fill)
i2c nm chip address[.0, .1, .2] - write to I2C device (constant address)
i2c probe [address] - test for and show device(s) on the I2C bus
i2c read chip address[.0, .1, .2] length memaddress - read to memory
i2c write memaddress chip address[.0, .1, .2] length [-s] - write memory
          to I2C; the -s option selects bulk write in a single transaction
i2c reset - re-init the I2C Controller
i2c speed [speed] - show or set I2C bus speed

读tca6416,读GPIO输入,

ZynqMP> i2c bus
Bus 0:  i2c@ff020000
   75: i2c-mux@75, offset len 1, flags 0
Bus 2:  i2c@ff020000->i2c-mux@75->i2c@0
Bus 3:  i2c@ff020000->i2c-mux@75->i2c@1
Bus 4:  i2c@ff020000->i2c-mux@75->i2c@2
Bus 1:  i2c@ff030000  (active 1)
   74: i2c-mux@74, offset len 1, flags 0
   75: i2c-mux@75, offset len 1, flags 0
Bus 5:  i2c@ff030000->i2c-mux@74->i2c@0  (active 5)
   54: eeprom@54, offset len 1, flags 0
Bus 6:  i2c@ff030000->i2c-mux@74->i2c@1
Bus 7:  i2c@ff030000->i2c-mux@74->i2c@2
Bus 8:  i2c@ff030000->i2c-mux@74->i2c@3
Bus 9:  i2c@ff030000->i2c-mux@74->i2c@4
Bus 10: i2c@ff030000->i2c-mux@75->i2c@0
Bus 11: i2c@ff030000->i2c-mux@75->i2c@1
Bus 12: i2c@ff030000->i2c-mux@75->i2c@2
Bus 13: i2c@ff030000->i2c-mux@75->i2c@3
Bus 14: i2c@ff030000->i2c-mux@75->i2c@4
Bus 15: i2c@ff030000->i2c-mux@75->i2c@5
Bus 16: i2c@ff030000->i2c-mux@75->i2c@6
Bus 17: i2c@ff030000->i2c-mux@75->i2c@7
ZynqMP> i2c dev 0
Setting bus to 0
ZynqMP> i2c md 0x21 0 2
0000: 7f ff    ..
ZynqMP> i2c md 0x20 0 2
0000: ee ff    ..
ZynqMP> i2c md 0x20 0 1
0000: ee    .
ZynqMP> i2c md 0x20 1 1
0001: ff    .

写tca6416,控制GPIO输出,

ZynqMP> i2c md 0x20 0 2
0000: ee ff    ..
ZynqMP> i2c mw 0x20 2 0xef  
ZynqMP> i2c md 0x20 0 2   
0000: ef ff    ..
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值