Appendix: Copy a User Binary to the Flash Device (2 Terminals)

To boot from a flash device, you need to copy the binary to the device. These instructions describe how to use two command prompts or terminals to flash the user binary file.

Note: If you want to store the binary in the same flash device that holds the FPGA bitstream, refer to Copy a User Binary to Flash (Efinity Programmer) instead.
You use two command prompts or terminals:
  • The first terminal opens an OpenOCD connection to the SoC.
  • The second connects to the first terminal to write to the flash.
Important: If you are using the OpenOCD debugger in Eclipse, terminate any debug processes before attempting to flash the memory.

Set Up Terminal 1

To set up terminal 1, the flow varies on your IDE selection during the Sapphire SoC generation.

Efinity RISC-V Embedded Software IDE Selected
  1. Open a Windows command prompt or Linux shell.
  2. Change the directory to any of the example designs in your selected bsp location. The default location for <efinity-riscv-ide installation path> would be C:\Efinity\efinity-riscv-ide-2022.2.3 for windows and home/<user>/efinity/efinity-riscv-ide-2022.2.3 for Linux.
    Note: The 2022.2.3 in the installation path may be different based on your IDE versions.
    Windows:
    <efinity-risc-v-ide installation path>\openocd\bin\openocd.exe -f ..\..\..\bsp\efinix\EfxSapphireSoc\openocd\ftdi.cfg 
    -c "set CPU0_YAML ..\..\..\cpu0.yaml" 
    -f ..\..\..\bsp\efinix\EfxSapphireSoc\openocd\flash.cfg
    Linux:
    <efinity-risc-v-ide installation path>/openocd/bin/openocd -f ../../../bsp/efinix/EfxSapphireSoc/openocd/ftdi.cfg 
    -c "set CPU0_YAML ../../../cpu0.yaml" 
    -f ../../../bsp/efinix/EfxSapphireSoc/openocd/flash.cfg
    The OpenOCD server connects and begins listening on port 4444.

Legacy Eclipse IDE Selected

  1. Open a Windows command prompt or Linux shell.
  2. Change to SDK_Windows or SDK_Ubuntu.
  3. Execute the setup.bat (Windows) or setup.sh (Linux) script.
  4. Change to the directory that has the cpu0.yaml file.
  5. Type the following commands to set up the OpenOCD server:
    Windows:
    openocd.exe -f bsp\efinix\EfxSapphireSoc\openocd\ftdi.cfg 
      -c "set CPU0_YAML cpu0.yaml" 
      -f bsp\efinix\EfxSapphireSoc\openocd\flash.cfg
    Linux:
    openocd -f bsp/efinix/EfxSapphireSoc/openocd/ftdi.cfg 
      -c "set CPU0_YAML cpu0.yaml" 
      -f bsp/efinix/EfxSapphireSoc/openocd/flash.cfg
    The OpenOCD server connects and begins listening on port 4444.

Set Up Terminal 2

  1. Open a second command prompt or shell.
  2. Enable telnet if it is not turned on. Turn on telnet (Windows)
  3. Open a telnet local host on port 4444 with the command telnet localhost 4444.
  4. In the OpenOCD shell or command prompt, use the following command to flash the user binary file:
    flash write_image erase unlock <path>/<filename>.bin 0x380000
    Where <path> is the full, absolute path to the .bin file.
    Note: For Windows, use \\ as the directory separators.

Close Terminals

When you finish:
  • Type exit in terminal 2 to close the telnet session.
  • Type Ctrl+C in terminal 1 to close the OpenOCD session.
Important: OpenOCD cannot be running in Efinity RISC-V Embedded Software IDE when you are using it in a terminal. If you try to run both at the same time, the application will crash or hang. Always close the terminals when you are done flashing the binary.

Reset the FPGA

Press the reset button on your development board:
  • Trion® T120 BGA324 Development Board—SW2
  • Titanium Ti60 F225 Development Board—SW3
  • Titanium Ti180 J484 Development Board—SW1