[Top][All Lists]
[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: |
Rick Mann |
Subject: |
Re: [avr-chat] Inline assembler warning: asm operand 2 probably doesn't match constraints |
Date: |
Tue, 8 Feb 2011 14:08:03 -0800 |
On Feb 8, 2011, at 14:05:29, Michael Hennebry wrote:
> 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.
For setting and clearing a single bit, my code works great, and uses SBI and
CBI.
--
Rick