Software Implementation

Microchip provides SoftConsole toolchain to build a RISC-V user application executable (.hex) file and debug it. The reference design files include the SoftConsole workspace that contains the MiV_uart_blinky software project. The MiV_uart_blinky user application is programmed on an external SPI Flash using Libero SoC. The user application blinks user LEDs and performs DDR3 read and write operations. The DDR3 read/write status is displayed on the UART terminal.

As per the Libero SoC design memory map, the UART and GPIO peripheral addresses are mapped to 0x60000000 and 0x60001000, respectively. This information is provided in the hw_platform.h file as shown in the following figure.

Figure 1. Peripheral Mapping

The user application must be executed from the TCM memory (code, data, and stack). Therefore, the RAM address in the linker script is set to the starting address of the TCM memory as shown in the following figure.

Figure 2. Linker Script

The linker script (miv-rv32-ram.ld) is available in the SoftConsole_Project\MiV_uart_blinky\miv_rv32_hal folder of the design files. Building the user application involves the following steps:

  1. 1.Creating a Mi-V SoftConsole project
  2. 2.Downloading the firmware drivers
  3. 3.Importing the firmware drivers
  4. 4.Creating the main.c file
  5. 5.Mapping firmware drivers and the linker script
  6. 6.Mapping memory and peripheral addresses
  7. 7.Building the application

For more information about these steps, see TU0775: PolarFire FPGA: Building a Mi-V Processor Subsystem Tutorial. The .hex file is created after successful build and it is used for design and memory Initialization configuration in Running the Demo.