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> Features<br />

4.17 --bitband compiler command-line option<br />

The --bitband command-line option bit-bands all non const global structure objects.<br />

When --bitband is applied to foo.c in Example 4-9, <strong>the</strong> write to value.i is bit-banded. That is,<br />

<strong>the</strong> value 0x00000001 is written to <strong>the</strong> bit-band alias word that value.i maps to in <strong>the</strong> bit-band<br />

region.<br />

Accesses to value.j and value.k are not bit-banded.<br />

Example 4-9 <strong>Using</strong> <strong>the</strong> --bitband command-line option<br />

/* foo.c */<br />

typedef struct {<br />

int i : 1;<br />

int j : 2;<br />

int k : 3;<br />

} BB;<br />

BB value __attribute__((at(0x20000040))); // Placed object<br />

void update_value(void)<br />

{<br />

value.i = 1;<br />

value.j = 0;<br />

}<br />

/* end of foo.c */<br />

armcc supports <strong>the</strong> bit-banding of objects accessed through absolute addresses. When --bitband<br />

is applied to foo.c in Example 4-10, <strong>the</strong> access to rts is bit-banded.<br />

Example 4-10 Bit-banding of objects accessed through absolute addresses<br />

/* foo.c */<br />

typedef struct {<br />

int rts : 1;<br />

int cts : 1;<br />

unsigned int data;<br />

} uart;<br />

#define com2 (*((volatile uart *)0x20002000))<br />

void put_com2(int n)<br />

{<br />

com2.rts = 1;<br />

com2.data = n;<br />

}<br />

/* end of foo.c */<br />

4.17.1 See also<br />

Concepts<br />

• <strong>Compiler</strong> and processor support <strong>for</strong> bit-banding on page 4-21.<br />

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

ID061811<br />

Non-Confidential

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

Saved successfully!

Ooh no, something went wrong!