I want to upload lines of code (with c files, not sketches). But sadly I don't own any programmers and only possess the Arduino UNO board. Since I want to program in c code, I can't make use of the Arduino IDE. Is there any way can code can be uploaded to the ATmega IC without using any programmer?

  • 1
    \$\begingroup\$ Nearly all C code will be accepted by the Arduino environment. You can cheat by putting all your code in the initialization. You can also try to use tool that is used to talk to the bootloader, but I don't know the details. \$\endgroup\$ Jan 12, 2014 at 20:13
  • \$\begingroup\$ As far as I know you can program just fine using the Arduino IDE. What you can do is from loop() call something like _main() and go from there. You can get pretty cheap programmers like this one. Then after you compile the code then you can upload it using avrdude. The commands to use this program are really simple. \$\endgroup\$
    – sherrellbc
    Jun 25, 2014 at 17:27

4 Answers 4


You can use Arduino as ISP programmer. Check the Arduino IDE \$\Rightarrow\$ File \$\Rightarrow\$ Examples \$\Rightarrow\$ ArduinoISP and refer to ArduinoISP documentation.

I personally use Linux and a Makefile to run all the required commands.

In short these are the commands required (Linux, but Windows is pretty similar when the toolchain is installed [and it is if you have the ArduinoIDE on the system])

# use your favorite text editor to author the source file, then save as `project.cpp`

cflags="-g -DF_CPU=$(avrFreq) -Wall -Os -Werror -Wextra -ffunction-sections -fdata-sections"

#compile to object
avr-gcc $cflags -mmcu=$avrType -Wa,-ahlmns=${src)}.lst -c -o ${src}.o ${src}.cpp

#compile to elf
avr-gcc $cflags -mmcu=$avrType -o ${src}.elf ${src}.o

#encode binary file to intelHex
avr-objcopy -j .text -j .data -O ihex ${src}.elf ${src}.flash.hex

#flash the controller
avrdude -p$avrType -c$programmerType -P$programmerDev $(baud) -v -U flash:w:${src}.flash.hex

Seeing the complexity to remember these commands, it really pays off to figure out how to use the linked above makefile on your system:

make help
make edit
make flash
  • \$\begingroup\$ FYI, sketches are really just C++ file. The IDE actually does the MAKE for you. So Jippie's make will work for you. Note that at the end it also calls avrdude. This will upload the binary executable for you. Where you will need to find either point or put the avrc++ compiler and avrdude and other files in your path. \$\endgroup\$
    – mpflaga
    Jan 13, 2014 at 1:31
  • \$\begingroup\$ I must have mentioned this. I own a MacBook Pro. So can you please tell me the steps to be performed on the Mac 10.9 platform ??? \$\endgroup\$
    – BharathYes
    Jan 13, 2014 at 6:48
  • \$\begingroup\$ I don't own a mac, so no I can't. OSX is pretty similar to Linux, so it should be pretty trivial to port the commands to it. You probably need to install GNU-make and the rest is already on your system. \$\endgroup\$
    – jippie
    Jan 13, 2014 at 7:08

If you want to save yourself a lot of time that you might waste on needlessly complicated solution just buy an AVR Dragon for $49. Don't be tempted to buy $10 kits or some weird programmer from eBay. Trust me I'm working with AVRs for the last 5 years and seen it all and tried a big part of it, nothing beats AVR Studio + original JTAG.


Use Atmel studio to compile the code and then use http://xloader.russemotto.com/ to take advantage of the chip bootloader and upload your compiled file.

  • \$\begingroup\$ @RedGrittyBrick No, there is no factory bootloader for Atmega48/88/168/328 but there are some sellers that program the device (a bare chip) and sell it including the bootloader ready to be used in case the end user doesn't have a serial (ISP) programmer. \$\endgroup\$
    – alexan_e
    Jan 13, 2014 at 10:40

Atmel Studio and a Make files are great ways to go. Where nice and established, middle ground is to use WinAVR. It predates the Arduino, it will install the tool chain and interfaces to compile and upload firmware. There are several tutorials out there. here is one.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.