RFC embedded c proposal

Svein E. Seldal svein.seldal@solidas.com
Thu Apr 29 11:25:00 GMT 2004


Hi,

I'm working on a patch on [AVR-]GCC to support multiple memoryspaces. 
The AVR has more than one memoryspace (code + data), and thus a 
modification to GCC is needed.

This standard proposal from ISO/IEC:

   http://std.dkuug.dk/JTC1/SC22/WG14/www/docs/n1021.pdf

contains issues about C extension in respect of embedded processors. In 
section 3.1.2. it suggests syntax for multiple memoryspaces:

	_X char a, b, c;
		// Declares three characters in address space _X

	_X const int *p;
		// Declares a pointer in the generic address space
		// that points to a constant int object in address
		// space _X

	_X struct { int a; char b; } *_Y q;
		// Declares a pointer in address space _Y that points
		// to a structure in address space _X

Now, if I were to implement this into GCC, what would be best method of 
  implementation? Consider:

a) Add the appropriate _X keywords for the target at hand (which in this 
case could be _Progmem, _Flash, _Code or similar)

*or*

b) Declare an __attribute__, e.g. __attribute__((progmem)), that will 
become a part of the type decleration:

	__attribute__((progmem)) char a, b, c;  // Works today in GCC

	__attribute__((progmem)) int *p;        // Does not work


Which of these two methods would be best suited for gcc?


Regards,
Svein



More information about the Gcc mailing list