Nios II Classic Software Developer’s Handbook

ID 683282
Date 5/14/2015
Public
Document Table of Contents

4.4.2.5. Changing a Linker Section Mapping

If some of the default section mappings created by the default Tcl script do not meet your needs, you can use a Tcl command to override the section mappings selectively. To map the .stack and .heap sections into a memory region named ram0, use the following command:
nios2-bsp hal my_bsp --cmd add_section_mapping .stack ram0 \

 --cmd add_section_mapping .heap ram0

The other section mappings (for example, .text) are still mapped to the default linker memory region.

If you run nios2-bsp again to update your BSP, the default Tcl script overrides your section mappings for .stack and .heap because they are default sections. To prevent your section mappings from being changed, provide nios2-bsp with the original add_section_mapping command-line options or pass the --default_sections_mapping DONT_CHANGE command line to nios2-bsp.

Intel FPGA recommends using the --cmd add_section_mapping approach when updating your BSP because it allows the default Tcl script to update the default sections mapping if memories are added, removed, renamed, or resized.