RAMFUNC - RAM Function Support#
RAM code support.
Provides support for executing code from RAM. Provides a unified method to manage RAM code across all supported tools.
Note
Other cross-compiler support macros are implemented in COMMON.
Functions executing from RAM should not be declared as static.
Warnings
Standard library facilities are available to the tool with GCC in hosted mode (default), regardless of the section attribute. Calls to standard libraries placed in the default section may therefore occur. To disable hosted mode, add '-ffreestanding' to the build command line. This is the only way to guarantee no calls to standard libraries with GCC. Read more at www.gcc.gnu.org/onlinedocs/gcc-5.3.0/gcc/Standards.html
Keil/ARM uVision users must add a section named "ram_code" in their linker scatter file. This section must be in RAM memory. Look in the MCU SDK for example scatter files (ram_code.sct).
Usage#
In your .h file:
#include "em_ramfunc.h"
SL_RAMFUNC_DECLARATOR
void MyPrint(const char* string);
Issues have been observed with ARM GCC when there is no declarator. It is recommended to have a declarator also for internal functions but move the declarator to the .c file.
In your .c file:
#include "em_ramfunc.h"
SL_RAMFUNC_DEFINITION_BEGIN
void MyPrint(const char* string)
{
...
}
SL_RAMFUNC_DEFINITION_END
Macros#
This define is not present by default.
Compiler ported function declarator for RAM code.
Compiler ported function definition begin marker for RAM code.
Compiler ported function definition end marker for RAM code.
Macro Definition Documentation#
SL_RAMFUNC_DISABLE#
#define SL_RAMFUNC_DISABLE
This define is not present by default.
By compiling with define SL_RAMFUNC_DISABLE, code placed in RAM by SL_RAMFUNC macros will be placed in default code space (Flash) instead.
Note
This define is not present by default.
111
of file platform/emlib/inc/em_ramfunc.h
SL_RAMFUNC_DECLARATOR#
#define SL_RAMFUNC_DECLARATOR
Compiler ported function declarator for RAM code.
116
of file platform/emlib/inc/em_ramfunc.h
SL_RAMFUNC_DEFINITION_BEGIN#
#define SL_RAMFUNC_DEFINITION_BEGIN
Compiler ported function definition begin marker for RAM code.
119
of file platform/emlib/inc/em_ramfunc.h
SL_RAMFUNC_DEFINITION_END#
#define SL_RAMFUNC_DEFINITION_END
Compiler ported function definition end marker for RAM code.
122
of file platform/emlib/inc/em_ramfunc.h