C++ Memory Address of const class instances
Asked by
Gergely Budai
If i have a simple class instance like this:
class Test
{
public:
void Print(void) const
{
printf(
}
};
const static Test test;
And later somewhere I refer the address of that object like:
printf("Address: %X", &test);
Then I can see in the map file that the compiler reserves one byte for that address in the .bss segment:
.bss._ZL4test 0x20005308 0x1
I would assume that for something simple like this the compiler would reserve space in the .text segment which does not cost any RAM space.
Is there any way to tell g++ to put the address of such objects (without any member variables) into the FLASH instead of RAM?
(GCC 6 2017-q2-update on CORTEX-M4)
Question information
- Language:
- English Edit question
- Status:
- Expired
- Assignee:
- No assignee Edit question
- Last query:
- Last reply:
To post a message you must log in.