Skip to main content

IAR Embedded Workbench for Arm 9.70.x

Programming hints

In this section:

Accessing special function registers

Specific header files for several Arm devices are included in the IAR product package, in the arm\inc directory. These header files define the processor-specific special function registers (SFRs) and in some cases the interrupt vector numbers.

Example

The UART read address 0x40050000 of the device is defined in the ionuc100.h file as:

__IO_REG32_BIT(UA0_RBR,0x40050000,__READ_WRITE ,__uart_rbr_bits)

The declaration is converted by macros defined in the file io_macros.h to:

UA0_RBR DEFINE 0x40050000

Using C-style preprocessor directives

The C-style preprocessor directives are processed before other assembler directives. Therefore, do not use preprocessor directives in macros, and do not mix them with assembler-style comments. For more information about comments, see Assembler control directives.

C-style preprocessor directives like #define are valid in the remainder of the source code file, while assembler directives like EQU only are valid in the current module.