[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avr-gcc-list] Assembly language help for a noob

From: Gre7g Luterman
Subject: [avr-gcc-list] Assembly language help for a noob
Date: Thu, 13 Sep 2007 15:44:53 -0700 (PDT)

Two questions in one!

In my current project, I've been forced to hand
assemble some of my source files to meet some rather
severe space requirements.  I've had no problems
compiling the .c and .S files together, but I'm
finding it far easier to debug the .c files than the
.S files in AVR Studio because the .c files have debug
symbols.  I can see my source intermixed with the
assembly code and I can single-step at the source

Is there a way to turn on debug symbol creation in gcc
on .S files?  I've tried to slog through the help
files but a lot of is going over my head.

Secondly, is there a good way to refer to offsets into
a C structure within an assembly file?  For example,
I'm currently doing something like:

# Some source.h file:
struct A
    uint8_t P, Q, R;
} GlobalA;
#define AoffP 0
#define AoffQ 1
#define AoffR 2

# Some source.S file:
    ldi r30, lo8(GlobalA) ; Get addr of
    ldi r31, hi8(GlobalA) ; GlobalA in Z
    ldd r16, Z+AoffR      ; Get GlobalA.R

I'm sure there must be a more efficient way than
defining AoffP, AoffQ, and AoffR, but I'm just not
knowledgeable enough yet!  Can anyone clue me in on
the good tricks?

Many thanks,


Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]