Nios® II Software Developer Handbook

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

5.4.2.3.1. Creating a Linker Section for an Existing Region

To create your own section named special_section that is mapped to the linker region named onchip_special, use the following command to run nios2-bsp:

nios2-bsp hal my_bsp --cmd add_section_mapping special_section onchip_special

When the nios2-bsp-generate-files utility (called by nios2-bsp) generates the linker script linker.x, the linker script has a new section mapping. The order of section mappings in the linker script is determined by the order in which the add_section_mapping command creates the sections. If you use nios2-bsp, the default Tcl script runs before the --cmd option that creates the special_section section.

If you run nios2-bsp again to update your BSP, you do not need to provide the add_section_mapping command again because the default Tcl script only modifies section mappings for the default sections listed in the Nios® II Default Section Names table.