Jan,
The output you got seems very strange. Which platform are you
compiling and with which version of GCC?
I suggest you do the equivalent of the following where I have created
the source "foo.c" with the T0MRO defined as you have, and then got my
build of the compiler to generate assembler source.
What it generates seems reasonable but very different from yours. I
suspect there could be something else obscuring your code that is not
visible from your excerpt.
Jaya
> [temp] cat foo.c
> #define T0MR0 (*(volatile unsigned long *)0xE0004018)
>
> void foo(void)
> {
> T0MR0++;
>
> } // foo()
> [temp] arm-esdk-gcc -O3 -S foo.c
> [temp] cat foo.s
> .file "foo.c"
> .text
> .align 2
> .global _foo
> .type _foo, %function
> _foo:
> @ args = 0, pretend = 0, frame = 0
> @ frame_needed = 0, uses_anonymous_args = 0
> @ link register save eliminated.
> mov r3, #-536870912
> add r0, r3, #16384
> ldr ip, [r0, #24]
> add r1, ip, #1
> @ lr needed for prologue
> str r1, [r0, #24]
> mov pc, lr
> .size _foo, .-_foo
> .ident "GCC: (GNU) 3.3.2"
> [temp]
--- In lpc2000@yahoogroups.com, Jan Thogersen <jan@...> wrote:
>
> 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
> JanMessage
Re: Strange GCC compiler assembler output
2006-05-03 by jayasooriah
Attachments
- No local attachments were found for this message.