| |||
Home > Angel > Porting Angel to new hardware > Modifying an APM project |
If you are using the ARM project manager on a Windows system, you must change the project file when you copy an Angel template directory. If you are using UNIX, refer to Editing makefile build options.
The build directory is separate from the target source code
directory. In the supplied examples it has the same name as the
target code directory with a .b
extension. The APM
projects are located in a subdirectory of the build directory. For
example, the PID project is located in c:ARM250\Angel\Source\pid.b\Apm
The simplest way to use the PID Angel port as a template is to copy the entire Angel directory structure to a working directory. If you want to change the names of the directories to reflect the name of your board, you must modify the APM project file so that it uses your directories, compiles and assembles your source, and links your object files. This is described in Editing the APM project directory structure.
In addition to setting up the project file for your new directory structure, you must set a number of build options. The options include:
Thumb support
Angel data area and execution addresses.
If you are using APM and have purchased the Angel Ethernet Kit, separate project files are supplied to enable you to build Angel ROM Images with or without the Ethernet drivers. Endianness is defined by the selected endianness of the APM environment.
When you have selected the Angel port that you want to base your own port on, you must copy the required directories and files. The following instructions assume that you are basing your port on the Angel PID port. Follow these steps to copy the Angel template:
Copy the entire Angel directory and all subdirectories
to your working directory. It is recommended that you do not work
in the installation Angel directory, by default c:ARM250\Angel
,
because this may cause problems if you reinstall the Software Development
Toolkit.
In your working copy of the Angel directory, select Edit variables for AngelPid.apj from the Project menu. The Edit Variable dialog is displayed (Figure 13.6).
Change the $$ProjectName
variable
to the name of your port. The value given here is used by APM to
name the build output binaries.
Angel requires two files from the SDT installation C library directory:
c:ARM250\Cl\h_la_obj.s
c:ARM250\Cl\objmacs.s
Copy these files to your working Angel source directory.
This step is optional. You can rename the appropriate
source and build directories for your own port. For example, you
can rename
and working_directory
\Angel\Sources\pid
as
appropriate for your board. You may need to do this if you have
more than one project based on the PID port. working_directory
\Angel\Sources\pid.b
If you rename the pid
and pid.b
directories,
you must make additional changes to the project so that it will
find the appropriate source files. Refer to Editing the APM project directory
structure for detailed
instructions.
If you have not renamed the directories, you can perform a trial build.
If you renamed the pid
and pid.b
directories
when you copied the Angel directory you must ensure that the new
directory paths are used to compile, assemble, and link your sources.
Follow these steps to configure the project template:
Open the APM project file for your project.
Select Edit Project Template… from the Project menu. The Project Template Editor dialog is displayed (Figure 13.7).
Select Assemble from the list of build step patterns and click on the Edit… button. The Edit Build Step Pattern dialog is displayed (Figure 13.8).
The Command Lines section of the dialog contains the command-line for the assembler. The last part of the command line is:
{path|<path|-I><path>} <path><slash><file>.s
Change this to:
{path2|<path|-I><path>} <path><slash><file>.s
by adding the number 2 to the first path
.
Click the Apply button and then click OK.
Repeat steps 3 and 4 for the build step patterns Assemble for ROM and Compile.
Select MakeLo from the list of build step patterns and click on the Edit… button. The Edit Build Step Pattern dialog is displayed (Figure 13.9).
Change the Included Files and Command Lines sections
of the dialog to reflect the new directory structure. For example,
if you have copied the complete Angel directory structure and renamed
the pid
and pid.b
directories,
change pid
to your new directory name.
When you have finished editing the build steps, click Close to exit the Build Step dialog box.
Select Project ? Tool Configuration ? <cc> = armcc ? Set. The Compiler Configuration dialog is displayed (Figure 13.10).
Click on the Include Files tab and edit the list of include file directories to reflect the new directory structure. Click OK to apply the changes.
Repeat steps 10 and 11 using the <asm> = tasm submenu to configure the assembler.
Remove and re-add all target-specific source files
to the project. These are the files that are located in the renamed pid
directory,
such as devices.c
and makelo.c
(see Figure 13.11). In general
you will have to replace these files with your own code when porting
Angel.
Select a file and press the delete key to remove it. Select Add files from the Project menu to re-add the file to the Sources partition.
In addition, you must replace makelo.c
in
the Host Sources partition.
The directory header in the APM window can be edited using the Edit Details button. This is not required to build Angel.
The build variables for the APM project are the same as those defined in the UNIX makefile. They are defined in either the project variables, or as preprocessor definitions in the compiler configuration dialog. Refer to Editing makefile build options for a description of the build options.