Accepted answer

you have a couple choices. i don't know about eclipse, (i just use vim and make directly) but the compilation procedure should be the same.

you can:

  • write a mostly c project, in-lining whatever assembly you want. this is usually the easiest method. check out the avr-gcc inline assembler cookbook.
  • write a purely asm application that doesn't use the linker at all. e.g. a one-file application (or one file that directly includes the rest of the project explicitly). you'll have to tell your build tool what to do to process the file, but it can be as simple as one invocation of avra or avr-as. you must be sure to carefully do all the low-level initialization and build a complete interrupt vector table for the mcu you're using, or you may get unexpected behavior.
  • write a mixed c and asm application linking between object files from both languages. to do that you do the same thing you would for a pure c project, except some (maybe all) of your source files will need to be assembly. you'll have to tell your build tool how to assemble them in to object files. in a makefile this would be writing the correct rule (or more likely setting up the ${as} macro to use the correct assembler). in eclipse there is probably a project setting for it, but with any ide ymmv. this is probably the hardest option, as you'll have to know the calling convention and abi of your compiler to successfully execute your pure asm code.

Related Query

More Query from same tag