Nios II Classic Software Developer’s Handbook

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

13.2.1. C Macro Namespace

You can use the C macro namespace to publish information about your component that is converted to #define’s in a C or C++ system.h file. C macro assignments are associated with the entire hardware component, not with individual interfaces.

The name of an assignment in the C macro namespace is embeddedsw.CMacro.<assignmentName>. You must format the value as a legal C or C++ expression.

Example 13–2. Assignment Statement for the BAUD_RATE of uart_0 in a Hardware System

# Tcl assignment statement included in the _hw.tcl file
add_parameter BAUD_RATE_PARAM integer 9600 "This is the default baud rate."
# Dynamically reassign the baud rate based on the parameter value
set_module_assignment embeddedsw.CMacro.BAUD_RATE \
[get_parameter_value BAUD_RATE_PARAM]