CodeWarrior can manage the entire project or just a part of it. The integrated Build Tools can also be used along with CodeWarrior.
• “Application Programs (Build Tools)” on page 58
You can use any or all of the standalone tools of the Build Tools that are included with the CodeWarrior installation. You can also employ CodeWarrior.
Using CodeWarrior to create a project
CodeWarrior has a Wizard to easily configure and manage a project. You can get your project up and running by following a short series of steps to configure the project and to generate the basic files which are located in the project directory. You do not have to use the CodeWarrior IDE in order to use the standalone Build Tools (Compiler, Assembler, Linker, Burner, Simulator, etc.).
See “Application Programs (Build Tools)” on page 58 for information on using the standalone Compiler. Information on the other Build Tools can be found in user guides included with the CodeWarrior suite.
The following Wizard section will create and configure a basic CodeWarrior project that uses C source code. You can use the CodeWarrior interface to coordinate the integrated Build Tools.
Wizard
This section creates a simple, bare-bones project using C source code. One of the means to create projects in CodeWarrior is the Wizard. Using the Wizard, a project only requires a few minutes to get up and running.
Start the HC08 CodeWarrior application. If CodeWarrior is opening from the Windows Start menu, the Startup dialog box appears inside the main window in CodeWarrior (Figure 1.1).
Figure 1.1 Startup dialog box
Press the Create New Project button. The HC(S)08 New Project dialog box appears showing the Project Parameters panel of the Wizard Map. If CodeWarrior is already running, select New Project... from the File menu (File > New Project...) instead. See Figure 1.2.
Figure 1.2 HC(S)08 New Project dialog box
Enter the Project Parameters for your project: Type the name for the project in the Project name: text box. In the event that you want a different location for the project directory than the default in the Location: text box, press Set and browse to the new location. There is no need to first prepare an empty folder, as CodeWarrior automatically creates its own folder - the project directory.
NOTE If you do not use the default Location for the project directory, you need not enter a name in the Project name: text box. Whatever you enter in the File name: text box will be entered into Location automatically.
CodeWarrior uses the default *.mcp extension, so you do not have to explicitly append any extension to the filename.
For the programming language, check C and uncheck both Assembly and C++, in case that is not already set up that way. Press the Save and Next > buttons to close the dialog boxes.
The Device and Connection dialog box of the Wizard Map appears. (Figure 1.3).
Figure 1.3 Device and Connection dialog box
Select the desired CPU derivative for the project. Expand HC08 and G Family. In this case, the MC68HC908GP32 derivative is selected. For Connections, select the default - Full Chip Simulation. Press Next >. The Add Additional Files dialog box appears (Figure 1.4).
Figure 1.4 Add Additional Files dialog box
If you want to add any existing files to your project, you could browse the left pane - Add existing files to the project - for the files and press the Add button. The added files will appear in the right pane - Project Files. No user files are to be added for this project, so you can either uncheck the Copy files to project check box or make sure that no files are selected and leave this check box checked.
Check the Create example code check box. This enables template files including a Sources folder to be created in the project directory with some sample source-code files. Press Next
>. The Processor Expert panel appears (Figure 1.5).
Figure 1.5 Processor Expert panel
The default - None - is selected. For a simple demo project, you do not need the Rapid Application Development (RAD) tool - Project Expert - in the CodeWarrior Development Studio. We are now only interested in creating a bare-bones ANSI-C project. In practice, you would probably routinely use Processor Expert on account of its many advantages.
Press Next >. The C/C++ Options panel appears (Figure 1.6).
Figure 1.6 C/C++ Options panel
The three default selections for this panel are the usual entries for an ANSI-C project:
ANSI startup code, Small memory model, and None for the floating-point numbers format.
The default - ANSI startup code - is used. CodeWarrior automatically generates the startup and initialization routines for the specific derivative and calls the entry point into your ANSI-C project - the main() function. Use the integer-number format whenever possible in your projects, as floating-point numbers impose a severe speed-hit penalty.
Press Finish. CodeWarrior now creates your project (Figure 1.7).
Figure 1.7 Project creation
Using the Wizard, an HC(S)08 project is set up in about a minute or two. You can add additional components to your project afterwards. A number of files and folders are automatically generated in the root folder that was used in the project naming process.
This folder is referred to in this manual as the project directory. The major GUI component for your project is the project window. The CodeWarrior project window appears (Figure 1.8).
Figure 1.8 CodeWarrior project window
The project window contains four “folders,” but in reality they are not necessarily folders but abstract groups of files instead. If you were to examine the project directory that CodeWarrior generated after it created the project, you would see the actual folders and files that were generated for your project, as in Figure 1.9.
You should examine the folders and files that CodeWarrior created in the actual project directory so that you know they are in case you need to know. If you work with standalone tools such as a Compiler, Linker, Simulator/debugger, etc., you may need to specify the paths to these files. So it is best that you know their locations and functions. At this final stage of the Wizard, you could safely close the project and you can reopen it later. A CodeWarrior project reopens in the same configuration it was when it was last saved.
Figure 1.9 Project directory in the Windows Explorer
For this project, the name of the project directory and its path is:
E:\Projects\Test
Inside the project directory is the master file for the project - Test.mcp. This is the file that you could use to open the project. Opening this master project file opens the CodeWarrior project in the same configuration it had when it was last saved.
Return to the CodeWarrior project window (Figure 1.10).
Figure 1.10 Project window showing the files that CodeWarrior created
If you expand all the default groups, you would see two header files, a library file, three C-source files, and three others. Some of them have red check marks in the far-left column in the project window. These red marks will disappear when the project files are assembled, compiled, or linked under the control of the CodeWarrior IDE.
Using CodeWarrior you could compile the three C-source files separately, simultaneously, or in other combinations. You could compile them all simultaneously, but without linking their object code into an executable file. Select Bring Up To Date in the Project menu:
Project > Bring Up To Date (Ctrl+U). Notice that all of the red check marks have disappeared after the files were “brought up to date.”
An alternative means for processing C-source (*.c) files (or *.asm assembly or *.lib library files) that have red check marks is to select one or more of these files in the project window and select Project > Compile. If you were to revisit the project directory with Windows Explorer after compilation, you would see that three object-code files were generated in the ObjectCode folder - one for each *.c C-source file (Figure 1.11).
Figure 1.11 Compilation generates object-code files
The compilation process for the C-source files is essentially complete at this point.
However, compiled, binary object code is not very useful by itself. The object code needs to be further processed by a Linker in order to make it meaningful. This processing will be discussed later in this chapter ().