5.7.2. Adding prelink and postlink commands

Prelink and postlink makefile commands are run only when the linker is run. Prelink commands can be used to copy libraries or objects from other developers so that you do not have to build them yourself. Postlink commands might be used to convert the executable file into another format, for example to load to Flash or for loading by a specific operating system.

To add prelink and postlink commands to the build:

  1. Select Project → Project Properties... to display the Project Properties window.

  2. Right-click on the *BUILD group in the List of Entries pane, the left pane, and select Expand whole Tree from the context menu.

  3. Select the Pre_Post_Link group in the List of Entries pane.

  4. Right-click on the Pre_link setting in the Settings Values pane, the right pane, and select Edit Value from the context menu.

  5. Type @+echo This is before linkage and then press Enter to confirm the value.

    This string is output every time you build or rebuild, the application, but the command is not displayed when it is executed.

  6. Right-click on the Post_link setting in the Settings Values pane, and select Edit Value from the context menu.

  7. Type +copy $(PROGRAM) $\temp.axf and then press Enter to confirm the value.

    Type this exactly as shown. Your window looks like Figure 5.7.

    Figure 5.7. Linker options in the Project Properties window

    Linker options in the Project Properties window

    This postlink command copies the output from the build, that is dhrystone.axf, to another location. In this example, you are sending the executable file temp.axf to the current working directory, but it might be a predefined central location for images to be debugged.

    The copy command is displayed in the Build tab when executed.

  8. Select File → Save and Close to regenerate the makefile(s) for the project, and close the Project Properties window.

  9. Select Tools → Build... to rebuild the application.

  10. Click on the Build tab, if necessary, to see the linker output, shown in Figure 5.8.

    Figure 5.8. Linker output in the Output pane

    Linker output in the Output pane

Note

Makefile commands can include operating system commands.

Copyright © 2005, 2006 ARM Limited. All rights reserved.ARM DUI 0291C
Non-Confidential