element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Path to Programmable 3
  • Challenges & Projects
  • Design Challenges
  • Path to Programmable 3
  • More
  • Cancel
Path to Programmable 3
Blog Path to Programmable III Training Blog #03: Build Petalinux for Lab 7 and Boot Petalinux via JTAG
  • Blog
  • Forum
  • Documents
  • Leaderboard
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Path to Programmable 3 to participate - click to join for free!
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: flyingbean
  • Date Created: 22 Jun 2023 5:23 AM Date Created
  • Views 2603 views
  • Likes 8 likes
  • Comments 2 comments
  • AMD XILINX
  • zynq
  • xilinx
  • fpga
  • vivado
  • Path to Programmable 3
  • minized
Related
Recommended

Path to Programmable III Training Blog #03: Build Petalinux for Lab 7 and Boot Petalinux via JTAG

flyingbean
flyingbean
22 Jun 2023

Table of Contents

  • Objectives
  • Build  BRAM + PWM IP Vivado Project
  • Petalinux Project For Lab 7
  • Boot Petalinux from JTAG
  • References

Objectives

As my Blog #2 said, the MiniZed is a single ARM Cortex®-A9 processor APU FPGA device. That means I am able to build an embedded OS, such as AMD Petalinux on MiniZed.  The blog will demonstrate how to build AMD Petalinux for Lab 7 and boot the Petalinux through JTAG chain. The main reason I did not plan to erase the image on QSPI memory is to keep a golden image on MiniZed for the WiFi Linux APIs in my future homework.

Build  BRAM + PWM IP Vivado Project

There is a gap between the source code from Avnet MiniZed TTC training materials, bram_test.c and Vivado FPGA project as I mentioned in my Blog 2. I presented how to update the software to get BRAM-to-BRAM testing case up into running. In fact, a better solution to close the gap is presented below.

Lab7_Memory_Map

Fig1: BRAM Memory Configuration for BRAM_test.c

Avnet MiniZed TTC lecture and Lab 7 instruction are able to lead any student to build the Vivado project very smoothly.   Fig 1 setting can get BRAM-to-BRAM test case: bram_test.c from Avent training source codes, up into running without any issues. The largest memory block moving, Sending 8192Byte data, is tested as Fig 2.

BRAM2BRAM_8192B

Fig 2. BRAM-to-BRAM Data Transfer: 8192 Bytes

Why do I need the memory range of the BRAM controller to be as big as 64KB as Fig 1 presented? Here is the theory under the hood.

AXI bus is a type of 64-Bit width bus, however the C source codes defined the data moving package is 32-bit as this:

source = (u32 *) BRAM_MEMORY;
destination = (u32 *) (BRAM_MEMORY + LENGTH);  // LENGTH = 8196

8192B *32bit/8bit = 4*8KB=32KB. BRAM_test.c can move 32KB data from BRAM in one direction and need another 32KB space to receive the data packages. That means  it needs twice of 32KB memory at BRAM. 64KB becomes the memory range for BRAM setting for Lab 6/7.

I uploaded the Vivado project output(xsa file) in Github (ref[2]).

Lab 7 is a good training material for learning Vivado IP flow. I am not going to repeat the details on how to create an IP repo and integrate it into a Vivado project in the blog. I plan to discuss how I build Petalinux from the Lab 7 Vivado project as below.

Lab7_Viv_Block_Design

Fig 3. Lab 7 Vivado Project Block Design View

Petalinux Project For Lab 7

I plan to boot Petalinux from JTAG chain without using QSPI flash for the lab7/8/9. So a local Petalinux project is a must for the tasks. The way I build a Petalinux is simple. AMD UG 1144 (ref[1])is my guidance for the homework.

Step 01: Create Petalinux project

petalinux-create --force --type project --template zynq --name MiniZed_BRAM

image

Fig 4. Petalinux Command demo: petalinux-create

Notes: ug1144(Chapter 3), petalinux-create command is used to create a new Petalinux project.

--template zynq : I select zynq platform for MiniZed project. There are five platforms from Petalinux 2021.1: versal, zynqMP, zynq, microblaze.

Step 02: Get into Petalinux project  folder

 

cd MiniZed_BRAM

image

Fig 5. Petalinux command demo: get into Petalinux project folder

Step 03: Configure Vivado/Petalinux hardware

petalinux-config --get-hw-description=../

image

Fig 6. Petalinux command demo: petalinux-config

I import the hardware description with petalinux-config command by giving the path of the directory containing the .xsa file.

Then Petalinux tool will pop up configuration GUI as below.

Petalinux configuration GUI

Fig 7. Petalinux command demo: Petalinux configuration GUI

I do not change any configuration at the initial Petalinux running. I also leave (template) MACHIN_NAME without choosing any Xilinx evaluation board/BSP name, since there is no MINIZED BSP from the Petalinux tool chain for now.

Step 04: Build Petalinux Images

I kick off the final Petalinux command:

petalinux-build

 image

Fig 8. Petalinux command demo: petalinux-build

After 2-3 hours building time, there are some errors print out from Ubuntu.

