0

Hi I'm new to arduino and im using it to learn assembly for my computer hardware 101 class, I read online that I can make the IDE accept .s files and compile them to the board but I dont know how to do this (something about editing the source code and recompiling the IDE?).

Could I get a step by step walk through? Assuming it's relatively simple, or just a link to some relevant documentation that's not a literal reference manual :-).

EDIT As terrible as it is,I'm working from a macbook pro

1

The IDE should be able to accept .S files (not .s - the difference is very important: .S will be preprocessed, .s won't).

Just create a new sketch, and create a new tab called whatever.S (obviously rename the whatever to whatever you want to call it.

Then in the main sketch .ino file put something like:

extern "C" void myAssemblyMain();

void setup() {
    myAssemblyMain();
}
void loop() {
}

That will then call the function myAssemblyMain: in your assembly file and not much else.

(Note: I haven't tested this since I don't use the Arduino IDE).

  • Note that, if you do not rely on the initializations done by the Arduino core library, you can write main() instead of setup() and loop(). You may also write main() in assembly and put something else in the .ino file: a dummy unused function, or maybe nothing at all (though I don't know if the IDE will accept an empty .ino). – Edgar Bonet Nov 9 '17 at 8:29

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.