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.

Beginners > HAM Compiling problems

#13575 - yaustar - Wed Dec 17, 2003 4:07 am

At the moment I have the lights out program i made which complies fine under DevKitAdv but using HAM it doesnt accept the KEY input. I remember reading something about making them volatile but not 100% sure.
_________________
[Blog] [Portfolio]

#13641 - dagamer34 - Fri Dec 19, 2003 12:27 am

HAM optimizes code with the -O2 flag so you are going to have to declare the registers volatile just like you said.
_________________
Little kids and Playstation 2's don't mix. :(

#13642 - yaustar - Fri Dec 19, 2003 2:27 am

All registers or just the keyboarad/pad?
_________________
[Blog] [Portfolio]

#13643 - poslundc - Fri Dec 19, 2003 3:15 am

Generally if you are checking or altering the same variable/register/memory location multiple times (either in a loop or in a single block of code) and that variable is not used between those statements, you should declare it volatile if you have optimizations turned on.

Dan.

#13646 - yaustar - Fri Dec 19, 2003 11:30 am

With HAM can I turn it off?
_________________
[Blog] [Portfolio]

#13648 - sajiimori - Fri Dec 19, 2003 6:24 pm

Why don't you try reading the documentation?

http://www.ngine.de/site/hamdoc/faq.html

At first glance, HAM seems to use a master makefile (system/master.mak) that's shared between all projects. Edit that to change optimization flags.

#14647 - yaustar - Sat Jan 10, 2004 3:46 am

sorry, but I am not too big on mak files.
I am guessing to change
Code:

# Enable GDB symbol support, optional. This will also reduce
# optimization levels to allow correct in-source debugging
ifeq ($(HAMLIBCOMPILE),1)
else
ifeq ($(MAKECMDGOALS),gdb)
HAM_CFLAGS += -O0 -g
else
HAM_CFLAGS += -O2
endif
endif


to
Code:

# Enable GDB symbol support, optional. This will also reduce
# optimization levels to allow correct in-source debugging
ifeq ($(HAMLIBCOMPILE),1)
else
ifeq ($(MAKECMDGOALS),gdb)
HAM_CFLAGS += -o -g
else
HAM_CFLAGS += -O2
endif
endif


it also seems to say something about a switch to to go from one optimisation but I cant see it in the mak file...

here is the output from the compiling if it helps
Code:

C:/HamDevKit/gcc-arm/bin/arm-thumb-elf-gcc.exe  -I C:/HamDevKit/gcc-arm/include -I C:/HamDevKit/gcc-arm/arm-thumb-elf/include -I C:/HamDevKit/include -I C:/HamDevKit/system  -c -DHAM_HAM  -DHAM_MULTIBOOT  -DHAM_ENABLE_MBV2LIB -O2 -DHAM_WITH_LIBHAM  -mthumb-interwork -mlong-calls -Wall -save-temps -fverbose-asm -nostartfiles main.cpp -o main.o
C:/HamDevKit/gcc-arm/bin/arm-thumb-elf-gcc.exe  -I C:/HamDevKit/gcc-arm/include -I C:/HamDevKit/gcc-arm/arm-thumb-elf/include -I C:/HamDevKit/include -I C:/HamDevKit/system  -c -DHAM_HAM  -DHAM_MULTIBOOT  -DHAM_ENABLE_MBV2LIB -O2 -DHAM_WITH_LIBHAM  -mthumb-interwork -mlong-calls -Wall -save-temps -fverbose-asm -nostartfiles bg.cpp -o bg.o
C:/HamDevKit/gcc-arm/bin/arm-thumb-elf-ld.exe    -L C:/HamDevKit/gcc-arm/lib/gcc-lib/arm-thumb-elf/3.3.2/interwork -L C:/HamDevKit/gcc-arm/lib/gcc-lib/arm-thumb-elf/3.3.2 -L C:/HamDevKit/gcc-arm/arm-thumb-elf/lib/interwork -L C:/HamDevKit/gcc-arm/arm-thumb-elf/lib -L C:/HamDevKit/gcc-arm/lib  --script C:/HamDevKit/system/lnkscript-afm -o LightsOut.elf crt0.o main.o bg.o    -lafm -lham -lm -lstdc++ -lsupc++ -lgcc -lc -lgcc
C:/HamDevKit/gcc-arm/bin/arm-thumb-elf-objcopy.exe  -v -O binary LightsOut.elf LightsOut.gba 
copy from LightsOut.elf(elf32-littlearm) to LightsOut.gba(binary)
------------------------------------------------------------------
 HAM Win32 installation information:
 
 HAM version:        2.8 in C:/HamDevKit
 GCC/GDB version:    3.3.2 / 6.0
 Newlib/Binutils:    1.11.0 / 2.14
 Krawall ena/regged: no / no
------------------------------------------------------------------
C:/HamDevKit/tools/win32/rm -f *.o *.i *.ii

_________________
[Blog] [Portfolio]