Embedded Design Handbook

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

4.2.2.5.1. Recommended Development Practice

The safest software development practice for avoiding the software coherency problem is to follow a strict hardware and software project hierarchy, and to use scripts to generate your application and BSP projects.

One best practice is to structure your application hierarchy with parallel application project and BSP project folders. In the recommended directory structure below, a top-level hardware project folder includes the Intel® Quartus® Prime project file, the Platform Designer-generated files, and the software project folder. The software project folder contains a subfolder for the application project and a subfolder for the BSP project. The application project folder contains a create-this-app script, and the BSP project folder contains a create-this-bsp script.

Figure 36. Recommended Directory Structure
Note: bsp_settings.tcl is a Tcl configuration file. For more information about the Tcl configuration file, refer to “Configuring the BSP Project”.

To build your own software project from the command line, create your own create-this-app and create-this-bsp scripts. Intel recommends that you also create clean-this-app and clean-this-bsp scripts. These scripts perform the following tasks:

  • create-this-app—This bash script uses the nios2-app-generate-makefile command to create the application project, using the application software source files for your project. The script verifies that the BSP project is properly configured (a settings.bsp file is present in the BSP project directory), and runs the create-this-bsp script if necessary. The Intel-supplied create-this-app scripts that are included in the embedded design examples on the All Design Examples web page of the Intel website provide good models for this script.
  • clean-this-app—This bash script performs all necessary clean-up tasks for the whole project, including the following:
    • Call the application makefile with the clean-all target.
    • Call the clean-this-bsp shell script.
  • create-this-bsp—This bash script generates the BSP project. The script uses the nios2-bsp command, which can optionally call the configuration script bsp_settings.tcl. The nios2-bsp command references the <system_name> .sopcinfo file located in the hardware project folder. Running this script creates the BSP project, and builds the BSP library file for the system.
  • clean-this-bsp—This bash script calls the clean target in the BSP project makefile and deletes the settings.bsp file.

The complete system generation process, from hardware to BSP and application projects, must be repeated every time a change is made to the system in Platform Designer. Therefore, defining all your settings in your create-this-bsp script is more efficient than using the Nios® II BSP Editor to customize your project. The system generation process follows:

  1. Hardware files generation—Using Platform Designer, write the updated system description to the <system_name> .sopcinfo file.
  2. Regenerate BSP project—Generate the BSP project with the create-this-bsp script.
  3. Regenerate application project—Generate the application project with the create-this-app script. This script typically runs the create-this-bsp script, which builds the BSP project by creating and running the makefile to generate the BSP library file.
  4. Build the system—Build the system software using the application and BSP makefile scripts. The create-this-app script runs make to build both the application project and the BSP library.

To implement this system generation process, Intel recommends that you use the following checklists for handing off responsibility between the hardware and software groups.

Note: This method assumes that the hardware engineering group installs the Nios® II EDS. If so, the hardware and software engineering groups must use the same version of the Nios® II EDS toolchain.

To hand off the project from the hardware group to the software group, perform the following steps:

  1. Hardware project hand-off—The hardware group provides copies of the <system_name> .sopcinfo and <system_name> .sof files. The software group copies these files to the software group’s hardware project folder.
  2. Recreate software project—The software team recreates the software application for the new hardware by running the create-this-app script. This script runs the create-this-bsp script.
  3. Build—The software team runs make in its application project directory to regenerate the software application.

To hand off the project from the software group to the hardware group, perform the following steps:

  1. Clean project directories—The software group runs the clean-this-app script.
  2. Software project folder hand-off—The software group provides the hardware group with the software project folder structure it generated for the latest hardware version. Ideally, the software project folder contains only the application project files and the application project and BSP generation scripts.
  3. Reconfigure software project—The hardware group runs the create-this-app script to reconfigure the group’s application and BSP projects.
  4. Build—The hardware group runs make in the application project directory to regenerate the software application.