HI
I want to place:
All static variables into a custom RAM section (e.g., .my_data)
.my_data
All code, including static functions and global functions, into a custom code section (e.g., .my_text) using memory mapping concept of AUTOSAR
.my_text
These is my source file code (.c):
#define START_SEC_VAR#include "MemMap.h"
static uint8_t counter1 ;static uint8_t counter2;
#define STOP_SEC_VAR#include "MemMap.h"
#define START_SEC_CODE#include "MemMap.h"
/* Static function */static void countInc(void){ counter1++; counter2++;}
/* Global function */void Process(void){countInc();}
#define STOP_SEC_CODE#include "MemMap.h"
This is MemMap.h file(.h):
#ifdef START_SEC_VAR #undef START_SEC_VAR#pragma section ".my_data"#endif
#ifdef STOP_SEC_VAR #undef STOP_SEC_VAR#endif
#ifdef START_SEC_CODE#undef START_SEC_CODE#pragma section ".my_text"#endif
#ifdef STOP_SEC_CODE#undef STOP_SEC_CODE#endif
Constraints:
I do not want to modify the .c files.
.c
I’m using Keil v5 with ARM Compiler 6, so #pragma arm section is not supported. I need to make changes in MemMap.h file only.
#pragma arm section
__attribute__((section(""))) too, it was compiled but the variables not at the specified memory section.
What i tried:
Used .ANY in .sct, then replaced with *(.my_data) but still got no match warning.
.ANY
.sct
*(.my_data)
Verified that static variables and functions work fine in their default sections.
Let me know if any further details are required.