gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

C/C++ > probably very stupid question.. stuck

#7451 - Lotus-6 - Wed Jun 18, 2003 5:25 am

using a doc to get started on GBA programming... I have all of their devkit stuff all set up and I changed vis C++ and stuff.. built this test program but I get an error when I try to build it that says

NMAKE : fatal error U1073: don't know how to make 'boot.o'
Stop.
Error executing nmake.

CPPTest.bin - 1 error(s), 0 warning(s)


;_;

#7454 - tepples - Wed Jun 18, 2003 5:33 am

Lotus-6 wrote:
using a doc to get started on GBA programming... I have all of their devkit stuff all set up and I changed vis C++ and stuff.. built this test program but I get an error when I try to build it that says

NMAKE : fatal error U1073: don't know how to make 'boot.o'
Stop.
Error executing nmake.

Can you show your makefile? Is there a 'boot.c' that's not being built for some reason, or did you forget to download 'boot.o'? Which tutorial are you using?
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#7455 - Lotus-6 - Wed Jun 18, 2003 5:40 am

it's "newbie's guide to GBA development"

here's the list of files that are in the project:
main.cpp
boot.s
CPPTest.mak
Linkscript

here's the source for the makefile:
# ------------------------------------------
# Title: CPPTest
# File: CPPTest.mak
# Author: Christer Andersson
# Orignally by: Jaap Suter
#
# Info: This file is contains the make-instructions
# for the project.
#
# -------------------------------------------

# -------------------------------------------
# Define some directories;
# -------------------------------------------
SRCDIR = C:\GBADEV\CPPTest
CMPDIR = C:\GBA\bin
LIBDIR = C:\GBA\lib\gcc-lib\arm-agb-elf\3.0.2\interwork
LIBDIR2 = C:\GBA\arm-agb-elf\lib\interwork
INCDIR = C:\GBA\lib\gcc-lib\arm-agb-elf\3.0.2\include
INCDIR2 = C:\GBA\arm-agb-elf\include

# -------------------------------------------
# Define what extensions we use;
# -------------------------------------------
.SUFFIXES : .cpp .s

# -------------------------------------------
# Define the flags for the compilers;
# -------------------------------------------
CFLAGS = -I $(INCDIR2) -I $(INCDIR) -I $(SRCDIR) -mthumb-interwork -c -g -O2 -Wall -fverbose-asm
SFLAGS = -I $(INCDIR2) -I $(INCDIR) -mthumb-interwork
LDFLAGS = -L $(LIBDIR) -L $(LIBDIR2) -T LinkScript

# -------------------------------------------
# Define the list of all O files;
# -------------------------------------------
O_FILES = boot.o \
crtbegin.o \
crtend.o \
main.o

# -------------------------------------------
# Define the final dependecy;
# -------------------------------------------
all : CPPTest.bin

# -------------------------------------------
# Define the copy from .elf to .bin file
# -------------------------------------------
CPPTest.bin : CPPTest.elf
objcopy -v -O binary CPPTest.elf CPPTest.bin
-@echo ------------------------------------------
-@echo Done
-@echo ------------------------------------------

# -------------------------------------------
# Define the linker instruction;
# -------------------------------------------
CPPTest.elf : $(O_FILES)
ld $(LDFLAGS) -o CPPTest.elf $(O_FILES) -lstdc++ -lgcc -lc
-@echo ------------------------------------------
-@echo Linking Done
-@echo ------------------------------------------

# -------------------------------------------
# Define each compile;
# -------------------------------------------
{$(SRCDIR)}.cpp.o::
gcc $(CFLAGS) $<
-@echo ------------------------------------------
-@echo CPP-Sources Compiled
-@echo ------------------------------------------

# -------------------------------------------
# Define each assemble;
# -------------------------------------------
{$(SRCDIR)}.s.o:
as $(SFLAGS) $(SRCDIR)\$*.s -o$@
-@echo ------------------------------------------
-@echo ASM-Sources Compiled
-@echo ------------------------------------------


# -------------------------------------------
# EOF;

//this is the end of the makefile

Honestly I've never even used a makefile before, although the concept doesn't seem hard to grasp. The only programming experience I have is a first year computer science course I took this year on C++.. fun stuff, but all I've done is build console apps. So... yeah, enough babbling.

#7456 - tepples - Wed Jun 18, 2003 5:52 am

Lotus-6 wrote:

# -------------------------------------------
# Define the list of all O files;
# -------------------------------------------
O_FILES = boot.o \
crtbegin.o \
crtend.o \
main.o

First of all, you'll have to download boot.o and put it where the linker can find it (probably in the same folder as the project file).
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#7467 - gb_feedback - Wed Jun 18, 2003 12:14 pm

Oh god I hate these makefile problems. To be honest once I get one working I try not to touch it or think about it again. Feeble I know.

Tepples: you're probably better able than I am to sort this, but I can say this:

boot.s is just crt0.s with a different name. According to Lotus-6 he has this file in his project already. Presumably boot.o is supposed to be made from boot.s by the 'Define each assemble' section.

the line 'SRCDIR = C:\GBADEV\CPPTest ' defines where the sources are supposed to be. Are they in fact there?

Even more basically I wonder if gcc can be found at all. You know, something to do with paths and things...

