17.02.2015 Views

CCS C Compiler Manual PCB / PCM / PCH

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

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

Control #BIT #FILL_ROM #TYPE<br />

#USE DYNAMIC_MEMORY #LOCATE #ZERO_RAM<br />

#LINE #ORG #WORD<br />

#RESERVE<br />

#BYTE<br />

<strong>Compiler</strong><br />

Control<br />

#CASE #IMPORT #PRIORITY<br />

#EXPORT #OPT #OCS<br />

#IGNORE_WARNINGS #MODULE a<br />

Linker #IMPORT #EXPORT #BUILD<br />

__address__<br />

A predefined symbol __address__ may be used to indicate a<br />

type that must hold a program memory address.<br />

For example:<br />

___address__ testa = 0x1000 //will allocate 16 bits for test a<br />

and<br />

//initialize to 0x1000<br />

_attribute_x<br />

Syntax:<br />

Elements:<br />

__attribute__x<br />

x is the attribute you want to apply. Valid values for x are as follows:<br />

((packed))<br />

By default each element in a struct or union are padded to be evenly<br />

spaced by the size of 'int'. This is to prevent an address fault when<br />

accessing an element of struct. See the following example:<br />

struct<br />

{<br />

int8 a;<br />

int16 b;<br />

} test;<br />

On architectures where 'int' is 16bit (such as dsPIC or PIC24<br />

PICmicrocontrollers), 'test' would take 4 bytes even though it is<br />

comprised of3 bytes. By applying the 'packed' attribute to this struct<br />

then it would take 3 bytes as originally intended:<br />

struct __attribute__((packed))<br />

84

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

Saved successfully!

Ooh no, something went wrong!