This is the mail archive of the crossgcc@sources.redhat.com mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more information.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Assembler in C


Daniel:


The gcc syntax is along the lines of:

   __asm__("sbi PORTB, 0x07");

You could also do this:

   __asm__("sbi PORTB, 0x07;"
           "sbi PORTC, 0x07;");

See the GNU compiler manual, the section called "extended asm", for
more information on operand constraints that let you do really cool
stuff with inline assembly code.

You could also put your asm code in a .S file.

The example you provide for AnyFunction() won't work with gcc.  The
syntax just doesn't work like that.  If you're trying to do that much
in assembly, it probably belongs in a .S file anyway--- with a few
lines of inline assembly code to glue it to the C environment (again,
using operand constraints).


b.g.
-- 
Bill Gatliff
Do you do embedded GNU?  I do!
See http://billgatliff.com for details.

------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]