MicroZed Chronicles: Building PetaLinux for MicroBlaze — Part One




MicroZed Chronicles: Building PetaLinux for MicroBlaze — Part One

The ability to add a high-level operating system to your SoC brings with it several advantages. It enables us to have several different applications running on it as they are multi-tasking and it greatly eases implementing network and communications.

Of course, it is also used by a wide range of software developers, who are familiar with working with Linux helping accelerate the application development.

In this blog and the next one, we are going to look at how we can build a MicroBlaze system which runs Linux.

The first thing we need to do is build the hardware design in Vivado which is what we will be looking at in this blog. To do this, we will be using the following IP that will create a simple system:

  • MicroBlaze Processor
  • Memory Interface Generator
  • AXI Dual Timer
  • AXI UART Lite
  • AXI Ethernet Lite
  • AXI Interrupt Controller
  • AXI GPIO
  • AXI QSPI

For this blog, I will be targeting the Artix 100T device.

The first step in the design process is to add in the MicroBlaze processor. We need to configure this to be able to run Linux as such from the drop-down menu I selected Linux with MMU for the configuration.

Selecting the Linux with MMU configuration

I then left the next three pages of options unchanged; however, on page 4 I did increase the size of the cache to 64KB.

Increasing the Cache Size

The final adjustment was on page seven to enable the AXI Interfaces.

Enabling the AXI Interfaces

With the processor placed on the block diagram, the next stage was to implement the MIG and clocking.

The MIG is generated to support a 256 MB DDR3L.

Summary of the MIG configuration
Detailed information on the MIG configuration

With the processor and the MIG instantiated, the next thing to address is the clocking, for which I used a clock wizard.

The clock wizard generates the Clkin and Sysclk clocks for the MIG. These frequencies are 200 MHz and 166.6667 MHz, respectively.

Clock wizard settings

The MicroBlaze and the reset of the AXI peripherals are clocked from the UI clock output from the MIG.

As I added in the rest of the AXI components identified above, the only other change I made was to the UART to set a baud rate of 115200.

Setting the AXI baud rate

With everything all included in the design, the final stage before verifying the design and building the image is to ensure the address map looks correct.

Completed address map

The completed design looks as below — I will put the TCL description on the GitHub.

Completed block design

A less complicated view of the same design showing only the AXI interconnects is also shown for clarity.

Block diagram showing interface connections only

When I implemented this design in the target device, not surprisingly as I was targeting a larger device left lots of room to add in the remainder of my IP.

Overall utilization

With that I built the project, generated the bit stream and exported it to SDK. Before I build the PetaLinux image, I want to ensure the base MicroBlaze design is working as expected.

To do this, I created two projects — the first the simple hello world project, the second a project to test the external DDR.

Creating the hello world program is very straight forward, and we have done it several times over the years.

When I ran this program on the MicroBlaze (running from the internal Block RAM), I received a hello world message as would be expected.

Results from two runs of the hello word program

This gives me some confidence that I can connect to and work with the MicroBlaze; although, I still want to know the memory is good before I spend the time building the PetaLinux image.

To do this, I am going to create a new application which shares the same BSP as the hello world application. This time I am going to use the pre-defined memory test application.

Selecting the memory test application

Once the memory test has been generated, we need to ensure that we are running the program from the on-chip memory and not DDR as that is what we want to test.

As such, select the project in the project explorer, and then go to Xilinx->Generate Linker Script.

This will open the linker script generation dialog which allows us to define the area of memory the program runs from. In this case, it will be the Local BRAM.

Setting the program to run from the local BRAM

Once this program has been created, we can build the ELF file and run it on the hardware using a debug session.

Results of the memory test

You will see above in the memory test that the application successfully ran and that we can be sure the DDR is correctly configured in the design.

We are now ready to build the PetaLinux image which I will leave until next time!

See My FPGA / SoC Projects: Adam Taylor on Hackster.io

Get the Code: ATaylorCEngFIET (Adam Taylor)

Access the MicroZed Chronicles Archives with over 270 articles on the Zynq / Zynq MpSoC updated weekly at MicroZed Chronicles.


MicroZed Chronicles: Building PetaLinux for MicroBlaze — Part One was originally published in Hackster Blog on Medium, where people are continuing the conversation by highlighting and responding to this story.

Original article: MicroZed Chronicles: Building PetaLinux for MicroBlaze — Part One
Author: Adam Taylor