Migrating Projects from Arm Compiler 5 to Arm Compiler 6
The Fireworks project
To show you the steps to migrate your project, this tutorial uses the Fireworks example project built with Arm Compiler 5. This example is included in DS-5. The steps in this tutorial can be easily adapted to work on your individual projects.
We also provide the Fireworks example built with Arm Compiler 6, but for the purposes of this tutorial, we are ignoring it.
Importing the Fireworks project example into the DS-5 Eclipse workspace
Launch Eclipse for DS-5 from the Start Menu.
Select a workspace for your DS-5 projects. The default workspace is fine.
Close the Welcome screen, if it appears.
Select File > Import.... to open the Import Selection dialog.
Expand the DS-5 group and select Examples and Programming Libraries. Click Next.
Expand the Examples group, then expand the Armv7 Bare-Metal group.
Several Armv7-based bare-metal examples are provided, including startup code and simple applications for a variety of Cortex-A, -R and M-family platforms. For this tutorial, select fireworks_A9-FVP_AC5.
Click Finish. The Project Explorer view populates with the project.
You can view the imported example in the Project Explorer view.
Building the Fireworks example
The Fireworks project we just imported is pre-built, that is, the executable is already available in the project. But it is worthwhile rebuilding the project to understand how to start the project build process and to ensure DS-5 is setup correctly.
Depending on your version of DS-5, the imported project may attempt to auto-generate makefiles instead of using the provided one which we will be modifying in this tutorial. To fix this, make sure that “generate makefiles automatically” is unticked and then remove “/Debug” from the end of the “Build directory” path.
You can find these settings by right clicking on the imported example project, then Properties > C/C++ Build.
This will allow DS-5 to use the provided makefile and the makefile to write into the
obj directory in the project root directory.
To clean the project, right-click the fireworks project and select Clean Project to remove the contents of the
obj directory, if it already exists.
Then, to build the project, you can either:
Right-click the project and select Build Project.
Or, on the main menu, click to start the build process. That is it, you have now built your project!
Running your application
To run the application you just built, you can use the Cortex-A9 FVP models provided with DS-5.
You can use FVP models to run your image when you do not have access to hardware, for example when the design is not yet completed, or where hardware prototype boards are scarce. Your software development can start early with FVPs which reduces the time to market for your product.
The Fireworks project contains
fireworks-AC5-Cortex-A9x1-FVP.launch- Simulates a single-core Cortex-A9 system.
fireworks_AC5-Cortex-A9x4-FVP.launch- Simulates a quad-core Cortex-A9 system.
.launch file instructs DS-5 Debugger what target to
connect to, what files to download, which breakpoints to set, and so forth. Launch files
are created from the Debug Configurations dialog. We provide them with
our examples as an easy method to get you up and running out of the box.
For this tutorial, we are using the single-core configuration.
fireworks_AC5-Cortex-A9x1-FVP.launchand select Debug As > fireworks_AC5-Cortex-A9x1-FVP.
If DS-5 asks if you want to change perspective, click Yes to switch to the Debug perspective.
DS-5 automatically launches the FVP model, downloads the application, sets a breakpoint on the
main()function, loads debug information into DS-5 Debugger, and runs to
main(). You should get a view similar to the following screenshot.
To continue execution, click .
The fireworks display starts up in a separate window.
You have now imported the project, rebuilt it, and then run the application on a FVP model. Now, click to stop the simulation.
Changing the default compiler for the project
Now that we have built and verified that the example project is working, it is time to change the default compiler.
At the top-right corner of DS-5, click to return to the C/C++ Perspective.
Right-click the fireworks project, and select Properties.
Select C/C++ Build to view the C/C++ Build Builder Settings section in the project properties dialog.
In Makefile generation, untick the Generate Makefiles automatically option.
Select C/C++ Build > Tool Chain Editor to view the Tool Chain Editor section in the project properties dialog.
In Current toolchain, select Arm Compiler 6 (DS-5 built-in) from the list of available compilers.
Click Yes in the Confirm toolchain change dialog.
You have now changed the compiler. From now on, DS-5 will use Arm Compiler 6 when rebuilding this project.
Clean and rebuild the project
Changing the compiler means we have to rebuild all the object files from scratch.
Right-click the fireworks project and select Clean Project to remove
the contents of the
The changes are not complete yet, but just to see what happens, we are going to build the project. Right-click the fireworks project and select Build Project. You can view the results of the build in the Console view. The build fails with the error message:
This is because even though we have changed the default compiler for the project to be
Arm Compiler 6, the Eclipse project for Fireworks is a makefile project as
opposed to a managed project), and the
references Arm Compiler 5 (
armcc). As part of switching the compiler, you
need to make some additional changes to the project for it to build correctly with Arm Compiler 6 (
Modifying the makefile
This project uses a
makefile with the actual compiler calls embedded in it.
We need to make changes in the file.
We are going to make changes in two stages:
In the first stage, we are going to specify which compiler to use.
In the second stage, we are going to specify which compiler options to use.
Specifying which compiler to use
In the Project Explorer view, browse the
Fireworksproject and locate the
Double-click the file to open it in the editor.
Change the entry
CC = armccto
CC = armclang.
armccis the name of the Arm Compiler 5 binary. We are replacing this with the name of the Arm Compiler 6 binary, which is
We have not finished making changes, but to see what happens, right-click and rebuild the project. The build fails with the following errors:
This is because the
makefile is attempting to use
command-line options with
armcc use different command-line options. The second set of changes
armcc options into
Specifying which compiler options to use
Locate the below text in the
DEPEND_FLAGS = --depend=$@.d --depend_format=unix_escaped CFLAGS = --cpu=$(CPU) $(DEBUG_FLAGS) --$(CODE_TYPE) -O$(OPT_LEVEL) -O$(OPT_FOR) $(DEFINES) $(INCLUDES) $(DEPEND_FLAGS) --no_depend_system_headers $(SUPPRESS) AFLAGS = --cpu=$(CPU) $(DEBUG_FLAGS) --apcs=/interwork $(DEPEND_FLAGS) $(SUPPRESS)
Replace it with:
DEPEND_CFLAGS = -MF $@.d DEPEND_AFLAGS = --depend=$@.d --depend_format=unix_escaped CFLAGS = --target=arm-arm-none-eabi -m$(CODE_TYPE) $(DEBUG_FLAGS) -O$(OPT_LEVEL) -mcpu=$(CPU) $(DEFINES) $(INCLUDES) $(DEPEND_CFLAGS) -MMD $(SUPPRESS) AFLAGS = --cpu=$(CPU) $(DEBUG_FLAGS) --apcs=/interwork $(DEPEND_AFLAGS) $(SUPPRESS)
None of the assembler options (
linker options (
LFLAGS) need changing since these tools are included in Arm Compiler 6 and are backwards compatible with Arm Compiler 5.
To summarize the changes required in the
|Description||Arm Compiler 5||Arm Compiler 6|
|Change compiler binary name||armcc||armclang|
|Specify the target architecture||None (only AArch32)||--target=arm-arm-none-eabi|
|Generate Thumb code||--thumb||-mthumb|
|Optimize for time||-Otime||None (default)|
|Writes makefile dependency lines to a file during compilation||--depend=$@.d||-MF $@.d|
|Specifies the format of output dependency files||--depend_format=unix_escaped||None (default)|
|Disables the output of system include dependency lines||--no_depend_system_headers||-MMD|
See the Arm Compiler Migration and Compatibility Guide for more information about migrating from older versions of Arm Compiler to Arm Compiler 6.
Modifying your code
Now that you have made the necessary modifications to your
have to make some changes to your code.
Rebuild the project and view the errors and warnings generated in the Console view:
Diagnose and fix the errors and warnings:
The return type of the main function: void is not allowed in standard C. You can fix this by replacing the following line in
__attribute__((noreturn)) void main(void)
__attribute__((noreturn)) int main(void)
function __enable_irq()is supported by Arm Compiler 6 in a compatibility header file. Add
#include <arm_compat.h>to the top of
#pragma importis not supported by Arm Compiler 6 and must be replaced by the assembler directive equivalent. Replace the following line in
Rebuild the project again.
Running the modified application
You have completed all required changes to the project and the executable is ready to be run on the FVP.
Switch to the DS-5 Debug perspective.
In the Debug Control view, either double-click fireworks_AC5-Cortex-A9x1-FVP or right-click and select Connect to target.
You can view the fireworks output running successfully.
Converting assembly code
A further step would be to convert the assembler format used from
GAS format that can be consumed by
built-in assembler. The instructions are the same in both formats, but the assembler
directives, predefined macros and comment characters are different. If you are writing
new assembler in
GAS format, it can be assembled with