Yahoo Groups archive

AVR-Chat

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

Message

Re: [AVR-Chat] Re: INTO interrupt firing all the time?

2007-12-18 by David Kelly

On Dec 17, 2007, at 6:49 PM, Enki wrote:

> 	You are right, coding in Assembly is not for everyone.
> 	The ones that have the intelligence for doing that are often seeing
> as masochists. Pure jealousy...


There is always the snobbery angle to consider. I have inherited very  
few projects done in assembly that were done well. Also have inherited  
too many done in C that were horrible. Some seem to have been made  
horrible so as to ensure employment of the original author.

A prime example #included all the source files at one place or  
another, sometimes in the main.c file, sometimes in a file that was  
#included from another. A Makefile was too exotic. I spent a day  
trying to unravel the spaghetti without success. The code had many  
other faults such as it was interpreting serial commands encoded in  
hex ascii claimed to be MODBUS. It wasn't. Meanwhile a routine would  
look at the input buffer, convert the hex ascii to binary, think about  
it, then CONVERT IT TO HEX and put it back, where the next routine  
would DO THE SAME THING OVER AGAIN TO THE SAME DATA!

I wrote new code in less time than the original author took to port  
his beast from Rabbit-C to avr-gcc. Had a solid code base which  
withstood The Boss's creeping feature-itis the next 6 months. To this  
day its that company's best and least trouble product. And now it  
really and truly speaks ASCII Modbus.

One of my favorite Makefile targets with avr-gcc is:

.elf.list:
         avr-objdump -DS $< > $@

which generates a commented dump listing. It tries to disassemble data  
sections too, which doesn't make much sense but doesn't hurt anything.

I spend a moderate amount of time making sure the compiler wrote what  
I was looking for. Very important when building initialized structs  
and storing them in __ATTR_PROGMEM__ space.

--
David Kelly N4HHE, dkelly@HiWAAY.net
========================================================================
Whom computers would destroy, they must first drive mad.

Attachments

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.