Yahoo Groups archive

AVR-Chat

Index last updated: 2026-04-28 22:41 UTC

Thread

Re: Arrays and pointers in GCC

Re: Arrays and pointers in GCC

2009-01-12 by Don Kinzer

--- In AVR-Chat@yahoogroups.com, "subscriptions@..." 
<subscriptions@...> wrote:
> I always do the interrupt prologue and epilogue in ASM.
> I don't trust interrupt keywords. :)
I have adopted the strategy of "trust but verify".  It is a simple 
matter to take a quick look at the assembly language code generated 
for an ISR implemented in C and verify that it's doing what you 
expected it to do.

The .lss file should contain assembly language code with 
interspersed C code.  (Note, however, that optimization sometimes 
results in the C code not being near the actual assembly language 
code.)  If your makefile doesn't create a .lss file, you can do it 
manually or modify the makefile to do so.

avr-objdump -S myproj.elf > myproj.lss

Don Kinzer
ZBasic Microcontrollers
http://www.zbasic.net

Re: [AVR-Chat] Re: Arrays and pointers in GCC

2009-01-12 by subscriptions@aeolusdevelopment.com

David VanHorn Wrote:
>Eventually I see myself writing most of the app in C, and then writing
>ISRs and maybe low level drivers and time-critical code in ASM.

That's the way to go IMO.  I will do ISR bodies in C at least sometimes but
I always do the interrupt prologue and epilogue in ASM.  I don't trust
interrupt keywords. :)

Robert

--------------------------------------------------------------------
mail2web - Check your email from the web at
http://link.mail2web.com/mail2web

Re: Arrays and pointers in GCC

2009-01-12 by Don Kinzer

--- In AVR-Chat@yahoogroups.com, dlc <dlc@...> wrote:
> The C is not interspersed.  How do I get this enabled in 
> the compiler?
You may not be using the right set of compiler options.  Clearly, 
debugging information must be embedded in the .elf file to allow avr-
objdump to produce the listing.  I use -gdwarf-2; other debug 
information formats may produce similar results.

Note, also, that I cautioned that optimization can render parts of 
the .lss file useless.  In particular, inlined functions are not going 
to appear with interspersed C/assembly language.

Don Kinzer
ZBasic Microcontrollers
http://www.zbasic.net

Re: [AVR-Chat] Re: Arrays and pointers in GCC

2009-01-12 by dlc

Don Kinzer wrote:
> --- In AVR-Chat@yahoogroups.com, "subscriptions@..." 
> <subscriptions@...> wrote:
>> I always do the interrupt prologue and epilogue in ASM.
>> I don't trust interrupt keywords. :)
> I have adopted the strategy of "trust but verify".  It is a simple 
> matter to take a quick look at the assembly language code generated 
> for an ISR implemented in C and verify that it's doing what you 
> expected it to do.
> 
> The .lss file should contain assembly language code with 
> interspersed C code.  (Note, however, that optimization sometimes 
> results in the C code not being near the actual assembly language 
> code.)  If your makefile doesn't create a .lss file, you can do it 
> manually or modify the makefile to do so.

   How do you get it to do this?  When I look at my .lss files I see a 
line with the function header, then assembly, then the next function 
header line.  The C is not interspersed.  How do I get this enabled in 
the compiler?

thanks,
DLC

> avr-objdump -S myproj.elf > myproj.lss
> 
> Don Kinzer
> ZBasic Microcontrollers
> http://www.zbasic.net
> 
> 
> 
> ------------------------------------
> 
> Yahoo! Groups Links
> 
> 
> 

-- 
-------------------------------------------------
Dennis Clark          TTT Enterprises
www.techtoystoday.com
-------------------------------------------------

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.