Create a MicroBlaze, Test the UART in SDK, and Boot Linux using 2019.1 Vivado and PetaLinux Tools




This post contains everything needed to create a MicroBlaze design and boot Linux on it over JTAG. It also contains links to all the IP documentation and how to smoke-test a design before using it.


Versions Used

2019.1 Vivado, PetaLinux Tools, and XSDK

VMWare Workstation 14 Player running Ubuntu 16.04.5 LTS running on Windows 10



Update Vivado 2019.1


Note


I needed this patch to build the bitstream.


Steps


Step #1: Download the patch at:

https://www.xilinx.com/support/answers/72956.html#:~:text=You%20will%20see%20a%20MIG,will%20not%20generate%20a%20response.


Step #2: Exit Vivado 2019.1


Note: commands assume Vivado is installed at:

/tools/Xilinx/Vivado/2019.1/bin/vivado


Step #3: Run

mkdir /tools/Xilinx/Vivado/2019.1/patches
mkdir /tools/Xilinx/Vivado/2019.1/patches/AR72956
pushd /tools/Xilinx/Vivado/2019.1/patches/AR72956
unzip ~/Downloads/AR72956_vivado_2019_1_preliminary_rev1.zip

Step #4: Restart Vivado 2019.1


Step #5: Check that the Patch Applied


Enter in the Design


Notes

For Linux to boot on MicroBlaze


Page 19 of https://www.xilinx.com/support/documentation/sw_manuals/xilinx2019_1/ug1144-petalinux-tools-reference-guide.pdf lists the requirements to run Linux on a MicroBlaze. I've left out both the Non-volatile memory and Ethernet in this design. Also, I use an AXI Timer, not a Dual channel timer.


Steps


Step #1: Run Vivado 2019.1


Step #2: File > Project > New


Step #3: Click Next on the Create New Vivado Project window


Step # 3.1: Click Next in the Project Name window


Step #3.2: (A) Click RTL Project and (B) click Next


Step # 3.3: (A) Click Boards, (B) enter zcu102, (C) click on the line, and (D) click Next


Step #3.4: Click Finish


Create the Block Design


Steps


Step #1: Click Create Block Design


Step #1.1: Click OK


Step #2: (A) Click Board, (B) Pull DDR4 SDRAM to the Diagram, and (C) click OK


Step #3: Click Run Connection Automation


Step #3.1: (A) Check all checkboxes and (B) click OK

You should see:


Step #4: (A) Click +, (B) type micro, and (C) double-click MicroBlaze


Step #5: Click Run Block Automation


Step #6: (A) Check the Interrupt Controller checkbox and (B) click OK


Note: we select Linux with MMU later during IP customization


Note 2: this ^^^ step is how you get microblaze_0_local_memory


Step #7: Click Run Connection Automation


Step #7.1: (A) Select all checkboxes and (B) click OK

You should see:


Step #7.2: (A) Click Board, (B) click and drag UART, (C) click OK, and (D) click Run Connection Automation


Step #7.3: Click OK

You should see:


Step #8: (A) Click +, (B) Type AXI Timer, and (C) click AXI Timer


Step #8.1: Click Run Connection Automation



Step # 8.2: Click OK

You should see:



Step #9: Connect the axi_timer_0 interrupt and the axi_uartlite_0 interrupt pins to the microblaze_0_xlconcat


Note: you will still see the UART output in XSDK without this, and Linux will run, but you won't see any UART output.


Customize the MicroBlaze IP


Steps


Step #1: Double click on the microblaze_0 instance of the MicroBlaze


Step #1.1: (A) Select Linux with MMU and (B) click OK


You only need to set Linux with MMU. Here are the other pages as a reference.


Page 1


Page 2


Page 3


Page 4


Page 5


Page 6


Page 7


Get Ready to Create the Bitstream


Steps


Step #1: Check the Board



Step #2: Check the full design


Step #2.1: Zoom into the left side


Step #2.2: Zoom into the right side


Step #3: Check the Address Editor


Step #4: Check the Project Summary


Step #4.1: Click PROJECT MANAGER to get the Project Summary


You should see something like:


Create the Bitstream


Steps


Step #1: Create the HDL Wrapper


Step #1.1: (A) Click Sources, (B) right-click design_1 (design_1_hd), and (C) click Create HDL Wrapper...


Step #1.2: Leave Let Vivado manage wrapper and auto-update selected and click OK


You should see:


Step #2: Click Generate Bitstream


Step #2.1: Click Save


Step #2.2: Click Yes on the No Implementation Results Available notification box


Step #2.3: Select as many cores as you can and click OK


Note: this can take 1 to 2 hours to run


Note 2: You should see a status indicator in the upper right-hand corner


Program the Bitstream


Steps


Step #1: (A) Select Open Hardware Manager and (B) click OK


Step #2: Plug the UART and JTAG USB cables into the board...


Step #2.1: ...and into a hub...


Step #2.2: ...which is plugged into the computer


Important note: using a hub is a good way to connect the JTAG and UART USB devices to a VM. It has worked for VMWare and VirtualBox.


Step #3: Make sure the SW6 is set to JTAG boot the ZCU102


Step #4: Turn on the ZCU102


Step #5: Ensure that the Cygnal Integrated CP2108 Quad USB to UART Bridge Controller is enabled and Future Devices Digilent USB Device is enabled.


Step #6: Click Open target



Step #7: Click Auto Connect


Step #8: Click Program device


Step #9: Click Program


You should see:



Export the Design for UART Smoke Test with XSDK and Creating a Linux Build with PetaLinux


Steps


Step #1: (A) Click File, (B) Export, and (C) Export Hardware...


Step #1.1: Click OK



Create a Hello World test App to Test the UART Works Before Creating a Linux Build


Steps


Step #1: (A) Click File and (B) click Launch SDK


Step #1.1: Click OK


Step #2: (A) Click the drop-down and (B) click Application Project


Step #2.1: (A) Use Hello_world for the Project name: and (B) click Next


Important Note: never use spaces; the SDK cannot handle spaces


Step #2.2: (A) Click Hello World and (B) Finish


Step #3: Open a terminal and start screen using:

screen /dev/ttyUSB2 9600

Note 1: Type Ctrl-a d to detach, Ctrl-a k to kill


Note 2: After detaching, reattached with:

screen -r 

Note 3: if someone else has attached, reattach with:

screen -x

Note 4: to clear what's in a screen, type Ctrl-a C. To get more commands, type Ctrl-a ?


Step #4: (A) Right-click on Hello_world, (B) click Debug As, and (C) click Launch on Hardware (System Debugger)


Step #5: Click Yes to Confirm Perspective Switch

You will likely not see anything because the target is stuck at:

void XUartLite_SendByte(UINTPTR BaseAddress, u8 Data)
{
 while (XUartLite_IsTransmitFull(BaseAddress));   /* <<<<< stuck */

 XUartLite_WriteReg(BaseAddress, XUL_TX_FIFO_OFFSET, Data);
}

...and the memory load from the UART returned:


xsct% mrd 0x40600000

xsct% Memory r