iar.h
Go to the documentation of this file.00001
00038 #ifndef ASSEMBLER_IAR_H_INCLUDED
00039 #define ASSEMBLER_IAR_H_INCLUDED
00040
00041 ld_addr MACRO reg, sym
00042 mov reg, LWRD sym
00043 orh reg, HWRD sym
00044 ENDM
00045
00046 call MACRO sym
00047 rcall sym
00048 ENDM
00049
00050 iar_begin_func MACRO name, sect, is_public, is_weak
00051 MODULE name
00052 RSEG CODE:CODE
00053 IF is_weak == 1
00054 PUBWEAK name
00055 ELSEIF is_public
00056 PUBLIC name
00057 ENDIF
00058 name:
00059 ENDM
00060
00061 iar_begin_func_segm MACRO name, sect, is_public, is_weak, segment
00062 MODULE name
00063 RSEG segment:CODE
00064 IF is_weak == 1
00065 PUBWEAK name
00066 ELSEIF is_public
00067 PUBLIC name
00068 ENDIF
00069 name:
00070 ENDM
00071
00072 iar_weak_alias MACRO name, strong_name
00073 PUBWEAK name
00074 name:
00075 rjmp strong_name
00076 ENDM
00077
00078 #define lo(x) LWRD x
00079 #define hi(x) HWRD x
00080
00081 #define REPEAT(count) REPT count
00082 #define END_REPEAT() ENDR
00083 #define SET_LOC(offset) ORG offset
00084 #define END_FILE() END
00085
00086 #define FILL_BYTES(count) DS8 count
00087
00088 #define L(name) name
00089 #define EXTERN_SYMBOL(name) EXTERN name
00090 #define FUNCTION(name) iar_begin_func name, text_##name, 0, 0
00091 #define PUBLIC_FUNCTION(name) iar_begin_func name, text_##name, 1, 0
00092 #define PUBLIC_FUNCTION_SEGMENT(name, segment) \
00093 iar_begin_func_segm name, text_##name, 1, 0, segment
00094 #define WEAK_FUNCTION(name) iar_begin_func name, text_##name, 1, 1
00095 #define WEAK_FUNCTION_ALIAS(name, strong_name) \
00096 iar_weak_alias name, strong_name
00097 #define END_FUNC(name) ENDMOD
00098
00099 #define TEXT_SECTION(name) RSEG name:CODE:NOROOT
00100 #define RODATA_SECTION(name) RSEG name:CONST:NOROOT
00101 #define DATA_SECTION(name) RSEG name:DATA:NOROOT
00102 #define BSS_SECTION(name) RSEG name:DATA:NOROOT
00103
00104 #endif