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]

Re: problem assigning value to global variables


Art Berggreen wrote:
> You didn't include the call to readBuffer.  I hope you are not expecting
> the "buffer" variable in the readBuffer() function to be the same as the
> global "buffer" array.  One is a global variable, the other is a formal
> parameter to the function with a scope local to that function.
> 

It's called as readBuffer(buffer).

> Second, (I don't know how IDE drives behave) if successive reads to
> DATA_PORT return different values, you want to make sure that DATA_PORT
> is declared as a pointer to volatile.  Otherwise the compiler can
> optimize the read out of the loop and only read once.  This could change
> between compiler versions.
> 

It wasn't declared as a pointer to volatile (it should be, and I've
changed it), but the assembly code has the read inside the loop either
way - so that's not the problem, unfortunately.  Is there some
difference in the way the different compiler versions assign pointers? 
Or where they locate global variables?


Nicole

------
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]