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 » Compiling error codes

May 04, 2011
by Cliffxxx
Cliffxxx's Avatar

While trying to compile and dowmnload the new program to the LCD for the first time, I received an error that said "target pattern contains no '%'". Does anyone now where I can find a list of error codes that describes what they meen. Everything else hase worked well up to this point. This is my first atempt at this sort of programming, so any help would be appreciated.

May 05, 2011
by Ralphxyz
Ralphxyz's Avatar

Hi Cliffxxx, post your code or just your output to the LCD.

Ralph

May 05, 2011
by Cliffxxx
Cliffxxx's Avatar

HI Ralph, here is the make file that is supposed to download everything into the MCU according to the instructions in the guide, step 10c.

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/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
May 05, 2011
by hevans
(NerdKits Staff)

hevans's Avatar

Hi Cliffxxx,

I see two issues here. One issue is the com port, you should change the entire "/dev/ttyUSB0" path to just "COM3", you need to remove the /dev/. The second issue, which I believe is the actual one causing the current problem is that lines 17 and 18 seem to have changed a bit. You have an extra line break after line 17, and line 18 is tabbed over one extra tab. You probably accidentally added the line break when you were editing the Makefile.

Humberto

May 05, 2011
by Cliffxxx
Cliffxxx's Avatar

Hi Humberto,

The extra line came from me copying it into here, but it did have some extra spaces for some reason. I fixed the problems, but it didn't change anything. I am still getting the same result. I did have a thought though. Are these drive and directory specific? I downloaded everything to my E: drive and made specific directories to place them in. Sometimes I have had problems in the past doing this.

Cliff

May 06, 2011
by Ralphxyz
Ralphxyz's Avatar

Cliffxxx, all of yur project foders have tobe directly under the Nerdkits/Code folder.

The Code folder has a libnerdkits folder that holds libraries that are included in the Nerdkit folders:

#define F_CPU 14745600

#include <stdio.h>
#include <math.h>

#include <avr/io.h>
#include <avr/interrupt.h>
#include <avr/pgmspace.h>
#include <inttypes.h>

#include "../libnerdkits/io_328p.h"
#include "../libnerdkits/delay.h"
#include "../libnerdkits/lcd.h"
#include "../libnerdkits/uart.h"

So as long as you have:

CLIFF -> E:\Code\initialload

You would do a cd e:\code\initialload

and from there do make

Ralph

May 06, 2011
by Hexorg
Hexorg's Avatar

Target pattern contains no '%'. Sounds like you are calling printf_P() to output data to USART, but you are not providing a pattern, while providing variables.

For example, if your code has

printf_P(PSTR("Data is: "), data); // data type is int
printf_P(PSTR("\n"));

change it to

printf_P(PSTR("Data is: %d\n"), data); // equivalent to what the top 2 lines do, but this is correct
May 06, 2011
by Cliffxxx
Cliffxxx's Avatar

Thanks guys for your time. I have tried both those fixes and get the same results. I did do some looking around and discovered some of the .h files are missing. I couldn't even find them on the original download location. I'll do some playing around and see if I can get it to do something else by removing one line at a time.

Cliff

May 06, 2011
by hevans
(NerdKits Staff)

hevans's Avatar

Hi Cliffxxx,

One option is to download the Code folder again, This will eliminate any remaining inconsistencies in the Makefile, and any mysteriously missing files. If you can provide a screenshot of the error you are getting, it would be great. I'm curious about this one.

Humberto

May 06, 2011
by Cliffxxx
Cliffxxx's Avatar

Hey Humberto, You get the gold star on this one. My display now says I am alive. Thanks to everyone for chipping in to help. I must have trashed it somehow when I changed it to COM3 the first time. All I did was copy over the two files, change to COM3, and it worked fine. Thanks again.

Cliff

Post a Reply

Please log in to post a reply.

Did you know that spinning a permanent magnet motor makes a voltage? Learn more...