[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-chat] loading a global variable (C) in assembly
From: |
Joerg Wunsch |
Subject: |
Re: [avr-chat] loading a global variable (C) in assembly |
Date: |
Wed, 8 Jul 2009 22:26:12 +0200 (MET DST) |
"Daniel Otte" <address@hidden> wrote:
> how can I reference (load) global variables which are declared in C
> code = in assembly code?
You just write the name of the variable:
lds r24, name_of_your_variable
If you want to be nice to the reader of your program, you declare
it external before:
..extern name_of_your_variable
However, that's not strictly necessary; any symbol the assembler
encounters it doesn't know about yet, it enters into the symbol table
as `undefined external'. In effect, that's the same as the .extern
statement is going to do.
--
cheers, J"org .-.-. --... ...-- -.. . DL8DTL
http://www.sax.de/~joerg/ NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)