Specifications

If you run nios2-bsp again to update your BSP, the default Tcl script overrides your default sections
mapping. To prevent your default sections mapping from being changed, provide nios2-bsp with the
original --default_sections_mapping command-line option or pass it the DONT_CHANGE value for the
memory name instead of onchip_ram.
Related Information
Creating a Custom Linker Section on page 4-12
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 ram0r
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.
Altera 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.
Other BSP Tasks
This section covers some other common situations in which the SBT is useful.
Creating a BSP for an Altera Development Board
In some situations, you need to create a BSP separate from any application. Creating a BSP is similar to
creating an application. To create a BSP, perform the following steps:
1. Start the Nios II Command Shell.
For details about the Nios II Command Shell, refer to the Getting Started from the Command Line
chapter of the Nios II Software Developer’s Handbook.
2. Create a working directory for your hardware and software projects. The following steps refer to this
directory as <projects>.
3. Make <projects> the current working directory.
4. Find a Nios II hardware example corresponding to your Altera development board. For example, if
you have a Stratix
®
IV development board, you might select <Nios II EDS install path>/examples/
verilog/niosII_stratixIV_4sgx230/triple_speed_ethernet_design.
5. Copy the hardware example to your working directory, using a command such as the following:
cp -R /altera/100/nios2eds/examples/verilog\
/niosII_stratixIV_4sgx230/triple_speed_ethernet_design .r
6. Ensure that the working directory and all subdirectories are writable by typing the following
command:
NII5V2
2015.05.14
Changing a Linker Section Mapping
4-15
Nios II Software Build Tools
Altera Corporation
Send Feedback