MiniZed_Petalinux_build_error

Fig 9. MiniZed Lab 7 Petalinux Initial Build Errors

The red error messages are very overwhelming. After I review the error messages, there is only one error matter to the build, which is marked in yellow as Fig 10.

Petalinux_build_error

Fig 10. Petalinux Build Error Message Trouble-shooting

Error message: /axi/ptm@f889d000: reference to non-existent node or label “cpu1”.

MiniZed is a single core FPGA system. There is no second cpu (cpu1) on FPGA. So the default device tree generated from Petalinux needs some manual workarounds as below.

device_tree

Fig 11. Petalinux Build Device Tree Update: system-user.dtsi

Element14 Community already had some discussion on this topic./technologies/fpga-group/f/forum/39566/petalinux-2020-1-for-single-core-zynq-soc_variant

Root case:

Please check device tree file zynq-7000.dtsi from 2021.1 as below. It looks debug_cpu_pt entry was added with 2021.1 version as default for both CPUs.

ptm@f889c000 {

compatible = "arm,coresight-etm3x", "arm,primecell";

reg = <0xf889c000 0x1000>;

clocks = <&clkc 27>, <&clkc 46>, <&clkc 47>;

clock-names = "apb_pclk", "dbg_trc", "dbg_apb";

cpu = <&cpu0>;

out-ports {

port {

ptm0_out_port: endpoint {

remote-endpoint = <&funnel0_in_port0>;

};

};

};

};



ptm@f889d000 {

compatible = "arm,coresight-etm3x", "arm,primecell";

reg = <0xf889d000 0x1000>;

clocks = <&clkc 27>, <&clkc 46>, <&clkc 47>;

clock-names = "apb_pclk", "dbg_trc", "dbg_apb";

cpu = <&cpu1>;

out-ports {

port {

ptm1_out_port: endpoint {

remote-endpoint = <&funnel0_in_port1>;

};

};

};

};

I think the permanent solution should be

ptm@f889c000 {

compatible = "arm,coresight-etm3x", "arm,primecell";

reg = <0xf889c000 0x1000>;

clocks = <&clkc 27>, <&clkc 46>, <&clkc 47>;

clock-names = "apb_pclk", "dbg_trc", "dbg_apb";

cpu = <&cpu0>;

out-ports {

port {

ptm0_out_port: endpoint {

remote-endpoint = <&funnel0_in_port0>;

};

};

};

};



//ptm@f889d000 {

//compatible = "arm,coresight-etm3x", "arm,primecell";

//reg = <0xf889d000 0x1000>;

////clocks = <&clkc 27>, <&clkc 46>, <&clkc 47>;

clock-names = "apb_pclk", "dbg_trc", "dbg_apb";

//cpu = <&cpu1>;

//out-ports //{

//port {

//ptm1_out_port: endpoint {

//remote-endpoint = <&funnel0_in_port1>;

//};

//};

//};

//};

Update system_user.dtsi as Fig 11 and rerun petalinux-build command line as Fig 8.

The working Petalinux images can be found at ref[2].

Boot Petalinux from JTAG

I finally found myself a good excuse to boot Petalinux image from JTAG since MiniZed has no SD card port. UG1144(ref[1]) chapter 5 gives all details on this feature.

Step 01: Power off the board and connect the JTAG port on MiniZed via USB cable to the Ubuntu host PC.

Step 02: Booting mode of MiniZed has to be JTAG mode as Fig 12, SW1 has a mark, J, beside the part, which means JTAG booting mode.

MiniZed_Boot_mode

Fig 12. Boot Mode Setting on MiniZed

Step 03: Testing and check JTAG port name from XSCT

Vitis XSCT utility can detect JTAG url number as Fig 13.

 image

Fig 13.   MiniZed JTAG Port url Number

Step 04: Package pre-built folder under Petalinux project

petalinux-package --prebuilt

Package_prebuilt

 Fig 14. Petalinux command demo: petalinux-package

Step 05: Boot Petalinux via JTAG

Petalinux-boot –jtag -prebuild 3 –hw_server-url TCP:127.0.0.1:3121

Petalinux_boot

Fig 15. Petalinux command demo: petalinux-boot

I finally boot Petalinux from JTAG and I can communicate with MiniZed via UART on Petalinux OS. Great start point for Petalinux API development.

image

Fig 16. Petalinux  of Lab 7 from UART

 

In summary,  JTAG booting Petalinux image will give me a lot of freedom to develop Petalinux API projects on MiniZed platform before I get a beta version of the Petalinux images to be programmed into either eMMC flash memory or QSPI flash memory.

References

[1] UG1144, Petalinux Tools Documentation Reference Guid, V2021.1, 2021

[2] Flyingbean MiniZed Github link: https://github.com/flyingbean/MiniZed.git

  • Sign in to reply
  • navadeepganeshu
    navadeepganeshu over 2 years ago

    Nice! Thanks for detailed writeup. I am about to enter petalinux side of training.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • javagoza
    javagoza over 2 years ago

    Great tutorial! Thanks for sharing.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube