Embedded Design Handbook

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

5.3.5.2.2. Adding On-chip Boot ROM to the System

To add on-chip boot ROM to the system:
  1. On the Tools menu, click Platform Designer to start Platform Designer and then select eth_std_main_system.qsys. Click Open when prompted to open the Platform Designer design file.
  2. In Platform Designer, on the System Contents tab, expand Memories and Memory Controllers, expand On-Chip, and select On-Chip Memory (RAM or ROM).
  3. Click Add to add the component to the system. Use the following settings in specifying the memory:
    • Memory Type: RAM (Writable) (not ROM (Read-only))
    • Data width: 32 bits
    • Total memory size: 16384 bytes
    The specified peripheral size ensures that it can hold the entire code image for the largest version of the example boot copier. This image includes the following code:
    • Resetcode in the .entry section
    • The crt0.s startup code
    • The .text section containing the alt_main entry point
    • The .rodata section holding any initialized read only data
    • The .rwdata section holding any initialized read/write data
    • The .bss section holding initialized and static variables
    • The exception handler located in the .exception section

    Some of these sections are copied to the exception RAM—the RAM that contains the exception vectors—when the crt0.s startup code executes, but all of the sections are stored initially in this on-chip memory.

  4. In the Platform Designer connection matrix, ensure that the slave port of the on-chip memory is connected to the Nios® II instruction master and to the Nios® II data master, and that the reset port of the on-chip memory is connected to the reset output clock source.
  5. If Platform Designer reports an error in the bottom window caused by the address of the new on-chip memory overlapping another peripheral, select a suitable base address for the on-chip memory that does not overlap anything else.
  6. Modify the clock entry for the new on-chip memory to ensure that this memory is clocked by the same clock as the cpu component.
  7. Right-click the new On-Chip Memory component, and click Rename. Rename the component with a descriptive name such as boot_rom.
  8. To enable running the boot copier from on-chip memory, right-click the cpu component in your system and click Edit.
  9. In the Nios® II Processor settings window, set the Reset Vector Memory to boot_rom.s1 with an Offset of 0x00000000.
  10. Click Finish to exit the Nios® II Processor settings window.
  11. Click Generate to generate the Platform Designer system.