(If necessary read 'she' for 'he')
_________________
http://www.bookreader.co.uk/

#7468 - Quirky - Wed Jun 18, 2003 12:50 pm

the rule:

# -------------------------------------------
# Define each assemble;
# -------------------------------------------
{$(SRCDIR)}.s.o:
as $(SFLAGS) $(SRCDIR)\$*.s -o$@
-@echo ------------------------------------------
-@echo ASM-Sources Compiled
-@echo ------------------------------------------

should create your boot.o file. Is SRCDIR properly defined within the project? I imagine it's a path setting problem, as that always shafted me with VC++. Though the error makes it sound like it doesn't recognise this rule - but that be because it can't find boot.s to create boot.o

#7469 - gb_feedback - Wed Jun 18, 2003 12:56 pm

Yeah I was going to say... The path is the bit you set up in Tools..Options..Directories. Could be worth double checking.
_________________
http://www.bookreader.co.uk/

#7490 - tepples - Wed Jun 18, 2003 6:00 pm

Quirky wrote:
the rule:

# -------------------------------------------
# Define each assemble;
# -------------------------------------------
{$(SRCDIR)}.s.o:
[snip]

should create your boot.o file.

That rule would create boot.s.o not boot.o, right?
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#7495 - Lotus-6 - Wed Jun 18, 2003 6:24 pm

blaaaaah. I believe the boot.o err might have been related to bad directories, I changed some stuff and started over... now I seem to be getting this error:

gcc -I C:\GBA\arm-agb-elf\include -I C:\GBA\lib\gcc-lib\arm-agb-elf\3.0.2\include -I C:\GBADEV -mthumb-interwork -c -g -O2 -Wall -fverbose-asm C:\GBADEV\main.cpp
The system cannot execute the specified program.
NMAKE : fatal error U1077: 'gcc' : return code '0x1'
Stop.
Error executing nmake.

I'm using devkitadvance, which is installed in C:\GBA

all of my files that i'm using to do this are uploaded onto http://www.sonicstrike.net/~tom/gba/CPPTest.dsp
http://www.sonicstrike.net/~tom/gba/boot.s
http://www.sonicstrike.net/~tom/gba/CPPTest.dsw
http://www.sonicstrike.net/~tom/gba/CPPTest.mak
http://www.sonicstrike.net/~tom/gba/CPPTest.opt
http://www.sonicstrike.net/~tom/gba/CPPTest.plg
http://www.sonicstrike.net/~tom/gba/crtbegin.o
http://www.sonicstrike.net/~tom/gba/crtend.o
http://www.sonicstrike.net/~tom/gba/Linkscript
http://www.sonicstrike.net/~tom/gba/main.cpp

they're in the directory C:\GBADEV on my computer.
when I created the workspace in C:\GBADEV, the FAQ said that Visual C++ would automatically create a C:\GBADEV\CPPTest directory and put the stuff in there, but it didn't, so I just modified it accordingly, but that shouldn't have been much of a big deal....

#7524 - Quirky - Thu Jun 19, 2003 8:36 am

tepples wrote:
That rule would create boot.s.o not boot.o, right?


Hang on... good point. We're not talking about GNU make here, are we?

That rule is what's known as a "suffix rule", or specifically a double-suffix rule in this case[1], GNU make supports these but if NMAKE doesn't then it could be causing problems?


[1] if you define a rule that is 2 recognised suffixes concatonated, make will not make a boot.s.o file, but will know you mean the source suffix is .s and target suffix is .o - I don't know if this works in NMAKE though.

#7525 - gb_feedback - Thu Jun 19, 2003 9:25 am

The more I hear the more I realise I don't understand.

The thing is that I have a project which is set up almost identically to this (I must have used the same document to start the project off - it even has the same project name - to show how lazy I am). And in spite of the .s.o business and using NMAKE it still seems to assemble boot.s into boot.o successfully. (The stuff is all at home so I can't quote from it right now and of course I may be remembering incorrectly).

I still wonder however whether the path to the gcc stuff has been defined correctly. (This was done in Tools..Options..Directories in Visual Studio 97.) I seem to remember this path ends with ...\bin

EDIT: btw a quick look in the nmake help file suggests this works the same way. If I'm reading it correctly they call it an inference rule:

.fromext.toext
commands
_________________
http://www.bookreader.co.uk/

#7527 - Quirky - Thu Jun 19, 2003 10:36 am

OK, then the suffix notation is supported in nmake (MS probably just copied the source to GNU make anyway ;) ) so that isn't the problem. I was just guessing with that anyway. Still, nice to learn why that rule works, I did wonder about it previously ;)

Which means the error is likely to be the path settings, as it's nearly always the path settings that screw things up ime.

#7530 - col - Thu Jun 19, 2003 11:44 am

depending which version of devkit you are using, you could try creating a folder calld 'bin' in the root of the drive - so
c:\bin
put all the cgg binaries/tools into this folder

cygwin can cause some odd path problems - this step fixed them all for me

and make sure you only have a single instance of cygwin1.dll in your system - if you find extra ones rename them

and you could try using make instead of nmake !

cheers

col

#7536 - Lotus-6 - Thu Jun 19, 2003 4:07 pm

Well, problem solved. I think it did have something to do with the paths... whatever it is, it works now... whee. Now I can display an image, yay XD