Nios® V Processor Software Developer Handbook

ID 743810
Date 2/14/2023
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

11.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.

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]