[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] Using __tmp_reg__ etc in assembly file
From: |
Georg-Johann Lay |
Subject: |
Re: [avr-gcc-list] Using __tmp_reg__ etc in assembly file |
Date: |
Thu, 22 Jan 2009 00:06:15 +0100 |
User-agent: |
Mozilla Thunderbird 1.0.7 (Windows/20050923) |
Colin Wall schrieb:
Hi List,
I must be missing something.
I can use symbols like __SREG__, __tmp_reg__ and __zero_reg__ in in-line
asm (e.g. "push __tmp_reg__") but if I do the same in a pure assembly
file, the compiler complains with "constant value required". How does one
access these symbols in the assembly file and keep gas happy?
gcc gererates a header in easch assembly output that looks like
.file "fifo.c"
.arch atmega168
__SREG__ = 0x3f
__SP_H__ = 0x3e
__SP_L__ = 0x3d
__tmp_reg__ = 0
__zero_reg__ = 1
.global __do_copy_data
.global __do_clear_bss
; GNU C version 3.4.6 (avr)
Newer versions ov gcc even define more. So the __tmp_reg__ is not a
symbol it's just a definiton. So
push __tmp_reg__
is equivalent to
push 0
and yes, there is no (redundant) register prefix "R" in this case.
I know I can always do my own #define, but it feels wrong to re-define
something that already exists...
No, it does not exist in any header. It exists in gcc ;-)
Georg-Johann