Embedded Design Handbook

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

4.2.2.4.4. Configuring the Application Project

You configure the application project by specifying source files and a valid BSP project, along with other command-line options to the nios2-app-generate-makefile or nios2-app-update-makefile commands.

Application Configuration Tips

Use the following tips to increase your efficiency in designing your application project:

  1. Source file inclusion—To add source files to your project, drag them from a file browser, such as Windows Explorer, and drop them in the Project Explorer view in the Nios® II Software Build Tools for Eclipse.

    From the command line, several options are available for specifying the source files in your application project. If all your source files are in the same directory, use the --src-dir command-line option. If all your source files are contained in a single directory and its subdirectories, use the --src-rdir command-line option.

  2. Makefile variables—When a new project is created in the Nios® II Software Build Tools for Eclipse, a makefile is automatically generated in the software project directory. You can modify application makefile variables with the Nios II Application Wizard.

    From the command line, set makefile variables with the --set <var> <value> command-line option during configuration of the application project. The variables you can set include the pre- and post-processing settings BUILD_PRE_PROCESS and BUILD_POST_PROCESS to specify commands to be executed before and after building the application. Examine a generated application makefile to ensure you understand the current and default settings.

  3. Creating top level generation script—From the command line, simplify the parameterization of your application project by creating a top level shell script to control the configuration. The create-this-app scripts in the embedded processor design examples available from the All Design Examples web page are good models for your configuration script.

Linking User Libraries

You can create and use your own user libraries in the Nios® II Software Build Tools. The Nios II Software Build Tools for Eclipse includes the Nios® II Library wizard, which enables you to create a user library in a GUI environment.

You can also create user libraries in the Nios® II Command Shell, as follows:

  1. Create the library using the nios2-lib-generate-makefile command. This command generates a public.mk file.
  2. Configure the application project with the new library by running the nios2-app-generate-makefile command with the --use-lib-dir option. The value for the option specifies the path to the library's public.mk file.