This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
smallcpus [2012/12/09 18:46] kris |
smallcpus [2015/10/21 19:05] (current) kris |
||
---|---|---|---|
Line 4: | Line 4: | ||
===== Enabling Assembler Programming on Arduino/Uno32 ===== | ===== Enabling Assembler Programming on Arduino/Uno32 ===== | ||
+ | |||
+ | **More recent versions of the Arduino IDE recognize .S files, and no changes are needed. I've tested this with version 1.6.5. If you're using a recent IDE, you can skip ahead to 'The Blink Example In Assembler'** | ||
+ | |||
+ | **Make sure to also check 'Feedback from Readers' at the end: it contains some important info for newer versions of the IDE.** | ||
It is hard to get an in-depth understanding of Arduino and the various CPUs involved. The standard IDE involves a lot of 'magic' and there is not much help when you want to get a better understanding of how the magic works. | It is hard to get an in-depth understanding of Arduino and the various CPUs involved. The standard IDE involves a lot of 'magic' and there is not much help when you want to get a better understanding of how the magic works. | ||
Line 392: | Line 396: | ||
<code> | <code> | ||
- | /* | ||
- | Blink | ||
- | Turns on an LED on for one second, then off for one second, repeatedly. | ||
- | |||
- | This example code is in the public domain. | ||
- | */ | ||
- | |||
- | // Pin 13 has an LED connected on most Arduino boards. | ||
- | // give it a name: | ||
#define ledFrom 2 | #define ledFrom 2 | ||
#define ledTo 9 | #define ledTo 9 | ||
Line 442: | Line 437: | ||
</code> | </code> | ||
- | Then I set out to do as assembler-only version. In this version, the .ino file remains empty, and all you do is add a file 'knightrider.S' to the sketch on a second tab. You need to use the patched IDE for this - standard IDEs won't recognize the .S file. | + | Then I wrote assembler-only version. In this version, the .ino file remains empty, and all you do is add a file 'knightrider.S' to the sketch on a second tab. You need to use the patched IDE for this - standard IDEs won't recognize the .S file. As you'll see further, this first attempt is far from optimal. |
<code> | <code> | ||
Line 842: | Line 837: | ||
Run it again. Is that cool, or what? | Run it again. Is that cool, or what? | ||
+ | |||
+ | ===== Feedback from readers ===== | ||
+ | |||
+ | Hi Kris! | ||
+ | |||
+ | Thank you very much for your Arduino asm introduction. I helped me a lot getting started. | ||
+ | |||
+ | But then I tried to modify version 1.5.2 the same way, because according to the developer of the arduino eclipse plugin, this is the latest version compatible with the plugin. And I found out that you need to modify the file .../hardware/arduino/avr/platform.txt, too. So I thought, maybe you want to mention this in your introduction. | ||
+ | |||
+ | in the "AVR compile patterns" section, adding the following solved the issue: | ||
+ | |||
+ | ## Compile S files | ||
+ | recipe.S.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.S.flags} -mmcu={build.mcu} -DF_CPU={build.f_cpu} -D{software}={runtime.ide.version} {build.extra_flags} {includes} "{source_file}" -o "{object_file}" | ||
+ | |||
+ | Regards, | ||
+ | |||
+ | Ralf | ||
===== Stuff collected on the Internet ===== | ===== Stuff collected on the Internet ===== |