3.3.5. Compiling the testcode

Before you compile the software code, you might want to change some of the settings for the software compilation. Each software test has a corresponding subdirectory in the fpga_testbench/fpga/testcodes folder. Inside each of these directories is a makefile for software compilation. The makefiles support ARM DS-5. Table 3.2 lists the settings contained in the makefiles.

Table 3.2. Makefile settings

TESTNAMEName of the software test. This must match the directory name.

Normal C runtime library. This is the default value.


MicroLIB, a C runtime library optimized for microcontroller applications.

USER_DEFINEA user defined C preprocessing macros. Set to -DCORTEX_M0 for most test codes. This enables a piece of test code to include the correct header for the processor when multiplex example systems share the test code. You can add additional preprocessing macros for your applications.
SOFTWARE_DIRShared software directory
CMSIS_DIRBase location of all CMSIS source code.
DEVICE_DIRDevice specific support files, for example, header files, and device driver files.
STARTUP_DIRStartup code location.
ARM_CC_OPTIONSARM C Compiler options.
ARM_ASM_OPTIONSARM Assembler options.

Use makefiles to compile your software. You can use one of the following makefiles:

The makefile in testcodes/<testname>

Execute the following:

make all

This starts the software compilation process.

You can override the variable in the makefile, for example, by executing the following:


This causes the program to compile using DS-5 with the MicroLIB option enabled.

make clean

This cleans all intermediate files created during the compilation process invoked by make all. If changes are made in code other than the testcode itself, for example, in the CMSIS header files, running make clean ensures that these changes are detected by a subsequent make all.

The makefile in rtl_sim, software compilation only

For example, in fpga_testbench/fpga/rtl_sim/, you can execute:

make code

The makefile in the rtl_sim directory changes the current directory to the one specified by the TESTNAME variable. By default there is no TESTNAME specified in the makefile. If make code is executed without specifying a TESTNAME on the make command line or by editing the makefile, a message is printed requesting a TESTNAME to be specified.

You can use the command line to specify the software test that you want to run by executing the following:

make code TESTNAME=designtest_m0

This causes the designtest_m0 test code to compile. The process then copies the compiled code images to the rtl_sim directory.


Use the make code option to debug compilation errors because this option does not invoke simulation.

Copyright © 2015-2016 ARM. All rights reserved.ARM DUI 0934B