본문 바로가기

pynq

Zynq-7000 Embedded Design Tutorial - (3)

< Example 6.  Peripheral PL IP 추가하기 >

 

   입력 :  Example1 Vivado project

              Example2 Vitis workspace

    출력 : 업데이트된 system_wrapper.xsa

               hellow_pl.elf 

 

  앞으로의 예제에 쓰이는 소스 코드들은

  https://github.com/Xilinx/Embedded-Design-Tutorials/tree/master/docs/Introduction/Zynq7000-EDT/ref_files  

  를 사용하라고 되어 있지만, 이상하게도 파일이 없다고 나온다. 그래서 아래 파일을 찾아서 사용하였다.

https://github.com/Xilinx/Embedded-Design-Tutorials/tree/gh-pages/docs/2020.2/source/docs/Introduction/Zynq7000-EDT/ref_files

 

Note : Pynq-Z2에서는 MIO에 연결된 LED가 없기 때문에 EMIO를 통해 LED를 연결해준다.

           그에 맞춰서 hello_pl.c에서 관련된 수정을 해준다음에 사용한다.

 

   * Vivado Design Diagram 업데이트

     . Vivado - Recent project에서 Example1에서 했던 edt_pynq 선택 -Flow Navigator 윈도우에서 IP Integrator-Open Block Design 

     . Diagram 윈도우에서 빈공간에 우클릭 - Add IP - AXI GPIO 추가.  Add IP - AXI Timer 추가

     . ZYNCQ7 Processing System을 더블클릭하여 Re-customize IP 다아얼로그 박스을 연다

        ; MIO Configuration - I/O Peripherals - GPIO - enable EMIO GPIO - width 는 1이 아닌 2 (LED포함)로 설정

        ; Interrupt - Fabric Interrupt (박스 체크한다) - PL-PS Interrupt Ports - IRQ_F2P 박스체크

      . Run Connection Autiomation 을 실행시켜서, All Automation 에 체크하여, 자동으로 연결하도록 한다.

      . AXI GPIO 를 더블클릭하여 Board 페이지에서 GPIO, GPIO2를 Custom으로 설정하고,        

          IP Configuration 페이지에서  GPIO Width 는 1 로 한다.

      . 인터럽트는 자동으로 연결되지 않아서, IRQ_F2P 위에 마우스놓은후 클릭, 드래그하여

         axi_timer_0의 interrupt핀에 연결한다.

       . ZYNQ7 Processing System의 GPIO_0 포트를 오른클릭하고, Make External을 선택한다.

   

   * External Pin에 Location Constraints 부여하기

     . Flow Navigator - RTL Analysis 아래 Open Elaborated Design  클릭

     . 오른쪽 위 드롭다운 메뉴에서 I/O _Planning 선택 - 하단부의 I/O Ports 윈도우에서

       GPIO_0_0_, gpio_sw_ 포트를 선택    tri_io 까지 expand한다.

        ; 내가 했을때는 포트이름이 gpio_sw 가 아니라 aduino .... 로 나와서 rename시킴)

      . Pynq의 Button1, Button2, LED1 의 Package Pin 을 넣어주고 (User manual참고), LVCMOS25로 설정

      . Flow Navigator - Program and Debug아래 Generate Bitstream 선택

          ; constraints 이름 설정. Fille Type = XDC.  

          ; 합성, implementation 실행됨

       . File - Export - Export Hardware 실행. Output은 Include bitstream으로 한다.

         ; system_wrapper.xsa 가 생성됨

 

   * Vitis Software Platform의 H/W update

      . Vitis 에서 Explorer view - pynq_edt platform 프로젝트 우클릭 - Updatge Hardware Specification

      . 위에서 생성한 system_wrapper.xsa 선택. pynq_edt 프로젝트 우클릭 - Clean Project - Build Project

        ; pynq_edt.xpfm 파일이 생성됨

 

   * PL IP 테스트

      . standalone application 을 생성한다

        ; File - New - Application Project 

        ; pynq_edt 선택, project name = hello_pl, Hello Wolrd 템플릿 선택

      . hello_pl 프로젝트 우클릭 하고 Import Sources 선택. ref_files/example6/hello_pl.c 선택

      . hello_world.c 는 삭제. hello_pl 프로젝트 우클릭하고 Build Project

         ; hello_pl.elf 파일이 생성됨. 
      . 보드를 JTAG 모드로 하고, Power on. UART 설정. 

      . hello_pl 프로젝트 우클릭하고 Run as - Launch on Hardware

      . 실제 동작은 잘 되었고, 반복 실행할때는 뭔가 이상한점 있지만..일단 OK.

         ; C code 에 대한 자세한 설명은 EDT 원 홈페이지 내용을 참고바람.

 

 

 

< Example 7.  AXI CDAM를  PS HP Slave Port와 연결 & 통합하기 >

 

 CDAM (Central DMA) IP를 사용하여, DDR의 한 영역에서 읽어서, DDR 다른 영역으로 DMA 동작을 하는 실습

 입력 :  Example6 Adding Peripheral PL IP

              Vitis workspace

    출력 : 업데이트된 system_wrapper.xsa

               cdma_app.elf 

 

     * Vivado Design 업데이트

     . Vivado - Recent project에서 Example6을 열어서,  Flow Navigator - Open Block Design

     . Diagram 윈도우에서 빈공간에 우클릭 - Add IP - AXI CDMA 추가.  

     . Diagram 윈도우에서 빈공간에 우클릭 - Add IP - Concat IP 추가 (기존 AXI Timer와 CDMA의 IRQ를 mux 위해)    

       ; IRQ_F2P 에 연결된 net을 우클릭하여 delete. Concat 의 dout을 새로 연결

       ; AXI Timer 의 interrupt를 Concat 의 In0에, cdma_introut을 In1에 연결함

     . ZYNQ7 PS를 우클릭 - Customize Block - PS PL Configuration - HP Slave AXI Inteface 에서 HP0, HP2 check - OK

     . AXI CDMA를 우클릭 - Customize Block 후, data width=1024, burst=32, address width=32, 나머지 unchecked - OK

     . Run Connection Automation - All Automation check - OK

     . Address Editor 위도우 선택 - axi_cdma_0의 HP0_DDR_LOWOCM, HP2_DDR_LOWOCM 을 unassign하고,

       HP0에 128M, 0x0000_0000, HP2에 128M, 0x1000_0000 으로 설정

      . Flow Navigator - PROGRAM AND DEBUG - Generate Bitstream

      . File - Export - Export Hardware  (include bitstream)

 

     * Standalone CDMA Application 생성

     . Vitis S/W 실행 - pynq_edt 플랫폼 우클릭 - Update Hardware Specification - OK - 해머아이콘 눌러서, Build Platform

     . File - New - Application Project -   cdma_app 생성 (Template은 empty application)

     . Explorer view - cdma_app 프로젝트의 src 우클릭 - Import Sources - cdma_app.c 선택

        ; source ,destination을 0x0000_0000, 0x1000_0000 으로 변경 수정함

      . cdma_app 우클릭 - Build Project

     

    * 보드에서 CDMA 실행

      . JTAG 모드로 on - cdma_app 우클릭 - Run as -> Run on Hardware