A newer version of this document is available. Customers should click here to go to the newest version.
Visible to Intel only — GUID: seu1735049649869
Ixiasoft
Visible to Intel only — GUID: seu1735049649869
Ixiasoft
4.5.3.2. Software Design Flow
To create the software project directory tree, follow these steps:
- In your design project folder, create a folder called software.
- In the software folder, create two folders called hal_app and hal_bsp.
Figure 46. Software Project Directory Tree
Creating the Application BSP Project
To launch the BSP Editor, follow these steps:
- Enter the Nios® V Command Shell.
- Invoke the BSP Editor with niosv-bsp-editor command.
- In the BSP Editor, click File > New BSP to start your BSP project.
- Configure the following settings:
- SOPC Information File name: Provide the SOPCINFO file (.sopcinfo).
- CPU name: Select Nios® V processor.
- Operating system: Select the operating system of the Nios® V processor.
- Version: Leave as default.
- BSP target directory: Select the directory path of the BSP project. You can pre-set it at <Project directory>/software/hal_bsp by enabling Use default locations.
- BSP Settings File name: Type the name of the BSP Settings File.
- Additional Tcl scripts: Provide a BSP Tcl script by enabling Enable Additional Tcl script.
- Click OK.
Configuring the BSP Editor and Generating the BSP Project
- Go to Main > Settings > Advanced > hal.linker
- Leave all settings unchecked.
Figure 48. Advanced.hal.linker Settings
- Click on the Linker Script tab in the BSP Editor.
- Set all regions in the Linker Section Name list to the On-Chip Memory (OCRAM) or external RAM.
Figure 49. Linker Region Settings
- Click Generate BSP to generate the BSP project.
Generating the User Application Project File
- Navigate to the software/hal_app folder and create your application source code,
- Launch the Nios® V Command Shell.
- Execute the command below to generate the application CMakeLists.txt.
niosv-app --app-dir=software/hal_app --bsp-dir=software/hal_bsp \ --srcs=software/hal_app/<user application>
Building the User Application Project
You can choose to build the user application project using Ashling* RiscFree* IDE for Intel® FPGAs or through the command line interface (CLI).
cmake -G "Unix Makefiles" -B software/hal_app/build -S software/hal_app make -C software/hal_app/build
The application (.elf) file is created in software/hal_app/build folder.
Generating the HEX File
You must generate a .hex file from your application .elf file, so you can create a .pof file suitable for programming the devices.
- Launch the Nios® V Command Shell.
- For Nios® V processor application boot from On-Chip Flash, use the following command line to convert the ELF to HEX for your application. This command creates the user application (onchip_flash.hex) file.
- Select the suitable Bootloader via GSFI in the elf2flash command.
elf2flash --boot <Intel Quartus Prime installation directory>/ niosv/components/bootloader/<Bootloader via GSFI> --input software/hal_app/build/<Nios V application>.elf \ --output flash.srec --reset <reset offset + base address of On-Chip Flash> \ --base <base address of On-Chip Flash> \ --end <end address of On-Chip Flash>
riscv32-unknown-elf-objcopy --input-target srec --output-target ihex \ flash.srec <Nios V application>.hex
- Recompile the hardware design if you check Initialize memory content option in On-Chip Flash IP (Method 1). This is to include the software data (.HEX) in the SOF file.