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.

Coding > VISUAL HAM

#75062 - Lightning-Adnan - Thu Mar 09, 2006 10:01 pm

I have a problem ??
I am from Germany and i dont can speak ( good ) the English language , but my really problem is that -
When i start VISUAL HAM i go to make new file and than i choose [C++] empty , and than i delete the main.cpp and copy my source code to this .cpp than i click F7 , but he ( the compiler ) dont want compile .
Where is my problem ??

My code ( i am a n00b )
Code:

#include <mygba.h>

// Startfunktion. Wie in C++
int main()
{
    // Initialisieren von HAM. Wird gebraucht und muss immer die erste       
    // Funktion in einem HAM-Programm sein.
    ham_Init();

    // Initialisieren der Textfunktionen. Die 0 gibt die Hintergrund-
    // ebene an. Diese Funktion funktioniert nur in den Grafikmodi 0-2!
    // Moduswahl je nach Hintergrundebenennummer; m?gliche angaben: 0-3.
    ham_InitText(0);

    // Hier malen wir letzendlich unseren Text auf den Gameboy-Screen.
    // Der erste Parameter gibt den x-; der zweite den y-Wert des ersten
    // Buchstaben an. M?glich sind horizontal 0-29 und vertikal 0-19
    // Am besten etwas mit rumprobieren, dann sieht mans selbst.
    ham_DrawText(9,9,"Hallo, Welt!");

    // Diese Schleife sorgt daf?r, dass das Programm nicht immer Endet
    // und dann neustartet. Man „f?ngt“ den GBA quasi in dieser Endlos-
    // schleife, damit er sch?n immer unseren Text anzeigt.
    // Interaktivit?t? Kommt alles in diese Hauptschleife. Haben wir nur
    // noch nicht.
    while(1) {}

   // Na, was wohl ? :-)
   return 0;
}


It is a german language from the german tutorial !! :)

I go to many german pages , and they say it is a compiler error , but i dont think that.
This forum is a professional forum and i think you can help me .
Thanks

Lightning-Adnan

#75069 - sumiguchi - Thu Mar 09, 2006 11:15 pm

I followed your instructions:
> created a new C++ project empty
> deleted everything and copied your code
> hit F7

No problem - compiled and VBA started up with your text message. So, I think you have an environment problem.

Take a look in Visual Ham > Advanced > Options > Environment
Do you have a setting for HAMDIR and for PATH?
Mine are set as follows:
Code:
HAMDIR c:\ham
PATH %HAMDIR%\gcc-arm\bin;%HAMDIR%\tools\win32;%VHAM_BIN%;%PATH%

if this looks ok, then maybe you can provide the output of the compiler when you try to compile.

Hope it helps/sumiguchi

#75121 - Lightning-Adnan - Fri Mar 10, 2006 8:05 am

Yes i have all this exceptions
Code:

HAMDIR c:\ham
PATH %HAMDIR%\gcc-arm\bin;%HAMDIR%\tools\win32;%VHAM_BIN%;%PATH%

but I have and a thirt ( 3 ) :
Code:

HAMDIR c:\ham
PATH %HAMDIR%\gcc-arm\bin;%HAMDIR%\tools\win32;%VHAM_BIN%;%PATH%
MAKE_MODE unix


Where is my problem ?
Must I delete the third or what ?

PLEASE HELP ME

#75155 - sumiguchi - Fri Mar 10, 2006 3:51 pm

MAKE_MOD unix should be ok (i have that too.)

What is the output of the compiler?

BTW: there is a forum specifically for HAM here: http://forums.ngine.de/index.php

#75161 - Lightning-Adnan - Fri Mar 10, 2006 5:15 pm

What is a output file of a compiler ?

And ever when i pressed F7 , than comes this :
error make.exe

What is that ?
PLEASE HELP

#75162 - sumiguchi - Fri Mar 10, 2006 5:41 pm

In Visual HAM, there is a window along the bottom - which is likely where you see "Error make" - this is the compiler output.

Since you get Error make - I still think you have a configuration issue. The environment you checked - needs to match the paths you have on your system.

Is there a file called make.exe in c:\ham\tools\win32 on your machine?

If not - where is make.exe?

#75225 - gmiller - Sat Mar 11, 2006 3:16 am

