Pragma instead of __attribute__((section("name")))

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Not applicable
Hi,

I'm running DAVE-3.1.10 (gcc), for ARM XMC4500.
I would like to link a large number of global variables to a certain RAM section in memory.
The variables does not need to be initialized or zeroed at startup.

Can this be done with a #pragma directive for the whole group,
instead of a declaring __attribute__((section("name"))) for each variable?
0 Likes
2 Replies
Not applicable
Hi Engztrom,

DAVE3 is using GNU compiler which has a limited support on #pragma directives.
So, you could only use the _attribute_ to declare your variable.
0 Likes
Not applicable
Well, it doesn't look so bad if disguised in a #define...

#define DATA2 __attribute__ ((section ("ETH_RAM")))
:
DATA2 float ChnFactor[MAXCHN];
DATA2 float ChnOffset[MAXCHN];
:
0 Likes