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.

Project Help and Ideas » odbii makefile?

June 27, 2010
by bowtie3232
bowtie3232's Avatar

Does anyone know where the makefile is for the odbii project? I tried to modify the initialload makefile to work and I get "make: *** No rule to make target odbii.c', needed byodbii.hex'. Stop." for an error message. Would this be due to the makefile or the odbii.c file? Thanks

June 28, 2010
by Ralphxyz
Ralphxyz's Avatar

To make a MAKE file I just use the tempsensor MAKEFILE and do a Find and Replace for the program name.

So if I have from the tempsensor project:

all:    tempsensor-upload

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

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

tempsensor-upload:  tempsensor.hex
avrdude ${AVRDUDEFLAGS} -U flash:w:tempsensor.hex:a

I just do a Find "tempsensor" Replace With "obdi".

This error also looks like the one where your source code and make file are not in the same folder.

Ralph

June 28, 2010
by bretm
bretm's Avatar

I don't even do search-and-replace any more. In my makefile template I added a PROJNAME variable and just refer to ${PROJNAME} instead of the actual project name, so it only needs to be specified in one place.

June 28, 2010
by bowtie3232
bowtie3232's Avatar

Thanks, I'll give the suggestions a try at my next opportunity, it may be a few day though.

June 29, 2010
by Ralphxyz
Ralphxyz's Avatar

And where is that one place?

How do you set PROJNAME?

Ralph

June 29, 2010
by bretm
bretm's Avatar

Up at the top, where all the other variables are set:

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

You can make up whatever variable name you want. I used PROJNAME but you could use PROJECT or PROJ or PROJECTNAME or whatever you want. For example there's nothing special about the name GCCFLAGS. Instead of GCCFLAGS you could call it FUDGEWITHALMONDS as long as you used the same name throughout the file. They're just shortcuts, for convenience.

June 29, 2010
by Ralphxyz
Ralphxyz's Avatar

So would this work? Added to the beginning of the file.

PROJECT=obdii

$(PROJECT).hex: $(PROJECT).out $(OBJCOPY) -j .text -O ihex $(PROJECT).out $(PROJECT).hex

That's neat, so much to learn.

Thanks,

Ralph

June 29, 2010
by bretm
bretm's Avatar

Yeah, that's how I usually do it, except with curly braces instead of parentheses. I don't know if parentheses also work.

July 05, 2010
by Ralphxyz
Ralphxyz's Avatar

parentheses actually work! I do not know if it's legit but it worked for my one and only test.

Ralph

Post a Reply

Please log in to post a reply.

Did you know that NerdKits has been featured in the MIT Undergraduate Research Journal? Learn more...