The visual ham development system ASSUMES that the make.exe is located in the %HAMDIR%/tools/win32 folder. If this is not the case then the F5 key will not be able to find the make utility to compile the program. Now I am assuming that you make sure your project has the files in it makes as files to compile or nothing will be compiles by the makefile in the project. You can check your path variable by trying the command prompt selectin from the external tools area of the IDE.

I have just converted over to using the devkitPro/DevkitARM tool kit with Visual HAM because I could not get consistant results debugging with the VHAM tool set. I took the template make file from the devkitPro/exmaples/gba/template folder and modified it to work with VHAM. I also created a customized msys.bat startup batch stream to allow me to get to the %HAM_CURPROJECT% directory as an external tool. I found some problems using the insight debugger with VHAM that I could not discover. But I did find that running from the msys prompt that I could get fairly consistant results. Should anyone want to see what I did I will post changes I made.

#76281 - gmiller - Mon Mar 20, 2006 3:31 am

Here is my current makefile for using the devkitPro stuff for GBA development.

Code:

#---------------------------------------------------------------------------------
# Clear the implicit built in rules
#---------------------------------------------------------------------------------
.SUFFIXES:
#---------------------------------------------------------------------------------
ifeq ($(strip $(DEVKITARM)),)
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM)
endif

-include $(DEVKITARM)/gba_rules

#---------------------------------------------------------------------------------
# TARGET is the name of the output, if this ends with _mb a multiboot image is generated
# BUILD is the directory where object files & intermediate files will be placed
# SOURCES is a list of directories containing source code
# DATA is a list of directories containing data files
# INCLUDES is a list of directories containing header files
#---------------------------------------------------------------------------------
# HAM Stuff no longer used ....
#
#PROGNAME =unused
#OFILES+= unused
#ADD_LIBS+= unused   

# .................
#

TARGET      :=   $(shell basename $(CURDIR))
BUILD      :=   build
SOURCES      :=   source
DATA      :=   
INCLUDES   :=   $(DEVKITARM)
GDB_DIRS   =    $cdir:$cwd:$(ADD_GDB_SOURCE_DIRS)

ifeq ($(MAKECMDGOALS),gdb)
DEBUG_SET   :=   gdb
endif

#---------------------------------------------------------------------------------
# options for code generation
#---------------------------------------------------------------------------------
#ARCH   :=   -mthumb -mthumb-interwork
ARCH   :=   -marm -mthumb-interwork

ifneq ($(DEBUG_SET),gdb)
THIS_BUILD   :=   "Release Build"
CFLAGS   :=   -Wall -O3\
         -mcpu=arm7tdmi -mtune=arm7tdmi\
          -fomit-frame-pointer\
         -ffast-math \
         $(ARCH)
else
THIS_BUILD   :=   "Debug Build"
CFLAGS   :=   -g -Wall -O0\
         -mcpu=arm7tdmi -mtune=arm7tdmi\
         -ffast-math \
         $(ARCH)
endif
CFLAGS   +=   $(INCLUDE)

ASFLAGS   :=   $(ARCH)

ifneq ($(DEBUG_SET),gdb)
LDFLAGS   =   $(ARCH) -Wl,-Map,$(notdir $@).map
else
LDFLAGS   =   -g $(ARCH) -Wl,-Map,$(notdir $@).map
endif

#---------------------------------------------------------------------------------
# path to tools - this can be deleted if you set the path to the toolchain in windows
#---------------------------------------------------------------------------------
export PATH      :=   $(DEVKITARM)/bin:$(DEVKITPRO)/msys/bin:$(PATH)

#---------------------------------------------------------------------------------
# any extra libraries we wish to link with the project
#---------------------------------------------------------------------------------
LIBS   :=   -lgba

#---------------------------------------------------------------------------------
# list of directories containing libraries, this must be the top level containing
# include and lib
#---------------------------------------------------------------------------------
LIBDIRS   :=   $(LIBGBA)

#---------------------------------------------------------------------------------
# no real need to edit anything past this point unless you need to add additional
# rules for different file extensions
#---------------------------------------------------------------------------------
ifneq ($(BUILD),$(notdir $(CURDIR)))
#---------------------------------------------------------------------------------

