microzed open source linux in system qspi programming...

18
MicroZed Open Source Linux In System QSPI Programming Tutorial MicroZed Open Source Linux In System QSPI Programming Tutorial Version 14.5.01

Upload: others

Post on 10-Jun-2020

8 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: MicroZed Open Source Linux In System QSPI Programming Tutorialxilinx.eetrend.com/files-eetrend-xilinx/blog/201310/4908-15208-micro... · o Check “Silicon Labs CP210x USB-to-UART

MicroZed Open Source Linux In System QSPI Programming Tutorial

MicroZed Open Source Linux In System QSPI Programming Tutorial

Version 14.5.01

Page 2: MicroZed Open Source Linux In System QSPI Programming Tutorialxilinx.eetrend.com/files-eetrend-xilinx/blog/201310/4908-15208-micro... · o Check “Silicon Labs CP210x USB-to-UART

MicroZed Open Source Linux In System QSPI Programming Tutorial

Page 2 of 18

Revision History

Version Description Date

14.5.00 Initial release August 13, 2013

Page 3: MicroZed Open Source Linux In System QSPI Programming Tutorialxilinx.eetrend.com/files-eetrend-xilinx/blog/201310/4908-15208-micro... · o Check “Silicon Labs CP210x USB-to-UART

MicroZed Open Source Linux In System QSPI Programming Tutorial

Page 3 of 18

Table of Contents

Revision History .................................................................................................................. 2 Table of Contents ................................................................................................................ 3 Tutorial Overview ................................................................................................................ 4 Tutorial Setup Requirements .............................................................................................. 5

Software .................................................................................................................. 5 Hardware ................................................................................................................ 5

Setup MicroZed MicroSD Card ............................................................................................ 6 Updating MicroZed QSPI Using New MicroSD Card Image ................................................ 8 Validating MicroZed QSPI Programming .......................................................................... 13 Getting Help and Support ................................................................................................. 17

Page 4: MicroZed Open Source Linux In System QSPI Programming Tutorialxilinx.eetrend.com/files-eetrend-xilinx/blog/201310/4908-15208-micro... · o Check “Silicon Labs CP210x USB-to-UART

MicroZed Open Source Linux In System QSPI Programming Tutorial

Page 4 of 18

Tutorial Overview

This MicroZed tutorial offers system developers an example of how to:

1. In system program OSL (open source Linux) software components to the QSPI Flash memory building upon the lab activities of the Avnet 2013 SpeedWay training course entitled Implementing Linux on the Zynq™-7000 SoC.

2. Validate that in system Flash memory programming operation is successful by booting OSL from QSPI Flash on MicroZed.

Page 5: MicroZed Open Source Linux In System QSPI Programming Tutorialxilinx.eetrend.com/files-eetrend-xilinx/blog/201310/4908-15208-micro... · o Check “Silicon Labs CP210x USB-to-UART

MicroZed Open Source Linux In System QSPI Programming Tutorial

Page 5 of 18

Tutorial Setup Requirements

To complete this tutorial, the following software and hardware setups are recommended. This tutorial builds upon the concepts and lab activities of the Avnet 2012 SpeedWay training course entitled Implementing Linux on the Zynq™-7000 SoC. Please refer back to this training material on the MicroZed community website for further information on how to configure the underlying OSL platform.

Software

Recommended software tools:

Xilinx ISE WebPACK 14.5 (Free license and download from Xilinx website) o Check Xilinx AR51895 for required installation work-arounds

Silicon Labs CP210x USB-to-UART Bridge Driver o Check “Silicon Labs CP210x USB-to-UART Setup Guide” under

Documentation section on MicroZed.org for detailed instructions on installing and configuring this driver

Tera Term (Exact version used for this tutorial is V4.75)

Adobe Reader for viewing PDF content (Exact version used for this tutorial is Adobe Reader X 10.1.4)

Hardware

Targeted hardware consists of the following:

Available SD card slot on PC or external USB-based SD card reader

Avnet MicroZed (AES-Z7MB-7Z010-G)– included in kit

USB cable (Type A to Micro-USB Type B) – included in kit

4GB MicroSD card – included in kit

Page 6: MicroZed Open Source Linux In System QSPI Programming Tutorialxilinx.eetrend.com/files-eetrend-xilinx/blog/201310/4908-15208-micro... · o Check “Silicon Labs CP210x USB-to-UART

MicroZed Open Source Linux In System QSPI Programming Tutorial

Page 6 of 18

Setup MicroZed MicroSD Card

