12
\$\begingroup\$

Since for my venture into Microprocessing I decided to go with Atmel AVR due to the vast resources available. And Arduino seems to has alot as well, not to mention their starter kits seem more "at my level"

The problem is I want to learn it in Assembly first, and then go to C/C++ or w/e Arduino uses, but ive heard Arduino won't take AVR assembly? Is this true? is their any way around that?

Thanks

edit: I would go with the ATMEL STK500 but..for a first timer it looks VERY complicated? Is there any reason why I can't just get a 8 bit AVR and put it on a breadboard and experiment that way? (i guess i'd have to figure out how to interface them as such....)

edit2: This is what I was thinkin

http://www.adafruit.com/index.php?main_page=product_info&cPath=17&products_id=193

\$\endgroup\$
  • \$\begingroup\$ How it is going? So which solution have you considered? I bought Arduino Uo and looking for a way to develop in assembler as well \$\endgroup\$ – sll Nov 10 '12 at 15:50
5
\$\begingroup\$

The Arduino boards can be programmed in assembly. All you need is an ICSP Cable (In Circuit Serial Programmer) cable and the AVR toolchain (free from ATMEL) to write to the board. You then get the advantage of on board debugging.

As you suggested, you can just slap an ATMEL chip on a breadboard and go to town.

The kit you referenced looks like a great starting point. You can take the chip right off the board and stick it on your own breadboard (as long as it has correctly regulated power and you account for the clock).

\$\endgroup\$
  • \$\begingroup\$ Ya I'd prolly want to stick with Not putting it on my own breadboard right now lol Im not that great with circuits. \$\endgroup\$ – user3073 Apr 8 '11 at 19:27
  • \$\begingroup\$ @Sauron - hah - either way is good. Whatever gets you hooked! The good thing is the individual chips are pretty cheap (a couple of bucks or so). \$\endgroup\$ – RQDQ Apr 8 '11 at 19:29
4
\$\begingroup\$

The Arduino IDE can be "fixed" to accommodate Assembly code. Here is the wiki: http://www.cs.nmsu.edu/~jcook/arduino/index.php?n=Notes.AssemblyMods

\$\endgroup\$
  • \$\begingroup\$ the url seems to be broken \$\endgroup\$ – Foad Oct 22 at 13:01
2
\$\begingroup\$

As far as I know there should be nothing specific about the Arduino bootloader that could prevent you from using assembly instead of C. The Arduino IDE may make it difficult to upload you own .hex files but it looks like the Arduino bootloader is STK500 compatible so you should be able to use it with avrdude.

\$\endgroup\$
  • \$\begingroup\$ Yes, actually, the Arduino IDE itself uses avrdude to perform the upload. \$\endgroup\$ – Chris Stratton Feb 5 '13 at 21:32
1
\$\begingroup\$

Arduino boards (Uno and Duemilanove at any rate) have a standard AVR programming connector which is supported by Atmel programmers and debuggers via AVR Studio. Studio supports assembler and C. A suitable programmer is the AVRISP MkII, and the AVR Dragon offers both programming and debugging. I'd get the latter, it's more expensive at $50, but the debugging facility is invaluable. You can also use those tools with a standard AVR chip (not Arduino) plugged into a breadboard or a PCB.

\$\endgroup\$
1
\$\begingroup\$

The Arduino is comprised of two pieces: the hardware and the IDE. The IDE mainly (if not completely) restricts you to C and C++ (with some syntactical sugar the developers have thrown in to make it a little more like Processing/Java). There's a chance that the IDE will recognize .s or .S files in the same directory as a standard sketch (.pde), but I wouldn't hang my hat on that.

There's nothing special about the hardware. It's a nice, friendly board with lots of nifty features that µC neophytes will appreciate, but if you want to just program the AVR via the ISP header, you can do that, too. You'll need something like the Atmel AVRISP mkII, or any other programmer that works with the 2x3 row connector on the Arduino board. Look for ones that are compatible with the avrdude program that you'll use to upload your applications. Stay away from Adafruit's USBtinyISP; I've had horrible luck with it and ended up buying the Atmel one I linked for less than $40 from Mouser.

\$\endgroup\$
  • 1
    \$\begingroup\$ Strange, I've had nothing but good experiences with the Atmel IDE and the usbtiny, Also buspirate will double as an isp for many different platforms, great little tool \$\endgroup\$ – crasic Apr 9 '11 at 5:22
1
\$\begingroup\$

Not difficult at all.

http://www.dwelch.com/arduino/

You need to look at I think ser.c on my page to pick which card. some use different serial port speeds by default, and different reset schemes to get into the programming mode. If you look at the arduino firmware you find that hardly any of the avr programming commands are really supported. Dont really need them anyway.

\$\endgroup\$
1
\$\begingroup\$

The Aruduino can absolutely be programmed in assembly. And you don't even need an ICSP cable to do it!

Okay, in fairness, this is not the same as programming it in pure assembly from the ground up.

But you can inline assembly in C. Which means that you can load code onto your Arduino that has inline assembly, which will then execute. Consider the TVOut library, which allows the Arduino to output NTSC/PAL to a TV.

That library is very time-sensitive (since it is outputting to a TV, each scanline has to be written at the right time.) So it uses inline assembly to speed up the process. Looking at line 89 of this file from the library, the author is using some of the assembly macros that he wrote.

Now. I suspect that he did not write them using the default Arduino IDE. But this library calls upon his inline asm code, which anyone can import, compile, and execute via their interface.

Best of luck!

\$\endgroup\$
  • 2
    \$\begingroup\$ Actually, you can do assembly source files too, you just have to skip the Arduino IDE and interact with the back end tools such as avr-gcc (or whatever you use as an assembler) and avrdude directly. \$\endgroup\$ – Chris Stratton Feb 5 '13 at 21:33
1
\$\begingroup\$

the arduino can be programmed with assembly using GCC-AVR Inline Assembler check this link for GCC-AVR Inline Assembler Cookbook

http://web.stanford.edu/class/ee281/projects/aut2002/yingzong-mouse/media/GCCAVRInlAsmCB.pdf

\$\endgroup\$

Your Answer

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