2

I'm trying to use an Arduino UNO board with Assembly on MacOS, but I couldn't find any documentation about it.

How can I compile and upload Assembly files to the Arduino with MacOS?

1 Answer 1

3

You can add source code to the sketch in the Arduino IDE. When adding a new source code file make sure the extension is uppercase .S

Files with .S extension will be compiled as Assembly.

There is an Arduino IDE for the mac but if you want to use an external editor you have many options.

The simplest is to switch on File>Preferences>External Editor in the Arduino IDE. This makes the IDE work in "read-only/auto-reload" mode allowing edit in a different code editor but compile and upload (without reopening the code) in the Arduino IDE.

There are also the File>Preferences Verbose Compile and Verbose Upload options in the Arduino IDE. These options will show you the commands used to compile, link and upload. You will see that the IDE runs other programs, outside of the IDE, such as avrdude and g++. Therefore a small script file can be created to call the same commands from a different IDE if the external editor doesn't have a facility to run external commands.

The verbose output will show where the tools and sources for build and upload are located. Normally for Uno (avr) they are below [IDE Folder]\hardware\arduino.

2
  • Yes, I know how to use Assembly, because I'm using it in a module on my course. :) It's based on Linux and I've been using the labs to work on it, but it'd be easier on my Macbook. Is there a way to compile/upload it via emacs?
    – Dan
    Commented Nov 25, 2016 at 19:43
  • Okay I have edited my answer, I hope it helps. Maybe a good idea to edit your question with the additional clarity. Commented Nov 25, 2016 at 20:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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