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 » how do you modify a makefile please help ASAP!

March 14, 2010
by 787pilot
787pilot's Avatar

how can you modify a make file to use the "makeing music with a microcontroler" please help me ASAP!

March 15, 2010
by treymd
treymd's Avatar

Most times the makefile can be modified just by replacing the old filenames with the new. say you are taking the old makefile from tempsensor and you want to use it with foo.c...

just replace every tempsensor filename with foo.c and place the file in the same directory as the foo.c file and make it.

March 15, 2010
by 787pilot
787pilot's Avatar

okay thanks

November 16, 2011
by tbonegrubb
tbonegrubb's Avatar

ok, I did that and get this error "makefile:11: *** missing separator. stop. I realy don't know what's going wrong.

November 16, 2011
by Ralphxyz
Ralphxyz's Avatar

You have to use TABs not spaces, if you cut and paste you will have spaces not tabs.

I'll try to illustrate:

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/ttyUSB0
AVRDUDEFLAGS=-c avr109 -p m168 -F -b 115200 -P /dev/cu.PL2303-0000101D
LINKOBJECTS=../libnerdkits/delay.o ../libnerdkits/lcd.o ../libnerdkits/uart.o

ProgramName = initialload
all:    $(ProgramName)-upload

$(ProgramName).hex: $(ProgramName).c
[TAB]   make -C ../libnerdkits
[TAB]   avr-gcc ${GCCFLAGS} ${LINKFLAGS} -o $(ProgramName).o $(ProgramName).c ${LINKOBJECTS}
[TAB]   avr-objcopy -j .text -O ihex $(ProgramName).o $(ProgramName).hex

$(ProgramName).ass: $(ProgramName).hex
[TAB]   avr-objdump -S -d $(ProgramName).o > $(ProgramName).ass

$(ProgramName)-upload:  $(ProgramName).hex
[TAB]   avrdude ${AVRDUDEFLAGS} -U flash:w:$(ProgramName).hex:a

So the indentation has be done with TABs not spaces. Some editors will substitute tabs for spaces as like I said will copy paste will do!

Ralph

Post a Reply

Please log in to post a reply.

Did you know that a motor is harder to turn when its terminals are shorted together? Learn more...