This is the mail archive of the crossgcc@cygnus.com mailing list for the crossgcc project.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
>>>>> "John" == John Breen <jab3@hotmail.com> writes:
John> volatile unsigned int *const reg_A = (void *)(BASE);
John> volatile unsigned int *const reg_B = (void *)(BASE+4);
John> volatile unsigned int *const reg_C = (void *)(BASE+8);
John> and put these in a .h file. This worked pretty well; the
John> pointers gave me a symbolic way to access the locations in
John> the debugger, and gcc optimized the code so that the memory
John> locations were accessed directly, rather than through the
John> pointer, so there was no access overhead.
John> The problem was when I tried to use the .h file in more than
John> one object file, and then link them. As one would expect, I
John> got multiple definition errors.
Try using "static" infornt of those, like this:
static volatile unsigned int *const reg_A = (void *)(BASE);
static volatile unsigned int *const reg_B = (void *)(BASE+4);
static volatile unsigned int *const reg_C = (void *)(BASE+8);
This will restrice the scope to those constants to the current
compilation unit only, so you will not get the multiple defined
errors.
--
-------- "And there came a writing to him from Elijah" [2Ch 21:12] --------
R. J. Brown III rj@elilabs.com http://www.elilabs.com/~rj voice 847 543-4060
Elijah Laboratories Inc. 457 Signal Lane, Grayslake IL 60030 fax 847 543-4061
----- M o d e l i n g t h e M e t h o d s o f t h e M i n d ------
_______________________________________________
New CrossGCC FAQ: http://www.objsw.com/CrossGCC
_______________________________________________
To remove yourself from the crossgcc list, send
mail to crossgcc-request@cygnus.com with the
text 'unsubscribe' (without the quotes) in the
body of the message.