Nios® II Software Developer Handbook

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

5.8.1. Top Level Tcl Script for BSP Defaults

The top level Tcl script for setting BSP defaults is bsp-set-defaults.tcl. This script specifies BSP system-dependent settings, which depend on the hardware system. The nios2-bsp-create-settings and nios2-bsp-update-settings utilities do not call the default Tcl script when creating or updating a BSP settings file. The --script option must be used to specify bsp-set-defaults.tcl explicitly. Both the Nios® II SBT for Eclipse and the nios2-bsp script call the default Tcl script by invoking either nios2-bsp-create-settings or nios2-bsp-update-settings with the --script <full path to the script>/bsp-set-defaults.tcl option.
Note: If you are creating a custom script that uses bsp-set-defaults.tcl, ensure that proper argv0 with full path is set before sourcing it.

The default Tcl script consists of a top-level Tcl script named bsp-set-defaults.tcl plus the helper Tcl scripts listed in the Default Tcl Script Components table. The helper Tcl scripts do the real work of examining the .sopcinfo file and choosing appropriate defaults.

The bsp-set-defaults.tcl script sets the following defaults:

  • stdio character device (bsp-stdio-utils.tcl)
  • System timer device (bsp-timer-utils.tcl)
  • Default linker memory regions (bsp-linker-utils.tcl)
  • Default linker sections mapping (bsp-linker-utils.tcl)
  • Default boot loader settings (bsp-bootloader-utils.tcl)

You run the default Tcl script on the nios2-bsp-create-settings, nios2-bsp-query-settings, or nios2-bsp-update-settings command line, by using the --script argument. It has the following usage:

bsp-set-defaults.tcl [<argument name> <argument value>]*

All arguments are optional. If present, each argument must be in the form of a name and argument value, separated by white space. All argument values are strings. For any argument not specified, the corresponding helper script chooses a suitable default value. In every case, if the argument value is DONT_CHANGE, the default Tcl scripts leave the setting unchanged. The DONT_CHANGE value allows fine-grained control of what settings the default Tcl script changes and is useful when updating an existing BSP.

Table 23.  Default Tcl Script Command-Line Options
Argument Name Argument Value
default_stdio Slave descriptor of default stdio device (stdin, stdout, stderr). Set to none if no stdio device desired.
default_sys_timer Slave descriptor of default system timer device. Set to none if no system timer device desired.
default_memory_regions Controls generation of memory regions By default, bsp-linker-utils.tcl removes and regenerates all current memory regions. Use the DONT_CHANGE keyword to suppress this behavior.
default_sections_mapping Slave descriptor of the memory device to which the default sections are mapped. This argument has no effect if default_memory_regions == DONT_CHANGE.
enable_bootloader Boolean: 1 if a boot loader is present; 0 otherwise.