NerdKits - electronics education for a digital generation

You are not logged in. [log in]

NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.

Microcontroller Programming » What am I doing wrong?!!!

March 27, 2012
by mrford
mrford's Avatar

I have followed the directions for the usb kit and have gotten everything to work until I tried to compile my first program. I downloaded the makefile from initialload, found it in the directory and typed make, just like the directions say. But I get the following response: "'make' is not recognized as an internal or external command, operable program or batch file" What am I doing wrong!?

March 27, 2012
by Rick_S
Rick_S's Avatar

Welcome Sign

It sounds as if winavr didn't install correctly. If you are running any version of windows beyond xp, you have to right click the install file and select "run as administrator". Otherwise the files don't install properly if at all. If you didn't install this way, uninstall winavr, then re-install using that method. After installation, re-boot so the new environment variables can be loaded. That should correct that problem.

Rick

April 11, 2012
by mrford
mrford's Avatar

Okay, it looks like we are getting somewhere with this. I am actually getting it to do something. However it is giving me the following error message

H:\Code\initialload>make
make -C ../libnerdkits
make[1]: Entering directory 'H:/Code/libnerdkits'
make[1]:Nothing to be done for 'all'
make[1]: Leaving directory 'H:/Code/linerdkits'
avr-gcc -g -0s -Wall -nncu=atmega168 -Wl,-u,vfprintf -lprint_flt -Wl,-u,vfscan
f -lscanf_flt -ln -o initialload.c ../libnerdkits/delay.o ../libne
rdkits/led.o ../libnerdkits/uart.o
../libnerdkits/uart.o: could not read symbols: File truncated
make: *** [initialload.hex} Error 1

So it appears that something is wrong somewhere but I have no idea where to even start looking
April 11, 2012
by mrford
mrford's Avatar

That last line was not supposed to be included in the 'code' part

April 11, 2012
by mrford
mrford's Avatar

Just in case, this is what my initialload looks like

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 com3
LINKOBJECTS=../libnerdkits/delay.o ../libnerdkits/lcd.o ../libnerdkits/uart.o

all:    initialload-upload

initialload.hex:    initialload.c
    make -C ../libnerdkits
    avr-gcc ${GCCFLAGS} ${LINKFLAGS} -o initialload.o initialload.c ${LINKOBJECTS}
    avr-objcopy -j .text -O ihex initialload.o initialload.hex

initialload.ass:    initialload.hex
    avr-objdump -S -d initialload.o > initialload.ass

initialload-upload: initialload.hex
    avrdude ${AVRDUDEFLAGS} -U flash:w:initialload.hex:a
April 11, 2012
by pcbolt
pcbolt's Avatar

mrford -

Try moving "uart.o" out of the "libnerdkits" directory. This will force a rebuild of that file since the compiler won't be able to find it. It may have been corrupted. Make sure you keep a copy of the original file just in case.

April 11, 2012
by mrford
mrford's Avatar

I can't find a uart.o only a uart.c adn a uart.h in the libnerdkits directory

April 11, 2012
by mrford
mrford's Avatar

Okay sorry, I found it int he directory form the command line but not in the window. How do I move it from the directory in the command line?

April 11, 2012
by pcbolt
pcbolt's Avatar

I don't remember the move command...but you can rename it using;

ren uart.o uart_old.o

At the command prompt.

April 12, 2012
by mrford
mrford's Avatar

Okay, this is going somewhere! now it gives me this:

Connecting to programmer:
Found programmer: Id = "Huh? Go"; type = '
    Software Version = t. ; Hardware Version = '.S
avrdude: error: buffered memory access not supported. Maybe it isn't
a butterfly/AVR109 but a AVR910 device?
make: *** [initialload-upload] Error 1

So, it looks like there is a problem with avrdude, but is that a programing problem, software problem or hardware problem?

April 12, 2012
by pcbolt
pcbolt's Avatar

Most likely a hardware issue. There is an FAQ in the NK library about this HERE

April 12, 2012
by 6ofhalfdozen
6ofhalfdozen's Avatar

Hiya mrford,

that "not a butterfly" is a common error message, it has with various causes from bad make files, bad ".o" or bad ".h" files, loose wires, bad contacts on programming switch, and so on(anything making the programmer and chip not "talk" properly). double and triple check your wires, then search around the forum and you will find multiple causes and solutions for the butterfly message. Hopefully you can find the issue causing the error message.

April 12, 2012
by hevans
(NerdKits Staff)

hevans's Avatar

Hi mrford,

The "Huh? Go" in the error message there definitely means that your chip is not in programming mode. On the plus side it means that the cable driver is working correctly and you have right COM port. You just have to make sure your mcu is in programming mode when you try to program.

Humberto

Post a Reply

Please log in to post a reply.

Did you know that SPDT stands for "Single Pole, Double Throw"? Learn more...