[Top][All Lists]

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

Re: [avr-gcc-list] Program Listing With C Comments

From: Ned Konz
Subject: Re: [avr-gcc-list] Program Listing With C Comments
Date: Sat, 1 Apr 2006 09:29:41 -0800

On Mar 31, 2006, at 2:05 PM, Albert Pion wrote:

How do I get a program listing with my C source code included as comments? I've tried about everything I can think of (including the --Wa,-alhd option) but have been unable to get it to work.

Attached is a Ruby (http://www.ruby-lang.org) script to post-process the output of avr-objdump into a legal assembly language program with C program text as asm comments.

Its output looks like this:

        .global __bad_interrupt
        .func   __bad_interrupt
__bad_interrupt :
        .weak   __vector_default
        .set    __vector_default, __vectors
        XJMP    __vector_default
        jmp     0x0 <__heap_end>

SerialCommandProcessor_setCurrentObject: ; (0x000000ca)
;;      /* SerialCommandProcessor functions ------------------- */
;;      void
;; SerialCommandProcessor_setCurrentObject (SerialCommandProcessor me, IOObject obj)
;;      {
        movw    r30, r24
;;          me->currentObject = (obj == NULL) ? me->topObject : obj;
        cp      r22, r1
        cpc     r23, r1
brne .+4 ; SerialCommandProcessor_setCurrentObject+0xc (0xd6)
        ldd     r22, Z+2        ; (0x02)
        ldd     r23, Z+3        ; (0x03)
        std     Z+1, r23        ; (0x01)
        st      Z, r22

Run it like so:

    avr-objdump -S myProg.elf | ruby simplifyListing.rb > myProg.asm

Ned Konz

Attachment: simplifyListing.rb
Description: Text Data

reply via email to

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