This section of the tutorial demonstrates how to setup a MicroZed MicroSD card to boot into an open source Linux platform.

1. Insert the MicroSD card into the PC or SD card reader and wait for it to enumerate as a Windows drive. If prompted by Windows when inserting the SD card, select the Continue without scanning option.

Figure 1 – Windows Prompt for Scanning and Fixing an SD Card

The Zynq BootROM is capable of interpreting the FAT32 file system for SD card boot mode. If the MicroSD card used is not already formatted for FAT32 file system, right click on the drive in Windows Explorer and select the Format option. Select the options shown in Figure 13 and click the Start button. When the format process is complete, click the Close button.

Figure 2 – Formatting the MicroSD Card with FAT32 File System

Page 7: MicroZed Open Source Linux In System QSPI Programming Tutorialxilinx.eetrend.com/files-eetrend-xilinx/blog/201310/4908-15208-micro... · o Check “Silicon Labs CP210x USB-to-UART

MicroZed Open Source Linux In System QSPI Programming Tutorial

Page 7 of 18

2. Copy the boot.bin, devicetree.dtb, init.sh, system.bit.bin, uImage, and uramdisk.image.gz files from the C:\Avnet\MicroZed\sd_image staging folder to the top level of the MicroSD card. Replace any existing versions of these files that may already be on the MicroSD card.

Figure 3 – The MicroZed Linux Platform Files Copied to the MicroSD Card

Once these files are copied to the MicroSD card, eject the MicroSD card from the PC or SD card reader.

Page 8: MicroZed Open Source Linux In System QSPI Programming Tutorialxilinx.eetrend.com/files-eetrend-xilinx/blog/201310/4908-15208-micro... · o Check “Silicon Labs CP210x USB-to-UART

MicroZed Open Source Linux In System QSPI Programming Tutorial

Page 8 of 18

Updating MicroZed QSPI Using New MicroSD Card Image

This section of the tutorial demonstrates how to boot MicroZed using the MicroSD card that was setup from the previous section.

1. Insert the 4GB MicroSD card included with MicroZed into the MicroSD card slot (J6) located on the underside of MicroZed module.

Figure 4 – MicroZed Hardware Reference

2. Verify the MicroZed boot mode (JP3-JP1) jumpers are set to SD card mode as shown in Figure 5. Further boot mode options are described in the MicroZed Hardware Users Guide.

Figure 5 – MicroZed SD Card Boot Mode Jumper Settings

Page 9: MicroZed Open Source Linux In System QSPI Programming Tutorialxilinx.eetrend.com/files-eetrend-xilinx/blog/201310/4908-15208-micro... · o Check “Silicon Labs CP210x USB-to-UART

MicroZed Open Source Linux In System QSPI Programming Tutorial

Page 9 of 18

3. Connect the USB-UART port of MicroZed (J2) to a PC using the MicroUSB cable. MicroZed will power on and the Green Power Good LED (D5) should illuminate.

4. Wait approximately 7 seconds. The blue Done LED (D2) should illuminate.

5. On the PC, if a serial terminal session is not already open, open a serial terminal program. Tera Term was used to show the example output for this lab document.

Figure 6 – Tera Term Icon

6. When the terminal output from U-Boot and a countdown is observed, allow the

countdown to expire.

Figure 7 – MicroZed U-Boot Booting Linux from SD Card

Page 10: MicroZed Open Source Linux In System QSPI Programming Tutorialxilinx.eetrend.com/files-eetrend-xilinx/blog/201310/4908-15208-micro... · o Check “Silicon Labs CP210x USB-to-UART

MicroZed Open Source Linux In System QSPI Programming Tutorial

Page 10 of 18

7. During the Linux boot process, the FAT32 file system on the MicroSD card will automatically be mounted by the startup script.

The first partition on the SD card shows up as mmcblk0p1 in the device tree. This device represents MMC block device 0, partition 1. This device will be mounted to the mount point /mnt and the init.sh startup script will be executed to begin the QSPI programming steps. The startup script uses the flashcp command to write each of the Linux software components to the appropriate MTD QSPI flash partitions according to the table below:

Software Component MTD Device QSPI Start QSPI Size (16MB)

Zynq Boot Image FSBL and U-Boot

(boot.bin) /dev/mtd0 0x00000000 0x100000 (1MB)

Linux Kernel (uImage)

/dev/mtd1 0x00100000 0x500000 (5MB)

Device Tree Binary (devicetree.dtb)

/dev/mtd2 0x00600000 0x20000 (128KB)

