1. About the Nios® V Embedded Processor
2. Nios® V Processor Hardware System Design with Quartus® Prime Software and Platform Designer
3. Nios® V Processor Software System Design
4. Nios® V Processor Configuration and Booting Solutions
5. Nios® V Processor - Using the MicroC/TCP-IP Stack
6. Nios® V Processor Debugging, Verifying, and Simulating
7. Nios® V Processor — Remote System Update
8. Nios® V Processor — Using Custom Instruction
9. Nios® V Embedded Processor Design Handbook Archives
10. Document Revision History for the Nios® V Embedded Processor Design Handbook
2.1. Creating Nios® V Processor System Design with Platform Designer
2.2. Integrating Platform Designer System into the Quartus® Prime Project
2.3. Designing a Nios® V Processor Memory System
2.4. Clocks and Resets Best Practices
2.5. Assigning a Default Agent
2.6. Assigning a UART Agent for Printing
2.7. JTAG Signals
2.8. Optimizing Platform Designer System Performance
4.1. Introduction
4.2. Linking Applications
4.3. Nios® V Processor Booting Methods
4.4. Introduction to Nios® V Processor Booting Methods
4.5. Nios® V Processor Booting from On-Chip Flash (UFM)
4.6. Nios® V Processor Booting from General Purpose QSPI Flash
4.7. Nios® V Processor Booting from Configuration QSPI Flash
4.8. Nios® V Processor Booting from On-Chip Memory (OCRAM)
4.9. Nios® V Processor Booting from Tightly Coupled Memory (TCM)
4.10. Summary of Nios® V Processor Vector Configuration and BSP Settings
4.11. Reducing Nios® V Processor Booting Time
4.6.1.1. Hardware Design Flow
4.6.1.2. Software Design Flow
Creating the BSP Project Application
Configuring BSP Editor and Generating the BSP Project
Generating the User Application Project File
Building the Application Project
Generating HEX File
4.6.1.3. Programming Files Generation
4.6.1.4. QSPI Flash Programming
6.2.3.2.1. Enabling Signal Tap Logic Analyzer
6.2.3.2.2. Adding Signals for Monitoring and Debugging
6.2.3.2.3. Specifying Trigger Conditions
6.2.3.2.4. Assigning the Acquisition Clock, Sample Depth, and Memory Type, and Buffer Acquisition Mode
6.2.3.2.5. Compiling the Design and Programming the Target Device
6.6.1. Prerequisites
6.6.2. Setting Up and Generating Your Simulation Environment in Platform Designer
6.6.3. Creating Nios V Processor Software
6.6.4. Generating Memory Initialization File
6.6.5. Generating System Simulation Files
6.6.6. Running Simulation in the QuestaSim Simulator Using Command Line
4.6.1.2. Software Design Flow
This section provides the design flow to generate and build a Nios® V processor software project. To ensure a streamlined build flow, you are encouraged to create a similar directory tree in your design project. The software design flow is based on this directory tree.
Use the following steps to create the software project directory tree:
- In your design project folder, create a folder called software.
- In the software folder, create two folders called app and bsp.
Figure 74. Software Project Directory Tree
Creating the BSP Project Application
To launch the BSP Editor, perform the following 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.
Figure 75. Configure New BSP
Configuring BSP Editor and Generating the BSP Project
You can define the processor’s exception vector either in On-Chip Memory (OCRAM) or QSPI Flash based on your design preference. Setting the exception vector memory to OCRAM/External RAM is recommended to make the interrupt processing faster.
- Go to Main > Settings > Advanced > hal.linker.
- If you select QSPI Flash as exception vector, follow these steps:
- Turn on the following settings:
- allow_code_at_reset
- enable_alt_load
- enable_alt_load_copy_rodata
- enable_alt_load_copy_rwdata
Figure 76. Advanced.hal.linker SettingsThis setting is available if exception vector memory is set to On-Chip Memory (OCRAM) - Click on the Linker Script tab in the BSP Editor.
- Set .exceptions and .text regions in the Linker Section Name to QSPI Flash.
- Set the rest of the regions in the Linker Section Name list to the On-Chip Memory (OCRAM) or external RAM.
Figure 77. Linker Region Settings (Exception Vector Memory: QSPI Flash) - Turn on the following settings:
- If you select OCRAM/External RAM as exception vector, follow these steps:
- Enable the following settings:
- allow_code_at_reset
- enable_alt_load
- enable_alt_load_copy_rodata
- enable_alt_load_copy_rwdata
- enable_alt_load_copy_exception
Figure 78. Advanced.hal.linker SettingsThis setting is available if exception vector memory is set to On-Chip Memory (OCRAM) or external RAM. - Click on the Linker Script tab in the BSP Editor.
- Set the .text regions in the Linker Section Name to QSPI Flash.
- Set the rest of the regions in the Linker Section Name list to the On-Chip Memory (OCRAM) or external RAM.
Figure 79. Linker Region Settings (Exception Vector Memory: OCRAM) - Enable the following settings:
- Navigate to the BSP Drivers tab.
- Turn off the Generic Serial Flash Interface driver (intel_generic_serial_flash_interface_top).
- Click Generate to generate the BSP project.
Generating the User Application Project File
- Navigate to the software/hal 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/app --bsp-dir=software/bsp \ --srcs=software/hal app/<user application>
Building the Application Project
You can choose to build the application project using the RiscFree* IDE for Altera FPGAs or through the command line interface (CLI).
If you prefer using CLI, you can build the application using the following command:
cmake -G "Unix Makefiles" -B software \ hal_app/build -S software/hal_app
make -C software/hal app/debug
The application (.elf) file is created in software/app/debug folder.
Generating HEX File
You must generate a .hex file from your application .elf file, so you can create a .pof file suitable for programming flash devices.
- Launch the Nios V Command Shell.
- For Nios® V processor application boot from QSPI flash, use the following commands line to convert the ELF to HEX for your application.
elf2flash --input software/hal_app/debug/<Nios V application>.elf \ --output flash.srec --reset <reset offset + base address of GSFI AVL MEM> \ --base <base address of GSFI AVL MEM> \ --end <end address of GSFI AVL MEM>
riscv32-unknown-elf-objcopy --input-target srec --output-target ihex \ flash.srec <Nios V application>.hex