Embedded Design Handbook

ID 683689
Date 8/28/2023
Public
Document Table of Contents

5.2.2.3.2. Application

In the Nios® II SBT window, select either:
  • File > New > Nios® II Application to develop a Nios® II application.

    or

  • File > New > Nios® II Application and BSP from Template to create a template to use for the Nios® II application.

BSP Editor Settings

You must edit the BSP editor settings according to the selected Nios® II processor boot options.
  1. In the Nios® II SBT tool, right click on your BSP project in the Project Explorer window. Select Nios® II > BSP Editor... to open the Nios® II BSP Editor.
  2. In Nios® II BSP Editor, expand into Advanced.hal.linker under Settings in Main tab.
  3. Leave all settings unchecked.
    Figure 78. Advanced.hal.linker Settings
  4. Click on the Linker Script tab in the Nios® II BSP Editor.
  5. Set all of the items in the Linker Section Name list to the On-chip Memory (OCRAM) or external RAM.
    Figure 79. Linker Region Settings

HEX File Generation

  1. After creating the Nios® II application, right click on the project in Project Explorer and select Build Project. An *.elf file is created under the project folder.
  2. Again right click on your project and click Make Targets -> Build…, the Make Targets dialog box appears. You can also press shift + F9 to trigger the Make Target dialog box.
  3. Select mem_init_generate.
  4. Click Build to generate the HEX file.
    Figure 80. Selecting mem_init_generate in Make Targets
  5. The “mem_init_generate” macro will create two HEX files; <on_chip_ram.hex> and <on_chip_flash.hex>.
    Note:
    • The mem_init_generate target also generates a Intel® Quartus® Prime IP file (meminit.qip). Intel® Quartus® Prime software will refer to the meminit.qip for the location of the initialization files.
    • All these files can be found under the "<project_folder>/software/<application_name>/mem_init" folder.
  6. Recompile your project in Intel® Quartus® Prime software if you check Initialize memory content option in On-Chip Flash IP. This is to include the software data (.HEX) into the SOF file.