EmbDev.net

Forum: ARM programming with GCC/GNU tools declairing volatile struct in include file


Author: Dustin Sr (dbrazeau)
Posted on:

Rate this post
0 useful
not useful
Im trying to:

volatile struct  sDeviceReg
{
  .
  .
  .
};

and I'm getting the error:
error: qualifiers can only be specified for objects and functions

Am I doing this wrong??

Thanks

Author: Clifford Slocombe (clifford)
Posted on:

Rate this post
0 useful
not useful
The error means just what it says, you cab have a volatile variable or
function but not a volatile data type.

struct  sDeviceReg
{
...
};

volatile struct sDeviceReg device_instance ;


or

volatile struct  sDeviceReg
{
...
} device_instance ;


Note that in both cases it is device_instance that is volatile not
sDeviceReg. If you create other instances of this structure, they will
only be volatile if you declare them so individually.

Clifford

Reply

Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [avrasm]AVR assembler code[/avrasm]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]




Bild automatisch verkleinern, falls nötig
Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.