pynq

Zynq-7000 Embedded Design Tutorial - (1)

ithryn 2022. 11. 8. 01:28

먼저 Pynq-Z2 보드를 위한 Vivado 설정을 수행

C:\Xilinx\Vivado\2021.2\data\boards  에

board_files\pynq-z2 디렉토리를 만들고, 그안에 pynq-z2 홈페이지에서 받은 Board 파일을 놓는다.

 

2022.1 버전에서는 

//data/xhub/boards/XilinxBoardStore/boards/Xilinx 위치에 하면 된다고 한다.

 

또는 Vivado init file에 다음 한줄을 추가하면 된다고 한다.

%APPDTA%Xilinx/Vivado/init.tcl  (없으면 새로 생성)

set_param board.repoPaths [list "D:/Xilinx/pynq-z2/A.0"]

 

==================================================

 

< Example 1 : Zynq SoC를 위한 New Embedded Project 생성 >

. 출력 : Vivado H/W handoff file (ex: system_wrapper.xsa)

 

* Vivado실행 - Quick Start Page - Create Project - Board tap에서 Pynq-Z2 를 선택하여 생성

* Flow Navigator - IP Integrator - Create Block Design (Design Name : system 으로 생성)

* Add IP (+) - ZYNQ7 Processing System IP 선택 -  Run BLock Automation

* Right-click in Diagram window - Validate Design 하면 Error 발생

   ;  M_AXI_GP0_ACLK 위에 마우스를 놓으면 펜모양을 변하고, port를 click후 drag하여

      FCLK_CLK0에 연결 후에, Validate Design하면 Sucessful.

* Source window - Hierarchy tab - expand Design Sources - right clk system(system.bd)

   - Create HDL Wrapper - Let Vivado manage wrapper and auto-update - system_wrapper.v 생성됨

* Flow Navigator - IP Integrator - Generate Block Design - Synthesis Option = Global - Generate

   - 여러가지 Output products 이 자동 생성됨

* File - Export - Export Hardware - Pre-synthesis로 Finish - system_wrapper.xsa 가 생성됨

 

=========================================================

 

 < Example 2 : "Hellow World" 생성 및  구동 >

  . 입력 : system_wrapper.xsa

  . 출력 : hello_world.elf

     Xilinx Vitis 실행하여 수행

 

   . Platform Project 생성 

        * File - New - Platform Project - project name 넣기 - Platform 페이지에서 

          Example1에서 만든 system_wrapper.xsa 선택 - Finish 

          ; Explorer view에서 platform.spr 더블클릭하면 platform view를 볼수 있음

          ; Explorer view에서 export -> project_name -> hw -> system_wrapper.xsa 를 더블클릭하면 address map 나옴

          ; project_name.xpfm : top level platform XML file 임

         * project 선택후 우클릭후 Build Project (또는 망치 아이콘) 

           ; standalone BSP (+FSBL) 가 build됨 

    . Hello World 프로그램 생성

         * File - New - Application Project - Platform에서 이전에 만든 platform project 선택

             - application project 이름을 hello_world  (system project는 자동으로 hello_world_system으로 입력됨)

             - Templates 에서 Hello World 선택 (UART없는 platform 보드라면 선택이 안됨) - Finish

             ; Explorer view에서 hello_world, hello_word_systgem project가 보임

          *  hello_world 프로젝트를 우클릭하고 Build Project 

              ; hello_world.elf  binary가 생성됨

      . Pynq-Z2 에서 Hello World 실행하기

          * Pynq-Z2보드에서 booting을 JTAG으로 하도록 선택함 - micro USB에 컴퓨터 연결 - PowerOn

             - 컴퓨터 제어판 하드웨어 리스트에서 새로 생긴 COM 포트 번호 확인 (예: COM5)

           * Vitis tool에서 Window - Show view 에서 Vitis Serial Terminal 선택 - Open 

              - Vitis Serial Terminal에서 Add (+)버튼 - COM5, 115200, data8, stop1, par x, flow x 로 설정
           * hello_word 우클릭 - Run as - Run Configuarations - 우클릭 Single Application Debug - New Configuration - Run

                ; Vitis Serial Terminal에 Hello World 가 찍히는 것을 볼 수 있음

     

===============================================================

 

 < Example 3 : Vitis에서 Standalone S/W 디버깅 >

   . standalone application 디버깅

      * Debug As - Debug Configuration - Debug 버튼 - Debug perspective 열림

        ;Window -> Show view - Debug아래 Disassembly - open하면 disassembly 창이 열림

        ; Window -> Show view - Debug - Register

        ; 코드 왼쪽 line옆 공간을 double click하면 breakpoint 설정됨

        ; Run-Step Into, Run - Resume 등 수행