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 » Trouble finding "make file" in dir. dos window

November 28, 2009
by georgio
georgio's Avatar

Whats up everyone, i got my kit two days ago and today im ran into some problems. I got everything hooked up and is running well. Time to program the first piece of code. So far i have downloaded:

(WinAVR for Windows)-This was saved in my local C:

(PL2303 USB Driver)

(CODE folder)-This was extracted into C:

Modified my "make" file to display proper COM and now says

(AVRDUDEFLAGS=-c avr109 -p m168 -b 115200 -P COM4)

BUT when i go to program the chip, as in, going into RUN typing and pulling up the "cmd" window and finally typing in "dir". I get all my files displayed but i cant seem to find the CODE folder or the "make" file anywhere. Weird, hmm maybe i saved something in the wrong location? could that be it?

I have searched this whole forum to a problem similar to mine but no luck. Any insightful tips as to what i should try modifying would helps guys, Thanks in advance.

November 28, 2009
by Rick_S
Rick_S's Avatar

Did you change the directory to c:?? By default cmd.exe will bring you into your user directory. If you extracted the code zip file to c: then you would need to change to the root directory of your hard drive before a dir command would see it.

cd \

would be the command to do this.

Then your dir command will show the code folder (if that is where you placed it).

If it doesn't show up then type:

dir code /s

This will search all directories below where you are at for the code folder.

Welcome to the forums.

Rick

November 28, 2009
by pbfy0
pbfy0's Avatar

I'm not sure, but I think the directory tree would be something like this for windows XP or older:

C:\Documents and Settings\<username>\Code\project\C file
C:\Documents and Settings\<username>\Code\project\Makefile

for win vista:

C:\Users\<username>\Code\project\C file
C:\Users\<username>\Code\project\Makefile

and for mac/linux

~/Code/project/C file
~/Code/project/Makefile

I know you're not using linux, but if someone else needs this info, I might as well put it down. I'm not completely sure about windows (I do all everything on mac/linux), but I think that's right.

November 28, 2009
by georgio
georgio's Avatar

Thanks a bunch Rick,

I googled "How to change root directory of Hard Drive" and i have found the solution.

OK now i have pulled up the dir but when i try to navigate to the file it displays this message: "The syntax of the command is incorrect"

November 28, 2009
by pbfy0
pbfy0's Avatar

I think you need to do

cd C:\

not just

cd \
November 28, 2009
by Rick_S
Rick_S's Avatar

When changing to the root directory of a drive with the DOS cd command, all you use is the slash. As a matter of fact, to the best of my knowledge, if you precede the slash with a drive designation as you illustrated, the cd command does nothing. If you need to change drives in DOS (or command prompt), you simply type the drive letter followed by a colon.

cd -- changes to root of current drive

cd.. -- changes up one directory from where you are

cd -- shows current directory

Rick

November 28, 2009
by Rick_S
Rick_S's Avatar

"

OK now i have pulled up the dir but when i try to navigate to the file it displays this message: "The syntax of the command is incorrect"

"

What exactly are you typing in the command window?? What OS are you running (I know windows but what flavor?) I know you said you downloaded WinAVR, did you install with the administrator login?

A little more info and we can get you going.

Rick

November 28, 2009
by Rick_S
Rick_S's Avatar

I just noticed the posted text did not have the slash in the cd statement.

Where I said:

cd -- changes to the root directory of the current drive,

It should have read:

cd \  -- changes to the root directory of the current drive.

Sorry for the mistake. :D To get the slash to appear I had to pretend it was code and preced the line with 4 spaces. ??

Rick

November 28, 2009
by georgio
georgio's Avatar

Ok guys i found it. here's a screen image of the dos window

http://img267.imageshack.us/img267/3416/dosw.png

November 28, 2009
by Rick_S
Rick_S's Avatar

georgio,

type cd Code instead of <DIR>Code

cd is short for change directory. The <DIR> in the listing is simply telling you that the listing is a folder and not a file.

Also, pbfy0 apparently in XP you can have the drive designation in front of the backslash. While I know the backslash by itself will work I'll stand corrected that in XP it works either way. It's been a while since I ran XP and could only check in Vista.

georgio, you may want to familiarize yourself with DOS commands if you plan to build your projects that way. A quick google of "dos commands" turned up this site LINK with a decent reference.

Otherwise, if you open your program file with programmers notepad and everything is installed correctly you can select tools-make all and that will compile and upload your program.

Rick

November 28, 2009
by georgio
georgio's Avatar

Thanks rick, it seems like im almost on my way.Hhmm there is another problem....

http://img690.imageshack.us/img690/4206/dos2.png

November 28, 2009
by Rick_S
Rick_S's Avatar

For some reason make can't find your libnerdkits folder in the code folder. Check to see that it's there. Should be, it's in the code download. You didn't by any chance edit the makefile with notepad did you?

November 28, 2009
by georgio
georgio's Avatar

Well that may be it then, I did edit the file using wordpad not notepad. Should i have done other wise?....Yes the libnerdkits folder is in the code file. This is what i have in the initialload file:

http://img38.imageshack.us/img38/7058/initialload.png

Thanks rick your help is greatly appreciated.

November 28, 2009
by pbfy0
pbfy0's Avatar

for your setup, I think you would have to have libnerdkits in

C:\Code.
November 28, 2009
by Rick_S
Rick_S's Avatar

I'm not sure if there's an issue with using wordpad or not. Anyone can jump in and correct me if I'm wrong. I believe the problem with notepad is it automatically pads all lines with a CR/LF combo (Windows standard) where the makefile follows the unix/linux standard of just a CR. I'm not sure if wordpad does this or not.

I use an editor called editpad lite. It's free for personal use.

My make file looks like this:

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

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

