Hi, My declarations is like the following: global: #define T0MR0 (*(volatile unsigned long *)0xE0004018) static uint8 buf_inpos; local inside function: register uint8 buf_outpos; Is the strange asm output because of the volatile thingy? AFAIK volatile tells the compiler NOT to reuse values left in regs. Instead reload it from the original location every single time? Right? regards Jan brendanmurphy37 wrote: > > Jan, > > There's certainly something strange going on here. > > As others have pointed out you can't load a 32-bit literal with the > syntax you suggest. It can do done either with something like a > load/shift/add over one or more instructions as is the case here, or > loading indirect, as in: > > ldr pc, do_reset_addr > > do_reset_addr: .long do_reset > > (i.e. the 32-bit literal value is stored nearby). > > That much is normal. > > However, the something strange is more that you say the compiler > optimisation is at level 3, yet it loads identical literal values > into both r2 and r3 for no apparent reason. GCC is normally very > good at optimisation. > > What way is TMR0 declared? Is "volatile" involved at all? > > Also the initial comparison looks a bit strange: what way are > buf_inpos and buf_outpos declared? > > Brendan
Message
Re: [lpc2000] Re: Strange GCC compiler assembler output
2006-05-03 by Jan Thogersen
Attachments
- No local attachments were found for this message.