1.ZYNQ+linuxç½å£è°è¯ç¬è®°ï¼3ï¼PL-ETH
2.å¦ä½å©ç¨Zynq-7000çPLåPSè¿è¡äº¤äº
ZYNQ+linuxç½å£è°è¯ç¬è®°ï¼3ï¼PL-ETH
å¨ZYNQä¸ä½¿ç¨gigE Visionåè®®çç½ç»æ¥å£ç¸æºã
第ä¸æ¥ï¼è°éPS侧ç½å£GEM0ï¼Xilinx BSPé»è®¤é 好ï¼ã
第äºæ¥ï¼è°éPS侧ç½å£GEM1ï¼è§åä¸ç¯ææ¡£ï¼å¼åç¬è®°(1)ï¼ã
第ä¸æ¥ï¼è°éPL侧ç½å£ï¼æ¬æéè¿°ï¼ã
第åæ¥ï¼å¨PL侧ç½å£ä¸éªè¯Jumbo Frameç¹æ§ï¼å¹¶å¨åºç¨å±éé gigE Visionåè®®ã
æ ¹æ®ãxappãå¯ç¥ï¼PL侧çPHYæ¯æBase-XåSGMII两ç§é ç½®ï¼è¿ä¸¤ç§é 置对åºä¸¤ç§ä¸åçPHYå¼èæ¥å£ï¼è¿æ¥å°MACï¼ãèæ们çhdfæ件使ç¨çæ¯Base-Xçé ç½®ã
å ³äºç½å£çLinux驱å¨ï¼æ们å¨å®ç½æ¾å°ä¸ä»½èµæï¼ Xilinx Wiki - Zynq PL Ethernet ãèµæå¾é¿ï¼æ们åªçä¸æ们ç¸å ³ç2.4.1 PL Ethernet BSP installation for Base-Xâè¿ä¸ç« èå°±å¯ä»¥äºã
é¦å å¯¼å ¥FPGA设计åäºæä¾çhdfæ件ï¼
å¨å¼¹åºçå¾å½¢çé¢éï¼è¿å ¥Subsystem AUTO Hardware SettingsââEthernet SettingsââPrimary Ethernetï¼ç¡®è®¤å¯ä»¥çå°PL侧ç½ç»è®¾å¤axi_ethernet_0ï¼è¯´æhdfæ件éå·²å å«äºå¿ è¦çç½å£ç¡¬ä»¶ä¿¡æ¯ï¼
ä¸å¾ä¸è¢«éä¸çç½å£å°æ为Linuxä¸ç设å¤eth0ãè¿éæ们é»è®¤éæ©ps7_ethernet_0ï¼å³ä½¿ç¨GEM0ä½ä¸ºé¦éç½å£ã
å¯ç¨Xilinx AXI Ethernet驱å¨
è¿å ¥Device Drivers -- Network device support â éä¸Xilinx AXI Ethernetï¼ä»¥åXilinx Ethernet GEMï¼è¿æ¯PS侧ç½å£ç驱å¨ï¼
è¿å ¥Networking support â éä¸ Random ethaddr if unset
è¿å ¥Device Drivers -- Network device support -- PHY Device support and infrastructure â å¯ç¨Drivers for xilinx PHYs
è¿å ¥~~~~Device Drivers -- DMA Engine Support -â ç¦ç¨~~~~Xilinx AXI DMAS Engine~~~ ï¼å¯¹åºçé 置项å为 ~~ CONFIG_XILINX_DMA ~~~ï¼
注æï¼ Xilinx Wikié对设å¤æ èç¹çå¼ç¨æ误ï¼&axi_ethernetï¼ï¼å¯¼è´ç¼è¯æ¥éï¼åºæ¹ä¸º&axi_ethernet_0ã
注ï¼PL-ETH驱å¨æå¨è·¯å¾ï¼<project>/build/tmp/work-shared/plnx_arm/kernel-source/drivers/net/ethernet/xilinx/xilinx_axienet_main.cåxilinx_axienet_mdio.cã对åºçå æ ¸é 置项为CONFIG_NET_VENDOR_XILINXåCONFIG_XILINX_AXI_EMACã
å¯ç¨ethtoolåtcpdumpï¼è°è¯ç¨ï¼éå¿ é¡»ï¼ï¼
ç¶åå°çæçBOOT.BINåimage.ubæ·è´å°SDå¡æ ¹ç®å½ä¸ï¼å°SDå¡æå ¥æ¿åä¸ï¼ä¸çµè¿è¡ã
ä¸çµåï¼ä½¿ç¨ifconfig eth1æ¥çç½å£ä¿¡æ¯ï¼è§å¯MACå°åä¸è®¾ç½®çä¸è´ï¼ä¸ifconfig eth1 ..1. up没ææ¥éã
æµè¯ç½ç»éè·¯ï¼ping PCæ¯éçã说æç½å£å·¥ä½æ£å¸¸ã
Linuxä¸eth1ï¼å³PL-ETHï¼çMACå°åæ误
é®é¢æè¿°ï¼
å¼æºæå°ï¼
注æï¼
MACå°åæ¯éçï¼é©±å¨é解æåºçæ¯GEM0çMACå°åã
è¯éªåç°ï¼å³ä½¿å¨system-user.dtsiéä¸ålocal-mac-addressï¼ä¹ç §æ ·è§£æåºçæ¯GEM0çMACã
èå°system-user.dtsiéçlocal-mac-addressæ¹å为pl-mac-addressï¼å¹¶å°é©±å¨é解æçå符串ä¹å¯¹åºæ´æ¹ä¸ºpl-mac-addressï¼åå¯ä»¥æ£ç¡®è§£æåºæ¥ï¼
Passing MAC address to kernel via Device Tree Blob and U-Bootï¼
/support/answers/.html
U-Bootéçç¯å¢åéethaddrä¼è¦çæ设å¤æ épl-ethçlocal-mac-addrå段ï¼ä»èå½±åLinuxå¯å¨åçç½å¡MACå°åï¼
ä½U-Bootéçç¯å¢åéipaddrä¸ä¼å¯¹Linuxå¯å¨åçé 置产çä»»ä½å½±åãå 为设å¤æ éæ ¹æ¬å°±æ²¡æå ³äºIPå°åçé ç½®ã
phy-modeæä¹ä¼æ¯sgmiiï¼æ¥äºä¸å®æ¹çæä¾çBSPéï¼ä¹æ¯âsgmiiâã说æè¿ä¸ªæ²¡é®é¢ãå ·ä½åå ä¸æ¸ æ¥ã
@TODO: 设å¤æ éçä¸æå·ç顺åºå¦ä½å½±ååè½ï¼
为ä½è¯»åºæ¥çIRQå·ä¸å¯¹å¢ï¼è¿æ¯å 为è¿é读å°çä¸æ¯ç¡¬ä»¶çä¸æå·ï¼èæ¯ç»è¿ç³»ç»æ å°ä¹åç软件IRQ numberã两è ä¸å ·æ线æ§å ³ç³»ã
å ³äºä¸æå·ççé®ï¼
Linuxä¸çç½å£eth0ãeth1ç顺åºï¼ä¼¼ä¹æ¯æç §phyå°åä»å°å°å¤§æ¥æå¸çã
Xilinx xapp-zynq-eth.pdf (v5.0) July ,源码patchrom源码下载
/support/documentation/application_notes/xapp-zynq-eth.pdf
Xilinx Wiki - Zynq PL Ethernet:
/wiki/spaces/A/pages//Zynq+PL+Ethernet
Xilinx Wiki - Linux Drivers:
/wiki/spaces/A/pages//Linux+Drivers
Xilinx Wiki - Linux Drivers - Macb Driver:
/wiki/spaces/A/pages//Macb+Driver
Xilinx Wiki - Zynq Ethernet Performance:
/wiki/spaces/A/pages//Zynq+Ethernet+Performance
æ¥å°å ³äºJumbo frame MTUçå®ä¹ï¼å½åå¼ä¸ºï¼å¯å¦æ¹å¤§ä¸äºï¼
驱å¨æºç éå ³äºjumbo frameç说æï¼
设置MTU为ï¼åç°pingå æ大é¿åº¦åªè½è®¾ä¸ºping ..1. -s
https://lore.kernel.org/patchwork/patch//
ãå®ã
å¦ä½å©ç¨Zynq-çPLåPSè¿è¡äº¤äº
å¨Zynq-ä¸ç¼ç¨PL大è´æ3ç§æ¹æ³ï¼
1. ç¨FSBLï¼å°bitstreaméæå°boot.binä¸
2. ç¨U-BOOTå½ä»¤
3. å¨Linuxä¸ç¨xdevcfg驱å¨ã
æ¥éª¤ï¼
1. å»æbitstreamçæ件头
ç¨FSBLç§åPL Images没æä»ä¹å¥½è¯´çï¼ç¨Xilinx SDKçCreate Boot Imageå·¥å ·å³å¯å®æï¼ä¸åèµè¿°ãç¨å两ç§æ¹æ³éè¦æbitstreamæ件çæ件头ç¨bootgenå·¥å ·å»æã
ä¸ä¸ªå ¸åçbifæ件å¦ä¸æ示ï¼
the_ROM_image:
{
[bootloader]<fsbl_name>.elf
<pl_bitstream_name>.bit
<u-boot_name>.elf
}
bifæ件å¯ä»¥ç¨ææ¬ç¼è¾å¨åï¼ä¹å¯ä»¥ç¨Xilinx SDKçCreate Boot Imageå·¥å ·çæãç¶åå¨å½ä»¤è¡ä¸ç¨ä»¥ä¸å½ä»¤å³å¯å»æbitstreamæ件çæ件头ã
bootgen -image <bootimage>.bif -split bin -o i BOOT.BIN
"-splitâåæ°å¯ä»¥çæ以ä¸æ件ï¼
<pl_bitstream_name>.bit.bin
2. å¨U-BOOTä¸ç§åPL Image
å½ä»¤âfpga loadâåâfpga loadbâé½å¯ä»¥ãåºå«æ¯åä¸ä¸ªå½ä»¤æ¥åå»æäºæ件头çbitstreamæ件ï¼åä¸ä¸ªå½ä»¤æ¥åå«ææ件头çbitstreamæ件ã
å¨OSL .2ä¸ï¼ç¼ºçç¼è¯å°±å¯ä»¥å®æ´æ¯æåå ¥PL Imageçåè½ãä½æ¯å¨Petalinux .ä¸ï¼å°½ç®¡å¯ä»¥å¨U-BOOTä¸çå°å½ä»¤âfpgaâï¼è¿éè¦å¨æ件
<PROJ>/subsystems/linux/configs/u-boot/platform-top.h ä¸å¢å 以ä¸å 容åéæ°ç¼è¯æå¯ä»¥æ¯æå ·ä½çåè½ã
/* Enable the PL to be downloaded */
#define CONFIG_FPGA
#define CONFIG_FPGA_XILINX
#define CONFIG_FPGA_ZYNQPL
#define CONFIG_CMD_FPGA
#define CONFIG_FPGA_LOADFS
å¨OSL .2 U-BOOTä¸ï¼å ·ä½çåè½æ¯å¨zynqpl.cçzynq_load()ä¸å®ç°çã
3. å¨Linuxä¸ç§åPL Image
OSL Linux .2.ä¸å·²ç»å«æxdevcfg驱å¨äºï¼ä¹åå°±æï¼ä¸è¿æ¬ææ¯å¨è¿ä¸ªçæ¬ä¸éªè¯çï¼ï¼ç´æ¥ç¨ä»¥ä¸å½ä»¤å°±å¯ä»¥å®æPL Imageåå ¥ã
cat <path_to_storage_media>/<pl_bitstream_name>.bit.bin > /dev/xdevcfg
Linux驱å¨çæºä»£ç å¨xilinx_devcfg.cä¸ãå 为驱å¨çç¼å·æ¯éè¿alloc_chrdev_region()å¨æåé çï¼æ以ä¸éè¦æå·¥ç¨mknodå½ä»¤æå¨å»ºç«è®¾å¤èç¹ã
å¨Linux驱å¨ä¸ï¼æ¯æ¬¡å¾DevCfgä¸åå ¥åèï¼ç´å°å ¨é¨åå®ã
4. å¨ç¨æ·ç¨åºä¸ç§åPL Image
ç®å没æç°æçæºç æ¥å®æè¿ä¸ªåè½ï¼ä¸è¿å¯ä»¥ç¨mmap()æDevCfgçå¯åå¨æ å°å°ç¨æ·ç¨åºçèå°åä¸ï¼ç¶ååèä¸äºç°æç软件代ç æ¥å®æè¿ä¸ªåè½ï¼
* FSBLä¸çpcap.c
* U-BOOTä¸çzynqpl.c
* Linuxä¸çxilinx_devcfg.c
* Xilinx SDKä¸çä¾åãä¾åä½äºä»¥ä¸ä½ç½®ï¼éSDKççæ¬ä¼æååã
C:\Xilinx\SDK\.1\data\embeddedsw\XilinxProcessorIPLib\drivers\devcfg_v3_0\examples\index.html
å°ç»ï¼
DevCfgå¤è®¾å é¨æèªå·±çDMAï¼åªéè¦ç®åçé ç½®PL Imageçåºå°ååé¿åº¦å°DevCfgå¯åå¨ï¼å°±å¯ä»¥å®æZynq- PL Imageçå è½½ãXilinxå·²ç»æä¾äºçµæ´»ç解å³æ¹æ¡ï¼å¦æå¼åè è¦æè¿ä¸ªåè½éæå¨èªå·±çåºç¨ç¨åºä¸ï¼ä¹æå¾å¤ç代ç å¯ä»¥åèï¼å¹¶ä¸æ¯å¾å°é¾çä»»å¡ã