SPNU151W January 1998 – March 2023 66AK2E05 , 66AK2H06 , 66AK2H12 , 66AK2H14 , AM1705 , AM1707 , AM1802 , AM1806 , AM1808 , AM1810 , AM5K2E04 , OMAP-L132 , OMAP-L137 , OMAP-L138 , SM470R1B1M-HT , TMS470R1A288 , TMS470R1A384 , TMS470R1A64 , TMS470R1B1M , TMS470R1B512 , TMS470R1B768
The following GCC function attributes are supported:
The following additional TI-specific function attributes are supported:
For example, this function declaration uses the alias attribute to make "my_alias" a function alias for the "myFunc" function:
void my_alias() __attribute__((alias("myFunc")));
The aligned function attribute aligns the function using the specified alignment. The alignment must be a power of 2.
The always_inline function attribute has the same effect as the FUNC_ALWAYS_INLINE pragma. See Section 5.11.12
The calls attribute has the same effect as the CALLS pragma, which is described in Section 5.11.1.
The format attribute is applied to the declarations of printf, fprintf, sprintf, snprintf, vprintf, vfprintf, vsprintf, vsnprintf, scanf, fscanf, vfscanf, vscanf, vsscanf, and sscanf in stdio.h. Thus when GCC extensions are enabled, the data arguments of these functions are type checked against the format specifiers in the format string argument and warnings are issued when there is a mismatch. These warnings can be suppressed in the usual ways if they are not desired.
See Section 5.11.16 for more about using the interrupt function attribute.
The malloc attribute is applied to the declarations of malloc, calloc, realloc and memalign in stdlib.h.
The naked attribute identifies functions written as embedded assembly functions
using __asm
statements. The compiler does not generate prologue and
epilog sequences for such functions. See Section 5.10.
The noinline function attribute has the same effect as the FUNC_CANNOT_INLINE pragma. See Section 5.11.13
The ramfunc attribute specifies that a function will be placed in and executed from RAM. The ramfunc attribute allows the compiler to optimize functions for RAM execution, as well as to automatically copy functions to RAM on flash-based devices. For example:
__attribute__((ramfunc))
void f(void) {
...
}
The --ramfunc=on option specifies that all functions compiled with this option are placed in and executed from RAM, even if this function attribute is not used.
Newer TI linker command files support the ramfunc attribute automatically by placing functions with this attribute in the .TI.ramfunc section. If you have a linker command file that does not include a section specification for the .TI.ramfunc section, you can modify the linker command file to place this section in RAM. See the ARM Assembly Language Tools User's Guide for details on section placement.
The target attribute causes a function to be compiled in either ARM (32-bit) or Thumb (16-bit) mode. The target attribute has the same effect as the CODE_STATE pragma. The following examples use the target attribute.
__attribute__((target("arm"))) void foo(int arg1, int arg2)
__attribute__((target("thumb"))) void foo(int arg1, int arg2)
Note that the "pcs" attribute described in the ACLE specification is not supported.
The retain attribute has the same effect as the RETAIN pragma (Section 5.11.27). That is, the section that contains the function will not be omitted from conditionally linked output even if it is not referenced elsewhere in the application.
The section attribute when used on a function has the same effect as the CODE_SECTION pragma. See Section 5.11.4
The weak attribute has the same effect as the WEAK pragma (Section 5.11.32).