RAM Disk File System (uramdisk.image.gz)

/dev/mtd3 0x00620000 0x5E0000 (5.8MB)

Programmable Logic Bitstream

(system.bit.bin) /dev/mtd4 0x00C00000 0x400000 (4MB)

Figure 8 – Programming the QSPI MTD Partitions from Linux on MicroZed

Page 11: MicroZed Open Source Linux In System QSPI Programming Tutorialxilinx.eetrend.com/files-eetrend-xilinx/blog/201310/4908-15208-micro... · o Check “Silicon Labs CP210x USB-to-UART

MicroZed Open Source Linux In System QSPI Programming Tutorial

Page 11 of 18

8. Observe the results shown following the programming interval which takes about 50 seconds to complete. On the example system shown here, during the 50 second test interval, nearly 16 Megabytes of data were transferred between the Zynq Linux Processing System and the QSPI flash memory for an average throughput of 320 Kilobytes per second including erase cycles.

Figure 9 – QSPI Programming Completed Successfully

9. Once the QSPI programming is complete, make sure the MicroSD card is un-mounted prior to powering off MicroZed. Un-mount the MicroSD card from the /mnt mount point.

# cd /

# umount /mnt/

Page 12: MicroZed Open Source Linux In System QSPI Programming Tutorialxilinx.eetrend.com/files-eetrend-xilinx/blog/201310/4908-15208-micro... · o Check “Silicon Labs CP210x USB-to-UART

MicroZed Open Source Linux In System QSPI Programming Tutorial

Page 12 of 18

10. Power off the MicroZed module by disconnecting the MicroUSB cable from the PC USB port. MicroZed will power off and the Green Power Good LED (D5) will turn off.

11. On the PC, if a serial terminal session is still open and attached to the COM port associated with the MicroZed USB-UART port, verify that the serial terminal program is closed to avoid locking the port once power is restored to the MicroZed module.

Figure 10 – Closing the Serial Terminal Window

Page 13: MicroZed Open Source Linux In System QSPI Programming Tutorialxilinx.eetrend.com/files-eetrend-xilinx/blog/201310/4908-15208-micro... · o Check “Silicon Labs CP210x USB-to-UART

MicroZed Open Source Linux In System QSPI Programming Tutorial

Page 13 of 18

Validating MicroZed QSPI Programming

This section of the tutorial demonstrates how to verify that the QSPI programming from the previous exercise was indeed successfully completed.

1. Remove the 4GB MicroSD card from the MicroSD card slot (J6) located on the underside of MicroZed module. This will prevent the init.sh script on the SD card from being automatically launched and starting the programming process over again.

2. Verify the MicroZed boot mode (JP3-JP1) jumpers are set to QSPI card mode as described in the Hardware Users Guide.

Figure 11 – MicroZed QSPI Boot Mode Jumper Settings

3. Connect the USB-UART port of MicroZed (J2) to a PC using the MicroUSB cable. MicroZed will power on and the Green Power Good LED (D5) should illuminate.

4. Wait approximately 7 seconds. The blue Done LED (D2) should illuminate.

5. On the PC, if a serial terminal session is not already open, open a serial terminal program. Tera Term was used to show the example output for this lab document.

Figure 12 – Tera Term Icon

Page 14: MicroZed Open Source Linux In System QSPI Programming Tutorialxilinx.eetrend.com/files-eetrend-xilinx/blog/201310/4908-15208-micro... · o Check “Silicon Labs CP210x USB-to-UART

MicroZed Open Source Linux In System QSPI Programming Tutorial

Page 14 of 18

6. When the terminal output from U-Boot and a countdown is observed, allow the countdown to expire.

Figure 13 – MicroZed U-Boot Booting Linux from QSPI Flash

7. During the Linux boot process, the startup script will attempt to mount the FAT32 file system on the MicroSD card and launch the init.sh script. Since the SD card was removed in Step 12, the mount will fail and this will not happen during this exercise.

If you happened to have a custom application which you wanted to automatically launch from an SD card, placing an init.sh startup script (which launches your custom application) in the root of the first primary SD card partition is a convenient way to accomplish this.

Figure 14 – MicroZed Linux Booted from QSPI Flash

Page 15: MicroZed Open Source Linux In System QSPI Programming Tutorialxilinx.eetrend.com/files-eetrend-xilinx/blog/201310/4908-15208-micro... · o Check “Silicon Labs CP210x USB-to-UART

MicroZed Open Source Linux In System QSPI Programming Tutorial

Page 15 of 18

