avr-gcc-list
[Top][All Lists]
Advanced

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

[avr-gcc-list] Debugging mixed C/Assembly project in AVRStudio 4.12


From: Matt Fornero
Subject: [avr-gcc-list] Debugging mixed C/Assembly project in AVRStudio 4.12
Date: Wed, 22 Feb 2006 13:43:39 -0500

Hi all.

I'm running into problems attempting to debug a mixed C/assembly project using AVR Studio 4.12

Specifically, I cannot find a way to debug (step through) both my C and assembly files. I've read over the message "converting gas-generated
stabs debugging symbols to Atmel", and the followup "recipe" for debugging assembler source files, but neither seem to quite work.

Using the "recipe" (assemble/compile all files with -gstabs, insert .stabs and .func directives into the assembly source, and then convert the .elf file to a avr-extended .cof file), I am
able to step through both the C source and assembly source, but the entry points to the function do not correctly line up.

That is, if I attempt to step into:

10: ->  foo(bar);
11:    while(1);

AVRStudio will not actually step into the function until line 11. And when it does, it will be on the second assembly instrunction in the function, rather than the first:

foo:
15:       LDI     r18, 0        ; Setup loop counter to 0
16: ->   MOVW r30, r24    ; copy base address of src to r30


My assembly file is as follows:

; function: sort16bit
; prototype:    void sort16bit (unsigned int * arry,
;                                int length)
; sorts array "src" of size "length" in ascending
; order
/*
 * extern void sort16bit (unsigned int *, int);
 */

.stabs  "",100,0,0,sort16bit
.stabs  "sort16bit.S ",100,0,0,sort16bit

.global sort16bit
.func   sort16bit


sort16bit:
    LDI     r18, 0        ; Setup loop counter to 0
    MOVW r30, r24    ; copy base address of src to r30
    LSL r22            ; multiply low word of length by 2
   ....
   ret
.endfunc


My C file is:
#define LENGTH 10
extern void sort16bit(unsigned int *, int);

    int arry[LENGTH] = {0xBEEF, 427, 0x3300, 0x01FA, 0xF0BB, 0x12CE, 0xE0FA, 0x0F10, 0x0B54, 0x000F};
   
int main()
{
    int dummy;
    sort16bit(arry, LENGTH);

    while(1)
    {
        dummy =(dummy+ 1) & 0xf;
    }
}


and my compiler/assembler calls are:

Compiling: test_gcc.c
avr-gcc -c -mmcu=atmega8 -I. -gstabs -DF_CPU=8000000UL  -O0 -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=test_gcc.lst  -std=gnu99 -MD -MP -MF .dep/test_gcc.o.d test_gcc.c -o test_gcc.o

Assembling: sort16bit.S
avr-gcc -c -mmcu=atmega8 -I. -x assembler-with-cpp -Wa,-adhlns=sort16bit.lst,-gstabs  sort16bit.S -o sort16bit.o

Linking: test_gcc.elf
avr-gcc -mmcu=atmega8 -I. -gstabs -DF_CPU=8000000UL  -O0 -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=test_gcc.o  -std=gnu99 -MD -MP -MF .dep/test_gcc.elf.d test_gcc.o sort16bit.o --output test_gcc.
elf -Wl,-Map=test_gcc.map,--cref

Converting to AVR Extended COFF: test_gcc.cof
avr-objcopy --debugging -O coff-ext-avr test_gcc.elf test_gcc.cof

when using the calls from the "recipe" :

Compiling: test_gcc.c
avr-gcc -c -mmcu=atmega8 -I. -gstabs -DF_CPU=8000000UL  -O0 -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=test_gcc.lst  -std=gnu99 -MD -MP -MF .dep/test_gcc.o.d test_gcc.c -o test_gcc.o
test_gcc.c:7: warning: function declaration isn't a prototype

Assembling: sort16bit.S
avr-as --gstabs --mmcu atmega8 sort16bit.S -o sort16bit.o

Linking: test_gcc.elf
avr-gcc -g -mmcu=atmega8 -o test_gcc.elf test_gcc.o  sort16bit.o

Converting to AVR Extended COFF: test_gcc.cof
avr-objcopy --debugging -O coff-ext-avr test_gcc.elf test_gcc.cof


I am unable to step into my assembly function at all. I'm sure there's something I'm forgetting/doing wrong-- I just can't seem to find it.

--
Matthew Fornero
address@hidden
(734)-846-4968
reply via email to

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