Specifications

commands set_setting and get_setting to set or get the setting. The value of the setting persists in the
BSP settings file.
To create a setting, you must define each of the following parameters.
type—This parameter formats the setting value during BSP generation. The following supported types
and usage restrictions apply:
boolean_define_only—Defines a macro if the setting’s value is 1 or true. Example: #define
LCD_PRESENT. No macro is defined if the setting’s value is 0 or false. This setting type supports the
system_h_define and public_mk_define destinations, defined below.
boolean—Defines a macro or makefile variable and sets it to 1 (if the value is 1 or true) or 0 (if the
value is 0 or false). Example: #define LCD_PRESENT 1. This type supports all destinations.
character—Defines a macro as a single character with single quotes around the character. Example:
#define DELIMITER ':'. This type supports the system_h_define destination, defined below.
decimal_number—Defines a macro or makefile variable and sets it with an unquoted decimal (integer)
number. Example: #define NUM_COPROCESSORS 3. This type supports all destinations.
double—Defines a macro name and sets it to a value with a decimal point. Example: #define PI
3.1416. This type supports the system_h_define destination, defined below.
float—Defines a macro name and sets it to a value with a decimal point and f character. Example:
#define PI 3.1416f. This type supports the system_h_define destination, defined below.
hex_number—Defines a macro name and sets it to a value with a 0x prepended to the value. Example:
#define LCD_SIZE 0x1000. This type supports the system_h_define destination, defined below.
quoted_string—Quoted strings always have the macro name and setting value added to the destina‐
tion files. In the destination, the setting value is enclosed in quotation marks. Example: #define
DFLT_ERR "General error"
If the setting value contains white space, you must place quotation marks around the value string in
the Tcl script. This type supports the system_h_define destination, defined below.
unquoted_string—Unquoted strings define a macro or makefile variable with setting name and value
in the destination file. In the destination file, the setting value is not enclosed in quotation marks.
Example: #define DFLT_ERROR Error This type supports all destinations.
destination—The destination parameter specifies where add_sw_setting puts the setting in the
generated BSP. add_sw_settings supports the following destinations:
system_h_define—With this destination, add_sw_settings formats settings as #define <setting
name> [<setting value>] macros in the system.h file
public_mk_define—With this destination, add_sw_settings formats settings as -D<setting
name>[=<setting value>] additions to the ALT_CPPFLAGS variable in the BSP public.mk file. public.mk
passes the flag to the C preprocessor for each source file in the BSP, and in applications and libraries
using the BSP.
makefile_variable—With this destination, add_sw_settings formats settings as makefile variable
additions to the BSP makefile. The variable name must be unique in the makefile.
displayName—The name of the setting. Settings exist in a hierarchical namespace. A period separates
levels of the hierarchy. Settings created in your Tcl script are located in the hierarchy under the driver or
software package name you specified in the create_driver or create_sw_package command. Example:
my_driver.my_setting. The Nios II SBT adds the hierarchical prefix to the setting name.
identifier—The name of the macro or makefile variable being defined. In a setting added to the
system.h file at generation time, this parameter corresponds to the text immediately following the #define
statement.
value—The default value associated with the setting. If you do not assign a value to the option, its value is
this default value. Valid initial values are TRUE, 1, FALSE, and 0 for boolean and boolean_define_only
setting types, a single character for the character type, integer numbers for the decimal_number setting
15-102
add_sw_setting
NII5V2
2015.05.14
Altera Corporation
Nios II Software Build Tools Reference
Send Feedback