1

I'm trying to learn AVR development in C and Assembly for the Arduino Uno (Atmel 328p microprocessor) in Linux.

I've found many good guides on how to install and setup the AVR plugin for Eclipse, and I've no problem building and uploading C code. However there doesn't seem to be any menu options for creating an assembler project, nor can I seem to find the correct syntax for using the cli avr-as for assembling my programs into a .hex file.

  • 1
    In some cases you can simply feed a gcc variant with an .S file instead of a .c one and it will figure out what to do with it. But that depends on having valid assembly files, and a compatible build setup. – Chris Stratton Oct 30 '15 at 0:44
1

If you don't mind using make, I'd recommend copying the Makefiles from ChibiOS. For me it works quite well and it's much more aligned to my daily experience with Linux.

0

The Arduino IDE and the arduino eclipse plugin support assembly.
Taken from the platform.txt

"{compiler.path}{compiler.c.cmd}" {compiler.S.flags} -mmcu={build.mcu} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {compiler.S.extra_flags} {build.extra_flags} {includes} "{source_file}" -o "{object_file}"

compiler.S.flags is empty and so is compiler.S.extra_flags and builds.extra_flags

leaving us with something like

avr-gcc -mmcu={build.mcu} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {includes} "{source_file}" -o "{object_file}"

Which is something I think you can handle.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.