The project file (.stp) contains the information that you need to build an application with a specific toolset and for a specific microcontroller. It contains the source files needed to build the application, the build configuration and the target MCU’s memory map. This section provides information about:
● Loading an existing project ● Creating new projects
● Adding and removing folders and files
Note: Until you create a project or add an existing one to your workspace, you do not have access to STVD’s build and debug commands.
4.3.1
Loading an existing project
To load an existing project:
1. Select File > Insert Project into Workspace. The Insert Project browse window will open.
2. Locate the project file (.stp), highlight it and then click on Open.
The project will appear in the Workspace window, typically on the left side of STVD’s main window (see Figure 55 on page 77).
STVD will not allow you to insert a project into a workspace if it already contains a project with the same name.
4.3.2
Creating new projects
STVD provides three options for creating a new project in a workspace.
To create a new project, select Project > Add New Project to Workspace. The New Project window opens. From this window you can:
● Add a project (.stp) to your workspace ● Create a project from an existing executable ● Create a project from an existing makefile
Add a project (.stp) to your workspace
Click on the New Project icon and then OK. This launches the New Project wizardas shown in Figure 56.In this window you will enter all of the information required to create the project including:
● A project name in the Project Filename field.
● The path name where you want to store the project and the resulting files in the Project Location field. The path for the workspace is used by default.
● The toolset to use when building and the path for the toolset.
Figure 56. Project parameters
When you click on OK, the project (filename.stp) is added to the workspace in the STVD Workspace window. By default, the project contains folders called Source Files, Include Files and External Dependencies. These folders are used to organize your project within STVD. They do not exist in the working directory. Other files may be added to the project folders automatically based on your toolset’s default settings. STVD will change these according to your project build settings and your application.
Figure 57. Default project contents
When you save your workspace, the working directory is updated with the project file and two folders: Debug and Release. These folders are the default locations for storing your application executable and any intermediate files depending on whether you build using the Debug or Release configuration.
Create a project from an existing executable
To create a project from an executable (.abs, .elf, .hex, .s19): 1. Select the Create from Executable icon and click on OK.
You will receive an information message asking you if you want to create a project to wrap the executable.
2. Click on OK to continue.
The New Project window opens.
3. Here enter a name for the project file (.stp) and the project location.
By default, your project is named executable_filename.stp and its location is the directory of the executable file.
4. Next, select the appropriate microcontroller in the MCU Selection window and click on
OK.
Your project is created and appears in the Workspace window. It contains the default folders and any files specified by the toolset settings. The Project Settings window contains the Debug tab and the MCU Selection tab where you can change the microcontroller selection.
You can now identify your debug instrument and debug the application.
Create a project from an existing makefile
Early versions of STVD used a makefile (.mak) to define the build process for source files and a specified toolset. To support the migration of projects from earlier versions, STVD allows you to create a project around a makefile. In this way you preserve the information and conditions applied when building previous applications. For more information about this process, refer toMigrating old workspaces (STVD7 2.5.4 and prior versions) on page 71. To create your project:
1. Highlight theCreate from Makefile icon and click on OK.
A browse window opens. By default it is set to display .mak makefiles.
2. Highlight the makefile file that you want to use to create your project and click on Open. You will receive an information message, notifying you that STVD is going to wrap the makefile in a new project.
3. Click on OK to continue.
The New Project window opens.
4. Here enter a name for the project file (.stp) and the project location.
By default, your project is named makefile_name.stp and its location is the directory of the makefile.
5. Now, select your toolset from the list box and enter its path. Click on OK.
Your workspace has been created and named makefile_name.stw. The new project file appears in the Workspace window, typically on the left side of STVD’s main window. Your project contains the makefile that you have identified and the External Dependencies folder.
Before you start debugging your application you will have to identify the executable file to debug and you may have to rebuild your application. For more information about this process, refer to Migrating old workspaces (STVD7 2.5.4 and prior versions) on page 71.
4.3.3
Adding and removing folders and files
Projects contain the files that you will use to build your application. These can be organized in folders. By default, projects contain the following folders:
● Source Files — this folder contains the source files (.asm, .c, .s) that you identify for the building of your application.
● Include Files — this folder contains header files required to build your source code. These files are specified by the include statements in your project settings.
● External Dependencies — this folder contains any dependencies specified by the source files or the toolset. The folder’s contents are updated automatically and cannot be modified by the user.
Adding folders
You can create your own folders in your project to create a virtual project structure that will help you organize the links to your source files. Folders can be created in the project or in any folder except the Dependencies folder.
To add folders to your project or in another folder:
1. Right-click on the project or on the folder to get the contextual menu. In the contextual menu, select New Folder.
The New Folder dialog box opens.
2. Enter the name for the folder in the provided field and click on OK. The folder is added to your project.
Adding files
To add source files to the source folder:
1. Right-click on the folder to get the contextual menu. From the menu, select Add Files
to Folder.
A browse window opens.
2. Select the file(s) you want to add to the folder and click on Open.
STVD will not allow you to add a file to a project if the project already contains a file with the same path name. Files with the same name can be added to the same project it they have different paths. A workspace may contain files with the same path name, as long as they are in different projects.
The folder contextual menu also offers the Add Sorted Elements option. When this option is checked, STVD protects the order of the files in the project. Upon build, the command lines for the source files are executed in the same order as the files in the project from the top (first) to the bottom (last). When this option is checked, STVD will not allow you to change the order of the files. If you disable this option, change the order, and then reactivate this option, STVD will maintain the new ordering of the files. This option is important when using the ST Assembler/Linker toolset, which is sensitive to the ordering of source files upon assembly (see Ordering source files before assembly on page 88).