export OUTPUT   :=   $(CURDIR)/$(TARGET)
export VPATH   :=   $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
               $(foreach dir,$(DATA),$(CURDIR)/$(dir))

export DEPSDIR   :=   $(CURDIR)/$(BUILD)

#---------------------------------------------------------------------------------
# automatically build a list of object files for our project
#---------------------------------------------------------------------------------
CFILES      :=   $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
CPPFILES   :=   $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
SFILES      :=   $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
BINFILES   :=   $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))

#---------------------------------------------------------------------------------
# use CXX for linking C++ projects, CC for standard C
#---------------------------------------------------------------------------------
ifeq ($(strip $(CPPFILES)),)
#---------------------------------------------------------------------------------
   export LD   :=   $(CC)
#---------------------------------------------------------------------------------
else
#---------------------------------------------------------------------------------
   export LD   :=   $(CXX)
#---------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------

export OFILES   := $(addsuffix .o,$(BINFILES)) $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)

#---------------------------------------------------------------------------------
# build a list of include paths
#---------------------------------------------------------------------------------
export INCLUDE   :=   $(foreach dir,$(INCLUDES),-I$(dir)/include) \
               $(foreach dir,$(LIBDIRS),-I$(dir)/include) \
               $(foreach dir,$(CURDIR), -I$(dir)/include) \
               -I$(CURDIR)

#---------------------------------------------------------------------------------
# build a list of library paths
#---------------------------------------------------------------------------------
export LIBPATHS   :=   $(foreach dir,$(LIBDIRS),-L$(dir)/lib)

.PHONY: $(BUILD) clean

#---------------------------------------------------------------------------------
$(BUILD):
   @[ -d $@ ] || mkdir -p $@
   make "DEBUG_SET=$(DEBUG_SET)" --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile

all   : buildtype $(BUILD)

buildtype:
   @echo "Build type: " $(THIS_BUILD)

#---------------------------------------------------------------------------------
clean:
   @echo clean ...
   rm -fr $(BUILD) $(TARGET).elf $(TARGET).gba

#---------------------------------------------------------------------------------
vbawin:   clean all
   $(DEVKITPRO)/tools/win32/vbawin.exe $(TARGET).gba

#---------------------------------------------------------------------------------
runvbawin:
   $(DEVKITPRO)/tools/win32/vbawin.exe $(TARGET).gba

#---------------------------------------------------------------------------------
vba:   clean all
   $(DEVKITPRO)/tools/win32/vbaSDL/vba.exe -3 $(TARGET).gba

#---------------------------------------------------------------------------------
runvba:
   $(DEVKITPRO)/tools/win32/vbaSDL/vba.exe -3 $(TARGET).gba

#---------------------------------------------------------------------------------
startsdl:
   $(DEVKITPRO)/tools/win32/vbaSDL/vba.exe -3 -Gtcp:44444 &

#---------------------------------------------------------------------------------
makeini:
   echo "File $(TARGET).elf" > insight.ini
   echo "target remote 127.0.0.1:44444" >>insight.ini
   echo "load $(TARGET).elf" >>insight.ini
   echo "b main" >>insight.ini
   echo "directory $(GDB_DIRS)">>insight.ini
   echo "c" >>insight.ini

#---------------------------------------------------------------------------------
startinsight:
   $(DEVKITPRO)/insight/insight-6.4.50/bin/arm-elf-insight.exe --command=insight.ini $(TARGET).elf

#---------------------------------------------------------------------------------
gdb:   clean
   @make "DEBUG_SET=$(DEBUG_SET)" all
   make startsdl makeini startinsight

#---------------------------------------------------------------------------------
rungdb: startsdl makeini startinsight

testinsight: makeini startinsight

#---------------------------------------------------------------------------------
else

DEPENDS   :=   $(OFILES:.o=.d)

#---------------------------------------------------------------------------------
# main targets
#---------------------------------------------------------------------------------
$(OUTPUT).gba   :   $(OUTPUT).elf

$(OUTPUT).elf   :   $(OFILES)

%.o   :   %.pcx
   echo $(notdir $<)
   $(bin2o)

-include $(DEPENDS)

#---------------------------------------------------------------------------------
endif
#--------------------------------------------------------------------------------