This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Defining a section
- To: <gcc-help at gcc dot gnu dot org>
- Subject: Defining a section
- From: "Rodney Bryant" <Rodney dot Bryant at spikebroadband dot net>
- Date: Mon, 15 Oct 2001 13:50:46 -0400
Hi,
I am currently working on an embedded project that is being ported
from using a
Dib compiler to the GNU-GCC compiler. My question stems from a pragma that
is
supported by the Diab compiler that I have been unable to locate a similar
method in
the GCC compiler. The Diab compiler pragma defines a section as a part of a
C source
code file. There is a subsequent pragma from the Diab compiler that forces
the data
following the pragma to be placed into this newly defined section. I have
located the
attribute to use during variable definition to force the data to be located
into the section
that is defined in the variable definition. My question is how do I define
a section in a
C code source file? The following source code snippet is giving me
difficulty.
#ifdef GNU
Persistent_t gPersistentWork __attribute__ ((section (".persistentWData")));
#else
// place the working persistent data in a reserved memory area that
// is equal in size as the persistent sector in flash
#pragma section persistWork "" ".persistentWData" far-data RW
// Declare working copy of persistent data
#pragma use_section persistWork gPersistentWork
Persistent_t gPersistentWork;
#endif
The section .persistentWData is handled in my linker script file.
Respectfully,
Rodney Bryant