Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
learn:programmable-logic:tutorials:htsspisf:start [2020/06/09 08:36] – [Vivado Steps for creating the block design and generate bitstream] Monica Ignatlearn:programmable-logic:tutorials:htsspisf:start [2022/08/01 22:47] (current) – Made note that this guide is only compatible with 2019.1 and older. Will need a newer guide James Colvin
Line 9: Line 9:
  
 This guide requires the existence of a Vivado project containing a Microblaze system built complete with **Quad SPI**, **External Memory**, and **Uart** cores, and that you have the appropriate QSPI mode jumper setting on the board. This guide requires the existence of a Vivado project containing a Microblaze system built complete with **Quad SPI**, **External Memory**, and **Uart** cores, and that you have the appropriate QSPI mode jumper setting on the board.
-You can follow the steps presented in the  [[https://reference.digilentinc.com/learn/programmable-logic/tutorials/nexys-4-ddr-getting-started-with-microblaze/start#prerequisites|Microblaze tutorial]], and see below the missing steps for adding QSPI Flash and perform all the connections.+You can follow the steps presented in the  [[/learn/programmable-logic/tutorials/nexys-4-ddr-getting-started-with-microblaze/start#prerequisites|Microblaze tutorial]], and see below the missing steps for adding QSPI Flash and perform all the connections.
 Since there are slight differences in the Vivado 2019.1 and the version in which the Microblaze tutorial was created, the user needs to check all the connections in the block design to make sure that are correctly made or present. Since there are slight differences in the Vivado 2019.1 and the version in which the Microblaze tutorial was created, the user needs to check all the connections in the block design to make sure that are correctly made or present.
 === Hardware === === Hardware ===
Line 16: Line 16:
 === Software === === Software ===
   * **Xilinx Vivado 2019.1 with the SDK package.**    * **Xilinx Vivado 2019.1 with the SDK package.** 
 +
  
 === Board Support Files === === Board Support Files ===
Line 21: Line 22:
     * //These files will describe GPIO interfaces on your board and make it easier to select your FPGA board and add GPIO IP blocks//     * //These files will describe GPIO interfaces on your board and make it easier to select your FPGA board and add GPIO IP blocks//
     * //Follow this Wiki guide ([[vivado:boardfiles|Vivado Board Files for Digilent 7-Series FPGA Boards]]  ) on how to install Board Support Files for Vivado//     * //Follow this Wiki guide ([[vivado:boardfiles|Vivado Board Files for Digilent 7-Series FPGA Boards]]  ) on how to install Board Support Files for Vivado//
 +
 +<WRAP center round important 80%>
 +The xilisf library was officially depreciated by Xilinx starting in 2019.2 with the release of Vitis. This guide is only directly compatible with 2019.1 and older versions of the Xilinx software.
 +</WRAP>
  
  
Line 116: Line 121:
  
 === 6. Add AXI Quad SPI IP === === 6. Add AXI Quad SPI IP ===
-From the Add IP option, select AXI Quad SPI IP with the following customization: Mode - Quad, slave device - Spansion:+From the Add IP option, select AXI Quad SPI IP with the following customization: Mode - Quad, slave device - Spansion (or Macronix for boards with Macronix flash) 
  
 {{:learn:programmable-logic:tutorials:htsspisf:axiquadipsettings.png?nolink&400|}} {{:learn:programmable-logic:tutorials:htsspisf:axiquadipsettings.png?nolink&400|}}
Line 293: Line 298:
  
 ==== SDK Steps to create a bootloader and program the board ==== ==== SDK Steps to create a bootloader and program the board ====
-===2. Create SPI Bootloader and BSP ===+=== 1. Create SPI Bootloader and BSP ===
   * To create the bootloader, go to //File > New > Application Project//.   * To create the bootloader, go to //File > New > Application Project//.
 Name the bootloader then hit Next.\\ Name the bootloader then hit Next.\\
Line 302: Line 307:
 {{:learn:programmable-logic:tutorials:htsspisf:spisrecapp.png?nolink&500|}} {{:learn:programmable-logic:tutorials:htsspisf:spisrecapp.png?nolink&500|}}
  
-===1. Configure Bootloader BSP ===+=== 2. Configure Bootloader BSP ===
  * Open the BSP project and open system.mss. Click "Modify this BSP's Settings". The memory device info needs to be passed to the xilifs library (//Overview > standalone > xilifs//).  * Open the BSP project and open system.mss. Click "Modify this BSP's Settings". The memory device info needs to be passed to the xilifs library (//Overview > standalone > xilifs//).
-  * //serial_flash_family = 5(Spansion/Micron)//+  * //serial_flash_family = 5(Spansion/Micron/Macronix)//
   * serial_flash_interface = 1(AXI SPI)   * serial_flash_interface = 1(AXI SPI)
 Click "Regenerate BSP sources". Click "Regenerate BSP sources".
Line 310: Line 315:
 {{:learn:programmable-logic:tutorials:htsspisf:configxilisf.png?nolink&400|}} {{:learn:programmable-logic:tutorials:htsspisf:configxilisf.png?nolink&400|}}
  
-Next we need to update the BSP to use the updated version of **xilisf**. To do this, right click on the BSP and select **Board Support Package settings** and make sure that **xilisf** is checked.+Next we should check that the BSP is updated in order to use the updated version of **xilisf**. To do this, right click on the BSP and select **Board Support Package settings** and make sure that **xilisf** is checked.
  
 {{:learn:programmable-logic:tutorials:htsspisf:xilisf.png?nolink&400|}} {{:learn:programmable-logic:tutorials:htsspisf:xilisf.png?nolink&400|}}
  
-  * In your newly created bootloader application, open **blconfig.h** located in src and change **FLASH_IMAGE_BASEADDR** to suit your needs. +  * In your newly created bootloader application, open **blconfig.h** located in bootloader/src/blconfig.h and change **FLASH_IMAGE_BASEADDR** to suit your needs. Save the file in order to rebuild the bootloader project to contain the latest updates
-It is important to note that this value is the offset that the image will have in Flash. +It is important to note that this value is the offset that the image will have in Flash. \\ 
 NOTE: If you are using the Cmod-A7 try the offset: 0x00300000. NOTE: If you are using the Cmod-A7 try the offset: 0x00300000.
  
Line 328: Line 334:
 {{:learn:programmable-logic:tutorials:htsspisf:verbose.png?nolink&800|}} {{:learn:programmable-logic:tutorials:htsspisf:verbose.png?nolink&800|}}
  
-Make sure to re-build the application after making these changes.+NOTE: If you are using a board with Macronix flash follow the additional steps:
  
 +  * Open **bootloader.c** from the sources and scroll down until you find the call to **XIsf_Initialize**. Double click the function name to highlight it, right click and select "Open Declaration". This will open **xilisf.c**.
 +  * Add the following line somewhere near the top of **xilisf.c**
 +<code>#define XISF_MACRONIX_DEV_MX25L3233F 0x2016  /**< Device ID for MX25L3233F */ </code>
 +  * In **xilisf.c** find the definition for IntelStmDevices[] and add the following:
 +<code>{XISF_MANUFACTURER_ID_MACRONIX, XISF_MACRONIX_DEV_MX25L3233F,
 +XISF_BYTES256_PER_PAGE, XISF_PAGES256_PER_SECTOR,
 +XISF_NUM_OF_SECTORS64}</code>
 +  * Save **xilisf.c**
 +<WRAP round important 1000px>
 +===Important if you are using a board with Macronix flash.===
 +The source files that need editing are part of a library (https://xilinx-wiki.atlassian.net/wiki/spaces/A/pages/18841939/xilisf) compiled into a bsp/domain. By navigating to the source files in SDK/Vitis, the local copy of the library's source files are opened. Any modification is done on this local copy and build into the static library (and application) upon build. However, when the source files of the bsp/domain are re-generated (context menu, Regenerate BSP sources), the changes made as explained above are overwritten from the originals in the Xilinx install directory. Take care this does not happen.
 +
 +A more permanent solution is forking the library repository (https://github.com/Xilinx/embeddedsw) editing the sources there and including a path to the modified repository in SDK/Vitis Xilinx->Repositories->Global. 
 +</WRAP>
 +
 +  * Make sure to re-build the application after making these changes.
  
 === 3. Program FPGA with bootloader === === 3. Program FPGA with bootloader ===
 +
 The hardware design including bootloader will be programmed into flash such that the FPGA loads it every time it boots. Configure the SPI jumper on the Nexys4 DDR board on the QSPI position. This allows the FPGA to load its bit file from the SPI flash. The FPGA bit file contains the configuration of the FPGA including initial contents of the Microblaze local BRAM. \\ The hardware design including bootloader will be programmed into flash such that the FPGA loads it every time it boots. Configure the SPI jumper on the Nexys4 DDR board on the QSPI position. This allows the FPGA to load its bit file from the SPI flash. The FPGA bit file contains the configuration of the FPGA including initial contents of the Microblaze local BRAM. \\
-Next connect the Nexys4 DDR board via the JTAG usb connector. Start a serial terminal (eg. terraterm) and select the port and set the baud rate to 9600 (as configured in the UARTlite block design).+Next connect the Nexys4 DDR board via the JTAG usb connector. Start a serial terminal (eg. Teraterm) and select the port and set the baud rate to 9600 (as configured in the UARTlite block design).
  
 Select the bootloader.elf file (in the Bootloader/Debug project) instead of "bootloop". Selecting "program" will generate a download.bit file in the "design_wrapper_hw_platform_0" project. Select the bootloader.elf file (in the Bootloader/Debug project) instead of "bootloop". Selecting "program" will generate a download.bit file in the "design_wrapper_hw_platform_0" project.
Line 344: Line 367:
 === 4. Flashing FPGA === === 4. Flashing FPGA ===
  
-The **Program Flash Memory** utility will be used again to store the bitstream initialized with the bootloader in BRAM.+The **Program Flash Memory** utility will be used again to store the bitstream initialized with the bootloader in BRAM. Move the jumper on the board in the JTAG position.
 The **Image File** is the **download.bit** that was generated previously, and should be located inside of your hardware platform folder.The **Offset** is 0x0 since the bitstream will be loading our project into memory. Select **Program** to continue. The flash type is "s25fl128sxxxxx0-spi-x1_x2_x4". Check "verify after flash". And finish by clicking "Program". The **Image File** is the **download.bit** that was generated previously, and should be located inside of your hardware platform folder.The **Offset** is 0x0 since the bitstream will be loading our project into memory. Select **Program** to continue. The flash type is "s25fl128sxxxxx0-spi-x1_x2_x4". Check "verify after flash". And finish by clicking "Program".
  
-After flashing you can restart the Nexys4 DDR by pressing the "prog" button. Again the bootloader should start and fail. Note that while the FPGA can load its bit file from flash it can also still be programmed as usual using JTAG.+After flashing you can restart the Nexys4 DDR by pressing the "prog" button. Note that while the FPGA can load its bit file from flash it can also still be programmed as usual using JTAG.
  
 {{:learn:programmable-logic:tutorials:htsspisf:progflash_bit.png?direct&500|}} {{:learn:programmable-logic:tutorials:htsspisf:progflash_bit.png?direct&500|}}
-------+
 === 5. Create a User Application === === 5. Create a User Application ===
 +
 This application will be the one that gets stored into Flash. For this tutorial we will be creating a simple **Hello World** project but the process applies to any project that you would want stored in flash. This application will be the one that gets stored into Flash. For this tutorial we will be creating a simple **Hello World** project but the process applies to any project that you would want stored in flash.
   * Create a **Hello World** application. //File > New > Application Project// and name your app. Then select **Next**.   * Create a **Hello World** application. //File > New > Application Project// and name your app. Then select **Next**.
Line 362: Line 386:
  
 === 6. Configure User App BSP === === 6. Configure User App BSP ===
 +
   * Next we need to make sure to store our program in DDR. In order to do this, right click on the **Hello World** application, and select **Generate Linker Script**.   * Next we need to make sure to store our program in DDR. In order to do this, right click on the **Hello World** application, and select **Generate Linker Script**.
 Place all sections into DDR: Place all sections into DDR:
Line 374: Line 399:
  
 {{:learn:programmable-logic:tutorials:htsspisf:helloconfigxilisf.png?nolink&500|}} {{:learn:programmable-logic:tutorials:htsspisf:helloconfigxilisf.png?nolink&500|}}
------- 
  
 === 7. Program Flash === === 7. Program Flash ===
 +
 In this step we will use the SDK **Program Flash Memory** utility to program our **Hello World** application to Flash. In this step we will use the SDK **Program Flash Memory** utility to program our **Hello World** application to Flash.
  
Line 392: Line 417:
  
 {{tag>learn programmable-logic tutorial nexys-4-ddr nexys-video arty cmod-s6 cmod-a7 microblaze}} {{tag>learn programmable-logic tutorial nexys-4-ddr nexys-video arty cmod-s6 cmod-a7 microblaze}}
-{{tag>learn programmable-logic tutorial genesys-2 microblaze}}+