NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.
Everything Else » Can you upload arduino code to the nerdkit MCU?
May 03, 2010 by Solorbob |
I know they use the same MCU, but is there a way to get some arduino code loaded onto a chip with the nerdkit bootloader on it? I searched the forum, but I didn't see a thread that looks like it would cover it. Thanks, Shawn |
---|---|
May 04, 2010 by Rick_S |
If you can locate the *.hex file that the arduino software compiles, you can send it over to the nerdkit using avrdude. If you look at the make file for the nerdkit, the last operation (the upload section) is to send the compiled file over to the chip. All you would have to do is enter that line from a "dos" window. For example:
Where progname.hex would be replaced by the hex file name created by arduino and com1 would be replaced by the com port used on your pc. The key is locating the hex file. I'm not sure where arduino stores it's files, or for that matter if it even keeps them once it's done it's thing. If you're using linux, YMMV and someone else may be able to talk you thru. If it works, let us know how it went. That way, we'll all be one step farther ahead. Thanks, Rick |
May 04, 2010 by Solorbob |
Thanks Rick. I'll start poking around to see what I can find out about the hex file. |
May 04, 2010 by Solorbob |
While searching around I found a thread on the nk forum talking about how to do this upload. thx Shawn |
May 04, 2010 by Solorbob |
Rick, Yes, this does work. I was able to get the blink.pde compiled and loaded onto my nerdkit. I created an Arduino directory and created the following make file. I just move over and rename the arduino hex file to this local directory. I run the make like normal. make file: AVRDUDEFLAGS=-c avr109 -p m168 -b 115200 -P COM6 arduino-upload: arduino.cpp.hex avrdude ${AVRDUDEFLAGS} -U flash:w:arduino.cpp.hex:a thanks for the help, Shawn |
May 05, 2010 by Rick_S |
No problem, Great to know it works that easily. This can open up a whole new world for projects to modify... Rick |
July 01, 2011 by raildoc |
I modified my Makefile to upload an Ardino_cpp.hex.a file to a 168 Nerdkit. Followed all directions (two threads) in Forum to upload Ardinuo to AVR. Now I get error message from last line of makefile from avrdude: target pattern contains no '%' . Help! Thanks. |
July 01, 2011 by Noter |
Let's have a look at that makefile. Can you post it? |
July 01, 2011 by raildoc |
Makecode File: GCCFLAGS=-g -Os -Wall -mmcu=atmega168 LINKFLAGS=-Wl,-u,vfprintf -lprintf_flt -Wl,-u,vfscanf -lscanf_flt -lm AVRDUDEFLAGS=-c avr109 -p m168 -b 115200 -P /dev com4 LINKOBJECTS=../libnerdkits/delay.o ../libnerdkits/lcd.o ../libnerdkits/uart.o all: read.cpp-upload read.cpp.hex: read.c make -C ../libnerdkits avr-gcc ${GCCFLAGS} ${LINKFLAGS} -o read.cpp.o read.cpp.c ${LINKOBJECTS} avr-objcopy -j .text -O ihex read.cpp.o read.cpp.hex read.cpp.ass: read.cpp.hex avr-objdump -S -d read.cpp.o > read.ass AVRDUDEFLAGS=-c avr109 -p m168 -b 115200 -P COM4 read-upload: read.cpp.hex.avrdude avrdude ${AVRDUDEFLAGS} -U flash:w:read.cpp.hex:a Thanks for the interest, raildoc |
July 01, 2011 by Noter |
Hard to follow like that, can you post it as a code block so it's not all run together? |
July 01, 2011 by raildoc |
Noter, thanks again.
|
July 01, 2011 by Noter |
Don't think you need the AVRDUDEFLAGS defined twice and commands need to be indented. Remove one of the AVRDUDEFLAGS and indent the avrdude command and I think you'll be ok.
|
July 01, 2011 by Noter |
By the way, I don't use a Mac but I think you need another slash in the AVRDUDEFLAGS like so ... -P /dev/com4 Copy the AVRDUDEFLAGS line from a working makefile to be sure it's correct. |
July 02, 2011 by Rick_S |
I think that MAC uses a variation of what is shown in the original NK makefiles. I think the COMx format is just a Windows thing. Someone please correct me if I'm wrong but these are the differences as I have seen them (I can only confirm Windows though) Linux:
Windows:
MAC:
Keep in mind each will change based on the port location. I also do not own a MAC but you can reference THIS FORUM POST FROM RALPH which explains the MAC thing a bit better. (He actually owns a MAC Mini). I'm not sure what type of computer you own or what OS you are running but either way, you'll need to change that parameter as well. Rick |
July 04, 2011 by raildoc |
Thanks much guys. I finally cleaned-up my makefile syntax. It now works like a charm! This is a great time-saving tool to convert existing coded Arduino apps to Nerdkit. Regards! |
Please log in to post a reply.
Did you know that talking to the microcontroller over the USB/Serial link is easy under Windows, Linux, and OS X? Learn more...
|