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.

Support Forum » Making a make file

October 20, 2011
by mewatzittoya
mewatzittoya's Avatar

I am trying to make the music with an mcu project. The only problem I am having is creating the make file. This make file does not work(I changed the name from musicbox1 to musicbox)

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/cu.PL2303-0000101D
LINKOBJECTS=../libnerdkits/delay.o ../libnerdkits/lcd.o ../libnerdkits/uart.o

all:    musicbox-upload

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

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

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

I do not know what is wrong. Any help making this file is appreciated!

October 21, 2011
by Ralphxyz
Ralphxyz's Avatar

And the error you get is??

"This doesn't work" is kinda hard to trouble shoot.

Ralph

October 21, 2011
by mewatzittoya
mewatzittoya's Avatar
Mac-Pro:/ Nathan$ cd code
Mac-Pro:code Nathan$ cd musicbox
Mac-Pro:musicbox Nathan$ make
Makefile:9: *** missing separator.  Stop.
Mac-Pro:musicbox Nathan$

That is what my terminal window said.

October 21, 2011
by hevans
(NerdKits Staff)

hevans's Avatar

Did you by any chance happen to replace the tabs at the begginign of the lines with spaces? Make needs TABs at the begginign of the lines, and to separate the dependencies from the target names.

Humberto

October 22, 2011
by Ralphxyz
Ralphxyz's Avatar

Just copy paste will sometime replace the tabs with spaces on my Mac mini!!

So you need:

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

Ralph

October 22, 2011
by mewatzittoya
mewatzittoya's Avatar

I get different errors now. Could the problem be I have the ATmega168 and it needs the ATtiny26L?

October 22, 2011
by treymd
treymd's Avatar

Yes, the compiler (actually probably the assembler) needs to know what the target device is.

October 22, 2011
by Ralphxyz
Ralphxyz's Avatar

And the "errors" are?

Could the problem be I have the ATmega168 and it needs the ATtiny26L?

Why would you ask that? We need details in order to help you otherwise we would just be guessing like you.

We do not have the slightest idea of what exactly you are trying to do, nor can we see any error messages.

You have to help us help you.

Ralph

Post a Reply

Please log in to post a reply.

Did you know that many systems in nature can be described by a first order response? Learn more...