29.10.2014 Views

ARM Compiler toolchain v4.1 for µVision Using the Compiler

ARM Compiler toolchain v4.1 for µVision Using the Compiler

ARM Compiler toolchain v4.1 for µVision Using the Compiler

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>Compiler</strong> Coding Practices<br />

5.4 Selecting <strong>the</strong> target CPU at compile time<br />

Each new version of <strong>the</strong> <strong>ARM</strong> architecture typically supports extra instructions, extra modes of<br />

operation, pipeline differences, and register renaming. You can often significantly improve <strong>the</strong><br />

per<strong>for</strong>mance of your C or C++ code by selecting <strong>the</strong> appropriate target processor at compile<br />

time.<br />

To specify a target processor at compile time:<br />

1. Decide whe<strong>the</strong>r <strong>the</strong> compiled program is to run on a specific <strong>ARM</strong> architecture-based<br />

processor or on different <strong>ARM</strong> processors.<br />

2. Obtain <strong>the</strong> name, or names, of <strong>the</strong> target processors recognized by <strong>the</strong> compiler using <strong>the</strong><br />

following compiler command-line option:<br />

--cpu=list<br />

3. If <strong>the</strong> compiled program is to run on a specific <strong>ARM</strong> architecture-based processor, having<br />

obtained <strong>the</strong> name of <strong>the</strong> processor with <strong>the</strong> --cpu=list option, select <strong>the</strong> target processor<br />

using <strong>the</strong> --cpu=name compiler command-line option. For example, to compile code to run<br />

on a Cortex-M3 processor:<br />

armcc --cpu=Cortex-M3 myprog.c<br />

Selecting <strong>the</strong> target processor using <strong>the</strong> --cpu=name command-line option enables <strong>the</strong> compiler<br />

to make full use of instructions that are supported by <strong>the</strong> processor, and also to per<strong>for</strong>m<br />

processor-specific optimizations such as instruction scheduling.<br />

--cpu=list lists all <strong>the</strong> processors supported by <strong>the</strong> compiler.<br />

5.4.1 See also<br />

Reference<br />

<strong>Compiler</strong> Reference:<br />

• --cpu=list on page 3-20<br />

• --cpu=name on page 3-20.<br />

<strong>ARM</strong> DUI 0375C Copyright © 2007-2008, 2011 <strong>ARM</strong>. All rights reserved. 5-8<br />

ID061811<br />

Non-Confidential

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!