This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
[RFC] Multiple memory-spaces in GCC feature request
- From: "Svein E. Seldal" <Svein dot Seldal at solidas dot com>
- To: "gcc" <gcc at gcc dot gnu dot org>
- Date: Thu, 22 Jan 2004 09:51:13 +0100
- Subject: [RFC] Multiple memory-spaces in GCC feature request
Hi,
There is a specific feature that I'm missing from GCC: The ability to
address multiple memory-spaces. Some embedded processors like the very
popular AVR, the 8051, and a couple of high-speed DSP's, uses two (or
possibly more) independent memoryspaces. One for code and one for data.
I.e. address 0x1000 is a valid addresses in both spaces, yet they point
to two entirely different locations. The CPU usually differentiates
between the memory-spaces using completely different INSN sets.
IMHO what GCC needs is the following features. I can post a longer
discussion and explanations of how and why if you'd like me to.
a) The ability to store variables into codespace. This is already
partially supported by the AVR target using the progmem attribute:
int data __attribute__((progmem)) = 42;
b) The ability to declare type attributes on pointers (which belongs to
the typedef)
int __attribute__((progmempointer)) * ptr;
c) GCC should be able to switch which INSN set to use when accessing the
given memoryspace indicated by the appropriate attribute.
ptr = &data; // Valid because of the attributes on both decl.
temp = *ptr; // Will access the programspace and retrieve 42.
d) The ability to store strings into codespace as well:
const char __attribute__((progmempointer) * string
__attribute__((progmem)) = "Hello World!";
(The progmempointer attribute declares a pointer to a code-address,
while the progmem attributes tells the compiler to place the literal
string into codespace.)
These features should apply only to those target that requires this of
course. And the names "codepointer" is of course a matter of discussion.
My problem is that I do not have the faintest idea of where to start to
implementing this. I would surely like somee help and/or some pointer to
how to attack this challenge. Esp. those parts concerning the global GCC
issues, like type attributes on pointers.
I would surely appreciate some input and comment about this topic.
Regards,
Svein