Next: , Previous: Attributes, Up: Attributes


3.1 chip

Amiga hardware requires some data to be located in ‘chip’ memory.

Typically, if an initialized buffer is required (containing a picture bitmap, for example), a plain, statically initialized buffer is used, and the data is copied into a dynamically allocated ‘MEMF_CHIP’ buffer.

This is not necessary with the ‘chip’ attribute. If this attribute is specified for an initialized, static variable, it will be allocated in ‘chip’ memory automagically by the AmigaOS.

A small example:

     UWORD __attribute__((chip)) bitmap1[] = { ... };
Note: For compatibility with other AmigaOS ‘C’ compilers, a preprocessor symbol ‘__chip’ is available, which expands to __attribute__((chip)) (see Keyword macros).

All the ‘chip’ attribute does is specifying that data should go to a section called ‘.datachip’. Therefore, the standard ‘GCC’ feature __attribute__((section(".datachip"))) can be used instead.

This attribute was first made available in the ‘GCC’ 2.7.2.1, ‘Geek Gadgets’ snapshot ‘970328’.

For proper operation, this attribute requires a special version of the assembler, which generates standard AmigaOS object files. This version is not yet available in ‘Geek Gadgets’ in binary form, since support for this object files format is not yet complete.