Specifications

Related Information
Nios II Software Build Tools Reference on page 15-1
Setting Description
The description argument of add_sw_setting contains a brief description of the setting. The
description argument is required. Place quotation marks ("") around the text of the description. The
description text appears in the generated BSP summary.html document.
Setting Creation Example
#include "system.h"
#ifdef MY_CUSTOM_DRIVER_SMALL
int send_data( <args> )
{
// Small implementation
}
#else
int send_data( <args> )
{
// fast implementation
}
#endif
Note:
This example implements a setting for a driver that has two variants of a function, one
implementing a small driver (minimal code footprint) and the other a fast driver (efficient
execution).
A simple Boolean definition setting is added to your driver Tcl file. This feature allows BSP users to
control your driver through the BSP settings interface. When users set the setting to true or 1, the BSP
defines MY_CUSTOM_DRIVER_SMALL in either system.h or the BSP public.mk file. When the user compiles the
BSP, your driver is compiled with the appropriate routine incorporated in the object file. When a user
disables the setting, MY_CUSTOM_DRIVER_SMALL is not defined.
You add the MY_CUSTOM_DRIVER_SMALL setting to your driver as follows using the add_sw_setting Tcl
command:
add_sw_setting boolean_define_only system_h_define small_driver
MY_CUSTOM_DRIVER_SMALL false
"Enable the small implementation of the driver for my_peripheral"
Note:
Each Tcl command must reside on a single line of the Tcl file. This example is wrapped due to
space constraints.
Each argument has several variants.
For more information about detailed usage and restrictions, refer to the "Nios II Software Build Tools
Reference" chapter.
Related Information
Nios II Software Build Tools Reference on page 15-1
NII5V2
2015.05.14
Setting Description
7-27
Developing Device Drivers for the Hardware Abstraction Layer
Altera Corporation
Send Feedback