Skip to main content

IAR Embedded Workbench for RISC-V 3.40

Programming hints

In this section:

Accessing special function registers

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

The header files are intended to be used also with the IAR C/C++ Compiler for RISC-V, and they are suitable to use as templates when creating new header files for other RISC-V derivatives.

If any assembler-specific additions are needed in the header file, you can easily add these in the assembler-specific part of the file:

#ifdef __IAR_SYSTEMS_ASM__
  ; Add your assembler-specific defines here.
#endif

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.