Uploading .hex files created outside the Arduino IDE?

I'm not sure what part of the forum this should go in, but since it's kinda tied in with programming, maybe it should go here. I came across a post in the old forum about using assembly to program an Arduino and there was a link to an example of the blink program done in inline assembly... But that's not my cup of tea (the inline aspect anyway). Someone else mentioned in that post that you could basically just upload any .hex to the Arduino, and I was wondering how I would do that.

basically just upload any .hex to the Arduino

You can certainly try. There is a long list of reasons that it wouldn't work.

Instead of describing an unrelated thread in the old forum I suggest describing what it is you're trying to accomplish.

Ok, so I was misinformed. Basically, I'd like to be able to program in AVR assembly, rather than in the Arduino language. There's no reason that I couldn't do my project in that language, but I figured it'd be a good way to get some experience programming in AVR assembly.

The overall project I'm gonna be working on is that a friend of mine got his hands on an old Armdroid 1000 robot, which has 6 stepper motors in it, and for our final project in college we've decided we want to completely replace the electronics inside it. The electronics in it are dead simple they take some parallel inputs from a computer, select the motor and turn on the requested coils; most of the chips are 74LS logic, with a couple ULN2003A stepper drivers and a voltage regulator.

You want to use AVR assembly instead of C++? Why?

Because I've had a lot less experience with ASM, especially on a non x86 chip... I figured even if I made the main project in C++ at least I could play around with the Arduino in ASM...

I know it's possible to treat the processor as a regular AVR chip, but I don't really want to buy something else just to be able to do that, if I can avoid it. I'm in college right now and pretty much broke. my parents are currently helping foot my part of the costs for the project.

Once you have .hex file you can just upload to the Arduino with AVRDude. You would bypass the bootloader, but you need a ICSP programmer. I have the pocket avr from sparkfun and it works great.

I suggest that you get the project going in some fashion with the simplest method available and then move parts or all of it to assembly by embedding it in the C code when time critical parts are identified. Do it in Arduino C++ and then fix as is necessary.

Bobbias:
Because I’ve had a lot less experience with ASM, especially on a non x86 chip…

So you want to use assembly for the learning experience?

I figured even if I made the main project in C++ at least I could play around with the Arduino in ASM…

Which implies that you believe there is a cost associated with programming in C++. Is that what you believe?

I know it’s possible to treat the processor as a regular AVR chip, but I don’t really want to buy something else just to be able to do that, if I can avoid it.

Buy something else? What else?

Yes.

Not really. I know that most modern compilers create code that is nearly as optimal as it could get.

Well I don't have a serial port on this computer (it's a newer laptop) so unless I'm mistaken I'd need a USB ICSP programmer, which would cost money... Basically I'm trying to see if there's a way to program something entirely in ASM and leverage the Arduino system to program the chip without needing to resort to buying/making a USB ICSP programmer...

I believe the Arduino IDE supports dot-S files. Create a new Sketch. Add a tab. Name the file with a dot-S extension. Put some assembly in the dot-S file. Try to Verify.

If all that works then you will be able to upload your Sketch using the IDE. No ICSP will be needed.

The IDE refuses to let me give it a .s extension.

I know adding support for writing things in other languages in IDEs adds a lot of work, but when that language is an intermediate step in the compilation of the language you do support, it kinda makes sense that you should be allowed to do that. Even if I had to add a bunch of boilerplate code to make my ASM work with the arduino bootloader and such I wouldn't mind doing that, as long as I had access to actually programming in AVR ASM :confused:

Oh well, I guess I'l abandon this idea for now. I've only just ordered the Arduino anyway, so I haven't even received it yet. Maybe when I have some free money I'll look into buying/building something for ICSP, since it's pretty handy to have for microcontrollers anyway.

The pocket AVR programmer from sparkfun is cheap and works really well. I think it is $20 and I threw it in my last ordered and have used it a bunch already. Plus this one can power the target too.