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 Answer 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 ofsetup()
andloop()
. You may also writemain()
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– Edgar Bonet2017年11月09日 08:29:15 +00:00Commented Nov 9, 2017 at 8:29