avr-chat
[Top][All Lists]
Advanced

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

Re: [avr-chat] Inline assembler warning: asm operand 2 probably doesn't


From: Michael Hennebry
Subject: Re: [avr-chat] Inline assembler warning: asm operand 2 probably doesn't match constraints
Date: Tue, 8 Feb 2011 16:05:29 -0600 (CST)
User-agent: Alpine 1.00 (DEB 882 2007-12-20)

On Tue, 8 Feb 2011, Rick Mann wrote:

As a file, I could have. This seemed easier, but I must've deleted the paste.

        http://pastebin.com/AVSapiFz

In principle, a class is only supposed to need one chunk of
code for each method regardless of the number of instances.
AVRPort needs a distinct chunk of code for each instance.
I think that your only hope is to write it without inline assembly.
It's possible that linker relaxation will accomplish
your purpose when the address is known at link time.
That said, I don't think it's worth the effort.
It doesn't help the case for using C++ on AVRs.
A good set of macros works better for me.

Usually I don't want to deal with a bunch of bits at once.
I want to set or clear a bit, preferably by name and register type:

#include "port_bits.h"
#define GREEN_LED_LET C
#define GREEN_LED_BIT 3

dset(GREEN_LED);  // an ouput pin
pclr(GREEN_LED);  // sink current

This code will probably use SBI and CBI instructions.

--
Michael   address@hidden
"Pessimist: The glass is half empty.
Optimist:   The glass is half full.
Engineer:   The glass is twice as big as it needs to be."



reply via email to

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