8. Continue to experiment with in system programming using flashcp command and the device tree MTD partition settings which define the QSPI logical flash partitions which can be accessed from Linux.

flash@0 {

compatible = "n25q128";

reg = <0x0>;

spi-max-frequency = <50000000>;

#address-cells = <1>;

#size-cells = <1>;

partition@qspi-fsbl-uboot {

label = "qspi-fsbl-uboot";

reg = <0x0 0x100000>;

};

partition@qspi-linux {

label = "qspi-linux";

reg = <0x100000 0x500000>;

};

partition@qspi-device-tree {

label = "qspi-device-tree";

reg = <0x600000 0x20000>;

};

partition@qspi-rootfs {

label = "qspi-rootfs";

reg = <0x620000 0x5E0000>;

};

partition@qspi-bitstream {

label = "qspi-bitstream";

reg = <0xC00000 0x400000>;

};

};

Before using a new Programmable Logic bitfile (sometimes referred to as Bitstream file) it needs to be converted because of PCAP byte swapping requirement. Promgen can perform the byte swapping task to complete the required conversion. The ISE promgen command and options to perform the byte swapping are shown below:

> promgen -w -b -p bin -o <user_design_binfile> -u 0

<user_design_bitfile> –data_width 32

Where <user_design_bitfile> is your custom Programmable Logic design bitfile and usually has a .bit file extension and <user_design_binfile> is the output file which has a .bin file extension. This file will be sent to the PCAP target from U-Boot during the boot process so it should be copied over to the SD card image as system.bit.bin when updating the QSPI flash.

As an alternative to using the promgen tool from the command line, there is a convenience script named convert_bitstream_to_binary.bat included with this

Page 16: MicroZed Open Source Linux In System QSPI Programming Tutorialxilinx.eetrend.com/files-eetrend-xilinx/blog/201310/4908-15208-micro... · o Check “Silicon Labs CP210x USB-to-UART

MicroZed Open Source Linux In System QSPI Programming Tutorial

Page 16 of 18

reference design in the C:\Avnet\MicroZed\sw\bitstream_byte_swap\ folder. Launch this script to quickly convert a bitfile named system.bit (default) to system.bit.bin with byte swapped format.

To customize the remaining Linux components beyond the prebuilt ones supplied in this tutorial, please follow the lab activities of the Avnet 2013 SpeedWay training course entitled Implementing Linux on the Zynq™-7000 SoC. Keep in mind that although each of the Linux components can be customized, they need to fit within the physical limits of the 16MB QSPI flash device on the standard MicroZed system on module.

If you find that you require additional QSPI storage space for your Linux system or application beyond the 16MB provided by the standard QSPI flash option, please contact your local Avnet FAE for further information on MicroZed expansion and customization options.

Page 17: MicroZed Open Source Linux In System QSPI Programming Tutorialxilinx.eetrend.com/files-eetrend-xilinx/blog/201310/4908-15208-micro... · o Check “Silicon Labs CP210x USB-to-UART

MicroZed Open Source Linux In System QSPI Programming Tutorial

Page 17 of 18

Getting Help and Support

Avnet Support

MicroZed is a versatile development kit, with all technical support being offered through the MicroZed.org website support forums. MicroZed users are encouraged to participate in the forums and offer help to others when possible.

For questions regarding the MicroZed community website, please direct any questions to:

MicroZed.org Web Master – [email protected]

To access the most current collateral for MicroZed please visit the community support page at:

www.microzed.org/content/support

Once on the MicroZed.org support page: To access the latest MicroZed documentation, click on the Documentation link:

To access the latest reference designs for MicroZed, click on the following link:

To access the MicroZed technical forums, click on the following link:

Xilinx Support

For questions regarding products within the Product Entitlement Account, send an e-mail message to the Customer Service Representative in your region:

Canada, USA and South America - [email protected]

Europe, Middle East, and Africa - [email protected]

Asia Pacific including Japan - [email protected]

Page 18: MicroZed Open Source Linux In System QSPI Programming Tutorialxilinx.eetrend.com/files-eetrend-xilinx/blog/201310/4908-15208-micro... · o Check “Silicon Labs CP210x USB-to-UART

MicroZed Open Source Linux In System QSPI Programming Tutorial

Page 18 of 18

For technical support including the installation and use of the product license file, contact Xilinx Online Technical Support at www.xilinx.com/support. The following assistance resources are also available on the website:

Software, IP and documentation updates

Access to technical support web tools

Searchable answer database with over 4,000 solutions

User forums