Nios® II Software Developer Handbook

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

8.8.5.2.5. Specifying Source Files

Using the Tcl command interface, you must specify each source file in your driver or software package that you want in the generated BSP. The commands discussed in this section add driver source files and specify their location in the file system and generated BSP.

The add_sw_property command’s c_source and asm_source arguments add a single .c or Nios® II assembly language source file (.s or .S) to your driver or software package. You must express path information to the source relative to the driver root (the location of the Tcl file). add_sw_property copies source files to BSPs that incorporate the driver, using the path information specified, and adds them to source file list in the generated BSP makefile. When you build the BSP using make, the driver source files are compiled as follows:

add_sw_property c_source HAL/src/my_driver.c

The add_sw_property command’s include_source argument adds a single header file in the path specified to the driver. The paths are relative to the driver root. add_sw_property copies header files to the BSP during generation, using the path information specified at generation time. It does not include header files in the makefile.

add_sw_property include_source inc/my_custom_component_regs.h
add_sw_property include_source HAL/inc/my_custom_component.h