pynq_to_zynq

The Zynq Learning Journey: From PYNQ-Z2 to Custom

1. The Mission

Objective: To master the design and implementation of embedded systems that integrate a Linux System-on-Chip (SoC) with FPGA Programmable Logic (PL).
Ultimate Goal: To possess the full-stack engineering skills required to bring up a custom PCB, creating the Board Support Package (BSP), configuring the hardware interfaces, and writing the software drivers that bridge the OS and the FPGA.

2. The Hardware Platform

3. Core Knowledge Domains

A. Architecture Fundamentals

B. The Skill Hierarchy

  1. The “Soft” Integration (Level 1): Using Python/PYNQ libraries to control pre-made hardware overlays via Memory Mapped IO (MMIO).
  2. The Hardware Design (Level 2): Using Vivado IP Integrator to create custom hardware blocks and signal routing.
  3. The Acceleration (Level 3): Using HLS (High-Level Synthesis) and DMA to offload computational tasks from the CPU to the FPGA.
  4. The OS Architecture (Level 4): Building custom Linux images using PYNQ SDBuild, Yocto, or PetaLinux.
  5. The Custom BSP (Level 5): Configuring clocks, DDR timings, and device trees for a completely new hardware environment.

4. The Roadmap

Phase 1: Board Bring-up & “Hello World”

Phase 2: The PYNQ Flow (Rapid Prototyping)

Phase 3: The Vivado Flow (Hardware Definition)

Phase 4: Beyond the Basics (Graduation)

5. The “Loopback” Proof Project

This capstone project serves as the metric for your progress. It touches every layer of the stack required for a custom PCB design.

Toolchain Version Clarification

This guide’s procedures and examples are verified with the following development environment and toolchain versions:

Please note that minor differences in tool versions may require adjustments to the build process.

Concept

A system where the Linux CPU writes a value to a custom hardware register in the FPGA, the FPGA modifies it, and the CPU reads it back. This proves you can bridge the PS/PL divide without relying on pre-made drivers.

Steps to Success:

  1. The PL Logic (Hardware):
    • Create a simple custom IP (Verilog or HLS) that accepts a 32-bit integer, adds 1 to it, and stores it in an output register.
    • Expose this IP as an AXI4-Lite Slave.
  2. The Integration (Vivado):
    • Create a Block Design connecting the Zynq PS AXI GP Master port to your custom IP’s Slave port.
    • Assign a specific address in the memory map (e.g., 0x43C00000).
    • Export the Hardware Platform (.xsa).
  3. The System Build (PetaLinux/Yocto):
    • Do not use the standard PYNQ image.
    • Initialize a fresh PetaLinux project using your .xsa.
    • Customize the Device Tree (system-user.dtsi) to ensure the kernel recognizes your address space (optional but recommended best practice).
    • Build a minimal Linux image (Kernel + RootFS) and boot via SD card to a command-line prompt.
  4. The Software Driver (PS/C Code):
    • Write a standalone C program on the Zynq.
    • Use the /dev/mem interface to map the physical address 0x43C00000 into the user-space virtual memory.
    • Write an integer to the mapped pointer.
    • Read the result.
    • Success Condition: The program prints: Sent: 10, Received: 11.

Success Criteria

When you can boot a minimal Linux OS that you built yourself, on hardware you configured yourself, and talk to a logic block you designed yourself, you are ready to design a custom board.

6. Next Phase

Ready to start? Let’s check your hardware.

Go to Phase 1: Board Bring-up & “Hello World”