AN 1011: TinyML Applications in Altera FPGAs Using LiteRT for Microcontrollers
ID
848984
Date
4/07/2025
Public
Visible to Intel only — GUID: ttz1740385502786
Ixiasoft
5.2.2. Booting via the Debugger
Use the Quartus® Prime Programmer tool and the Ashling* RiscFree* IDE for Altera® FPGAs to program the Arm HPS processor-based system (hardware and software system respectively) into the FPGA and to run your application.
- Make sure you set MSEL dipswitch SW27 to JTAG: (OFF-OFF-OFF-OFF). Then connect the HPS UART to a terminal on your machine, like Putty or MobaXterm on Windows, or Minicom on Linux.
- Add the BL2 FSBL to the generated GHRD .sof file. First, convert bl2.bin file into a hex format, then use quartus_pfg to embed the hex format of BL2 with ghrd .sof file, and create the .rbf format file per the following steps:
$ cd $TOP_FOLDER/tinyml_bins $ aarch64-none-linux-gnu-objcopy -v -I binary -O ihex --change-addresses 0x0 bl2.bin bl2.hex $ quartus_pfg -c ghrd_a5ed065bb32ae6sr0.sof ghrd.rbf -o hps=1 -o hps_path=bl2.hex
The quartus_pfg command converts the .sof file into two .rbf files: the core and the hps files. Use the core file to configure the FPGA fabric, while the hps file to configure the HPS IO.
- Use the -o hps_path argument to guide the tool to the location of the FSBL and embed it with the ghrd.hps.rbf file. Ashling* RiscFree* IDE for Altera® FPGAs debugger tool loads the bl31.bin file to the board. To run the application on board, program the device with the following generated .rbf bitstream:
quartus_pgm -c 1 -m jtag -o "p;ghrd.hps.rbf"
Figure 24. BL2 Boot on HPS Terminal (Debugger Flow) - Next, open Ashling* RiscFree* IDE for Altera® FPGAs tool, set your workspace directory, and copy the required binary files generated earlier: bl31.bin, zephyr.bin, and zephyr.elf (if debug is needed). From Run menu, go to Debug Configuration.
Figure 25. Ashling* RiscFree* IDE for Altera® FPGAs Menus
- Select Ashling Heterogeneous Multicore Hardware Debugging, then configure the ARM Coresight SOC core 0.
Figure 26. Heterogeneous Multicore Hardware Debugging Configuration 1
- Go to Target Application tab:
- Add the .elf file if you need the debug information. Otherwise, you can run the application only.
- Keep Load image unchecked (because you need to load it later manually).
- Check Load symbols (if the .elf file is loaded for debugging).
- In Startup tab, keep everything to default. In OS Awareness tab, turn on Enable OS Aware Debugging and select Zephyr OS if you want to debug your application. You can ignore this step if you want to run the application only without debugging. Once done, click Apply > Debug. Your system should be ready to receive the binary files via Debugger Console.
Figure 27. Heterogeneous Multicore Hardware Debugging Configuration 3Figure 28. Ashling RiscFree Debugger ConsoleThe commands required in Debugger Console:
The needed commands in Debugger Console can be seen below: set debug remote 1 restore <Absoulte_Path_to_your_Workspace>/bl31_801.bin binary 0x80000000 restore <Absoulte_Path_to_your_Workspace>/zephyr.bin binary 0x80100000 set $x1=0 The set debug remote 1 command is used to enable message transaction acknowledgement from the board to indicate the download completion of a binary file. A sample screenshot can be seen below.
Use the set debug remote 1 command to enable message transaction acknowledgement from the board to indicate the download completion of a binary file. Refer to the following example.Figure 29. Ashling RiscFree Debugger Console Output - Use the restore command to load the binary file to its destination memory. In this example, the SSBL and Zephyr applications are loaded into HPS DDR memory. Make sure to use the same addresses in the commands above. Refer to the following sample screenshots of the application execution from the HPS UART terminal.
Figure 30. Example Print Logs Part 1 - Setting up Zephyr and TinyMLFigure 31. Example Print Logs Part 1 - Setting up Zephyr and TinyMLFigure 32. Example Print Logs Part 3 - Classifying ImageFigure 33. Example Print Logs Part 4 - Profiling TinyML model