This is the mail archive of the crossgcc@sourceware.cygnus.com mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more infromation.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

problem assigning value to global variables


I'm trying to debug some fairly simple code that worked when compiled by
the person who wrote it - I'm not sure if the problem is in the code or
the compiler, but I can't find anything wrong with the code itself.  

(Sorry for such a long message - I'm not sure exactly where the problem
is, even though I've narrowed down where it isn't)

The compilers:

It was originally compiled using "gcc version
2.9-ecosSWtools-arm-990321".  The version of arm-elf-gcc installed on my
machine is "gcc version 2.95.2 19991024 (release)".  

The code:

The program is trying to read id information from an ide drive and write
it to a global variable. The id buffer can be read in and dumped to
stdout word by word, so it's not an issue of not being able to
communicate with or getting wrong information from the drive. 

So, in some file there's a global variable declared:

unsigned short buffer[];

The program calls a function that sends an IDDrive command to the drive
and zeros the buffer.  Then it calls a function to read the information
in from the drive:

int readBuffer(unsigned short *buffer) {
	unsigned short *temp;
	int i;

	temp = buffer;
	for (i=0;i<256;i++) {
	     *temp = *((unsigned long *)DATA_PORT;
	     temp++;
	}
}

This is almost identical to the code that correctly dumps the buffer
read from DATA_PORT to stdout.  However, instead of reading the real
data, temp is always set to some value (sometimes its 0x70, or 0x070070,
or 0x90... it's not always the same value). 

The code worked before, and I haven't made any changes to it, nor can I
see anything wrong with the way it's reading from memory (the drive is
memory mapped on an aeb-1c).  Is there some difference in the way the
two versions of arm-elf-gcc work that would break this? Which is doing
the correct thing? Is this a compiler bug?

Thanks for any help you can give me.

Nicole Cook

------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sourceware.cygnus.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]