Modify the Bootloader
When you generate the Sapphire High-Performance SoC, the IP Manager does not include any pre-built firmware to target the on-chip RAM size you selected. You can compile SPI flash bootloader software codes in the embedded_sw/efx_hard_soc/software/standalone/bootloader
Notice: You need to install Efinity RISC-V Embedded Software
IDE to compile the bootloader or other software.
Note: By default, the bootloader uses only a single data line SPI. To
use dual or quad data line SPI, refer to Modify the Bootloader Software to Enable Multi-Data Lines.
Modify the Bootloader Software to Extend the External Memory Size
First you need to modify the bootloader code:
- Open the bootloaderConfig.h file in the embedded_sw/efxh_hard_soc/software/standalone/bootloader directory.
- Change the
#define USER_SOFTWARE_SIZEparameter for the new on-chip RAM size and save. - In Efinity RISC-V Embedded Software IDE, import standalone/bootloader project. Build the project to generate new bootloader.hex file.
Second, you update and re-generate the SoC in the IP Manager to point to your new bootloader.hex and change the application region size. The default maximum size is 324 KB.
- In the Sapphire High-Performance IP wizard, go to the HRB tab.
- Turn on the OCR Application option.
- Click the Browse button to select the new bootloader.hex you created in the previous set of steps.
- Generate the SoC.
Modify the Bootloader Software to Enable Multi-Data Lines
Before utilizing the multi-data lines SPI in your bootloader, ensure your board's flash device supports Dual or Quad I/O modes.
In the Efinity RISC-V Embedded Software IDE example design, data
ports 0 and 1 are exclusively connected. If you intend to use the Quad SPI for data
transfer, you must establish connections for data ports 2 and 3. The following table
shows the number of connected data lines interfacing with the respective FPGAs and flash devices.
| Development Kit | Flash device | Number of Data Lines Connected |
|---|---|---|
| Ti375C529 | IS25WP512M-JLLA3 | 4 |
| Ti375N1156 | GD25LB512MEYIGR | 4 |
In the bootloaderConfig.h file, you can define your preferred
SPI lane configuration by selecting from the following data line modes:
SINGLE_SPI: Single data lineDUAL_SPI: Dual data lineQUAD_SPI: Quad data line
#define SINGLE_SPI 1 //define DUAL_SPI for dual data SPI or QUAD_SPI for quad data SPI
void bsp Main() {
#ifndef SIM
spiFlash_init(SPI, SPI_CS);
spiFlash_wake(SPI, SPI_CS);
spiFlash_exit4ByteAddr(SPI, SPI_CS);
#ifdef SINGLE_SPI
spiFlash_f2m(SPI, SPI_CS, USER_SOFTWARE_FLASH, USER_SOFTWARE_MEMORY,
USER_SOFTWARE_SIZE);
#elif DUAL_SPI
spiFlash_f2m_dual(SPI, SPI_CS, USER_SOFTWARE_FLASH, USER_SOFTWARE_MEMORY,
USER_SOFTWARE_SIZE); //dual data line half duplex
#elif QUAD_SPI
spiFlash_f2m_quad(SPI, SPI_CS, USER_SOFTWARE_FLASH, USER_SOFTWARE_MEMORY,
USER_SOFTWARE_SIZE); //quad data line full duplex
#else
#error "You must either define SINGLE_SPI to use single data line SPI, DUAL_SPI to use
dual data line SPI or QUAD_SPI to use quad data line SPI."
#endif
#endif
void (*userMain)() = (void (*)())USER_SOFTWARE_MEMORY;
#ifdef SMP
smp_unlock(userMain);
#endif
userMain();
}
Note: If the flash device is GD25 (from Ti375N1156development kit), add
CFLAGS+=-DGD25_FLASH
before the LDSCRIPT?=${BSP_PATH}linker/bootloader.Id into the
bootloader application's makefile. Defining the GD25 includes the required commands
specific to the GD25 flash device.