
Am 21.12.2010 11:53, schrieb Wolfgang Denk:
Dear Albert ARIBAUD,
In message4D1083B4.2060704@free.fr you wrote:
And I at your suggestion tried modifying the binary changing the extra ldrb to a nop and it works.
Seems like a compiler issue to me, as the preprocessed C source is the same for the register access and does not call for a re-read (that is what I wanted to see in the preprocessed version), yet the ASM sequence does the re-read.
I also tend to think this is a compiler problem. Searching the gcc bugzilla entries for "ldrb" turns up quite a number of hits. I'm not sure which of these we are running into here, but there are enough of them so you can chose freely :-(
Hmm, is there actual somethinbg which should forbid the compiler to generate such code which rereads something? It might not be nice, but I don't think that it is forbidden for a compiler to do so. So the proper way to handle such, might be to use asm to avoid that the compiler touches that register.
Regards,
Alexander