This compiles fine with mine.

November 28, 2009
by n3ueaEMTP
n3ueaEMTP's Avatar

georgio & Rick, When I edit a make file, I copy one into MS word, find & replace the name of my c file (there should be 14 replacements) and then copy it back into programmer's notepad (the one that came with my kit). There is a drop down menu where you can choose the type of file you are writing. I choose make and everything seems to work. This seems to be the quickest & easiest that I've found. It prevents me from forgetting to change something or misspelling one of the 14 needed changes.

Chris B. n3ueaEMTP

November 30, 2009
by georgio
georgio's Avatar

I want to say thanks to everyone for the help, my problem has been resolved.

For one thing i was not extracting the CODE file correctly so the MAKE file would not compile from the command prompt.

Pointers from Rick_s,n3ueaEMTP and pbfy0 have led me in the right direction.

I have learned a lot from this simple yet daunting experience and now i am well on my way to some programming fun ahead.

November 30, 2009
by Rick_S
Rick_S's Avatar

Glad to hear you got it resolved.

Rick

December 28, 2009
by parkman
parkman's Avatar

Rick, we got All the way through and finally found the "makefile" but when we entered "make", it responded "No rule to make target ' initialload. C', needed by 'initialload.hex'. Stop"

What should we do?????

December 28, 2009
by hevans
(NerdKits Staff)

hevans's Avatar

Hi Parkman,

I'm not positive from your description, but it sounds like for some reason initialload.c is not in the same folder as your Makefile. Make sure the entire initialload folder is copied over unmodified from the code you downloaded, and that the initialload.c file has not been renamed.

Humberto

January 02, 2010
by geeksneakphr34k
geeksneakphr34k's Avatar

my computer is running windows 7. is this a problem? i first had trouble in the cmd prompt when i typed "....[directory]....initialload> make" and it said there was no "make" command. I changes the "Makefile" file name to "make.exe" and tried again. it worked. sort of. i got the following output back:
"This version of ......Make.exe is not compatible with the version of Windows you're running. Check your computer's system information to see whether you need a x86 (32-bit) or x64 (64-bit) version of the program, and then contact the software publisher."
any ideas?

January 02, 2010
by geeksneakphr34k
geeksneakphr34k's Avatar

nevermind! i re-downloaded everything again and changed some directory in my computer's properties, and now it works.

January 02, 2010
by mongo
mongo's Avatar

I don't know much about Windows 7 but you might want to see if it has a compatibility mode for Windows XP and earlier. I run XP exclusively for all of my newer stuff and believe it or not, I still have Win 3.1, 95 and 98 machines for the same reason. Until ALL of my older stuff can work on newer platforms, I will not upgrade beyond that.

I even run DOS on a lot of stuff.

All you should really need to do is be in the directory where the .c file is located and type in 'make'. It should find everything from there.

January 03, 2010
by Rick_S
Rick_S's Avatar

CAUTION OFF TOPIC HIJACK/POST

Wow, Windows 3.1 and DOS --- Does your windows 3.1 have "multimedia extensions"??

I remember those days seemed like technology was racing ahead at such a pace it was hard to keep up.

I am happy there is nothing tying me to those old systems. Having to worry about memory - Using HIMEM.sys to allocate drivers above the 640k boundry, Needing to load drivers in the config.sys file for your CDrom... I cringe just thinking about it. :)

Although, I must admit... by going through all that in those days, it has made me better at diagnosing problems today.

Sorry for the off topic statements, mongo just got me reminiscing. :D

END OF OFF TOPIC HIJACK/POST

March 03, 2010
by tylskijj
tylskijj's Avatar

I've been following this thread for a while and have been unable to upload a program to my atmel chip. I've been able to get this to finally recognize the make file, and I've used this make file exactly.


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 COM 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


The file is simply called Makefile So, when I'm in Command Prompt (running XP 32bit SP3), I get this line, C:initialload> Here I type >Dir and it brings up this.


Volume in drive C has no Label. Volume Serial Number is F4CD-39F6

Directory of C:initialload

03/01/2010 04:04 PM <DIR> . 03/01/2010 04:04 PM <DIR> .. 03/31/2010 04:26 PM <DIR> 969 initialload.c 03/01/2010 04:04 PM <DIR> 669 Makefile 03/01/2010 04:04 PM <DIR> 686 Makefile.exe 3 File(s) 2,234 bytes 2 Dir(s) 57,334,779,904 bytes free


So, The make file is in the system. When I attempt to run the make command though, this is what happens.


C:initialload>make makefile:9: *** missing separator. Stop.


What am I doing wrong? I've attempted to use their make file from the website and insert COM3 where I need to, but I get this error instead, and I can't seem to get around it without using the above mentioned make file.


C:initialload>make make -C ..libnerdkits make: ..libnerdkits: No such file or directory. Stop. make: [initialload.hex] Error 2


PLEASE HELP!!! Thanks :)

March 03, 2010
by hevans
(NerdKits Staff)

hevans's Avatar

Hi tylskijj,

The ..libnerdkits: No such file or directory issue is happening because the makefile is not finding the libnerdkits directory where it expects it to be. The way we have structured the Code folder, our Makefiles expect to have each project in its own folder inside the Code folder along with the libnerdkits folder (libnerdkits contains a few libraries we have put together to make a few things easier like writing to the LCD, and communicating over the serial port). The easiest way to ensure that is the case is to just unzip the entire Code folder onto your hard drive and work out of the project directories there.

If you fix that problem the original Makefile should work if you use the right COM number. Let me know if this doesn't make sense, ill try to explain it better.

Humberto

Post a Reply

Please log in to post a reply.

Did you know that you can follow NerdKits on Facebook, YouTube, and Twitter? Learn more...