Anyone using HEW ???

Well, I have started compiling some examples using GCC (the one downloaded from KPIT) but when I noticed that KPIT also provided a GUI that is very similar to MS Visual C 6.0 (HEW), I downloaded it.

The problem is that I couldn't be able to compile anything. I have started a project and I have also put the correct directories for the compiler and linker phase.

However, after succeeding in the compiler phase (it finds all the *.h)the linker is unable to create an executable. It cannot find the .o and .a archives in the SGL lib directory (well, at least that's what I though after seeing the "unresolved symbol message for all the SEGA related functions).

I tried to add them manually and I got the following message:

Code:
Building - prova - Debug

Phase Compiler starting

Nothing to do - skipping

Phase Compiler finished

Phase Linker starting

sh-coff-ld.exe: warning: cannot find entry symbol _start; defaulting to 00001000

c:\program files\renesas\hew22\tools\kpit cummins\gnush-coff\v0303\sh-coff\sgl\lib\libsgl.a(sglI00.o)(SLSTART+0x24):fake: undefined reference to `main'

Phase Linker finished

Build Finished

1 Error, 1 Warning

Well, any ideas on what to do ?
 
Yes, there are no compiler errors. It's the SEGA2D_1 demo in the sample2 dir.

Here are a couple of screenshots of what I initially did:

compiler.jpg


linker.jpg
 
A linkscript is a set of instructions that tells the linker how the program should be laid out. The startup file contains code that runs before your program, setting up the environment, and after it, cleaning up.

If you don't specify a script and startup file you'll use the GCC default ones, which will be wrong for SGL and the Saturn in general. One set of script/startup files can be found in the "sample\common" directory in the SGL tree.
 
I am not really very used to GCC... In the linker options there is an option called command file in what I think that's where I am supposed to put the script/startup file.

However, HEW says me this:

Code:
ERROR: The GNU linker does not allow you to specify a command file which has any white space in its name.

There is no space in the name of the script/startup file since it's "makefile". I've modified it to what I think it's the correct way:

Code:
#

#  SEGA SATURN Graphic library make file for GNU

# macro

CC = sh-coff-gcc

RM = rm

CONV = sh-coff-objcopy 

# directory

SGLDIR = ../..

SGLIDR = $(SGLDIR)/inc

GCCDIR = ../../../sh-coff

GCCIDR = $(GCCDIR)/include

# option

CCFLAGS = -O2 -m2 -g -c -I$(GCCIDR) -I$(SGLIDR)

DFLAGS = 

# source_program

TARGET  = sl.coff

TARGET1 = sl.bin

LDFILE = $(COMMONDIR)/$(TARGET:.coff=.lnk)

MPFILE  = $(TARGET:.coff=.map)

MAKEFILE = Makefile

cinit.o : cinit.c

.c.o:

	$(CC) $< $(DFLAGS) $(CCFLAGS) -o $@

clean:

	$(RM) cinit.o
 
Originally posted by shinhoshi@Sep 26, 2003 @ 05:38 PM

There is no space in the name of the script/startup file since it's "makefile".

By your earlier posts I guess you've put all files under

Code:
c:\program files\renesas\hew22\tools\kpit cummins\

      ^               ^

I'm not sure what you mean by the rest of your post. You need the linkscript and startup file, not the makefile (which is for building the startup file).
 
Tosh...I see. I thought that HEW had no problem with standard path names...

Now I understand the problem of the space.

I'm not sure what you mean by the rest of your post. You need the linkscript and startup file, not the makefile (which is for building the startup file).

Me neither. It's the first time in my life that I heard about linkscript and startup files. As I told you, I am not very used to GCC. I usually code using Visual 6.0, where you only need to specify the path for include/libs and it makes all the dirty job for you.
 
I've finally understood what's the startup file and what's the linkscript. However, how do I add the linkscript to the linker commands ?
 
There's probably something under the project settings. Was there no documentation included with the IDE package?
 
I have been unable to find it. There is however a text box where you can add options directly.

What would be the command to specify manually the linkscript file ?

I used -xLinker but this appeared:

Building - prova - Debug

Phase Compiler starting

Nothing to do - skipping

Phase Compiler finished

Phase Linker starting

sh-coff-ld.exe:C:\PROGRA~1\Renesas\HEW22\Tools\KPITCU~1\GNUSH-~1\v0303\sh-coff\sgl\sample\common\cinit.o:1: ignoring invalid character `\005' in expression

sh-coff-ld.exe:C:\PROGRA~1\Renesas\HEW22\Tools\KPITCU~1\GNUSH-~1\v0303\sh-coff\sgl\sample\common\cinit.o:1: ignoring invalid character `\000' in expression

sh-coff-ld.exe:C:\PROGRA~1\Renesas\HEW22\Tools\KPITCU~1\GNUSH-~1\v0303\sh-coff\sgl\sample\common\cinit.o:1: ignoring invalid character `\000' in expression

sh-coff-ld.exe:C:\PROGRA~1\Renesas\HEW22\Tools\KPITCU~1\GNUSH-~1\v0303\sh-coff\sgl\sample\common\cinit.o:1: ignoring invalid character `\004' in expression

sh-coff-ld.exe:C:\PROGRA~1\Renesas\HEW22\Tools\KPITCU~1\GNUSH-~1\v0303\sh-coff\sgl\sample\common\cinit.o:1: parse error

Phase Linker finished

Build Finished

5 Errors, 0 Warnings

 
I was doing it wrong. I had to put the linkscript file in the Command file options instead the startup file. Now that I have done it correctly (or at least that's what I think). I have returned to the first error I've had at the beginning.

Code:
...

Phase Linker starting

sh-coff-ld.exe: warning: cannot find entry symbol _start; defaulting to 06004000

C:\Documents and Settings\Ryu\Desktop\prova\prova\Debug\MAIN.o: In function `ss_main':

MAIN.C:63: undefined reference to `slInitSystem'

MAIN.C(.text+0x1bc): undefined reference to `slTVOff'

MAIN.C(.text+0x1c4): undefined reference to `slLocate'

MAIN.C(.text+0x1c8): undefined reference to `slPrint'

...
 
Originally posted by shinhoshi@Sep 26, 2003 @ 07:44 PM

I have been unable to find it.

Going to the source is usually quite instructive.

What would be the command to specify manually the linkscript file ?

"-Tlinkscript". On the compiler command line this should work: "-Xlinker -Tlinkscript". If it doesn't, try "-Xlinker -T -Xlinker linkscript".

I used -xLinker but this appeared:

Building - prova - Debug

(...)

Phase Linker starting

sh-coff-ld.exe:C:\PROGRA~1\Renesas\HEW22\Tools\KPITCU~1\GNUSH-~1\v0303\sh-coff\sgl\sample\common\cinit.o:1: ignoring invalid character `\005' in expression


Yes, well, passing object files as scripts is not expected to work.

Anyway, the error messages you get now show that the startup files and linkscript are set up OK (the ___Start symbol in the linkscript should probably be changed to ___start, though, but the default should work fine). Now it's complaining that it can't find the SGL functions, which means you haven't added the libraries to your project.
 
Thanks antime for the help. However, the libraries (directories+files) are added.

This is the same problem I had in the beginning.
 
Originally posted by shinhoshi@Sep 26, 2003 @ 09:44 PM

However, the libraries (directories+files) are added.

Not correctly, they're not. Otherwise the linker wouldn't complain about not being able to find the functions provided in the libraries, see?

This is the same problem I had in the beginning.

No it's not. The first problem you had was that the linker couldn't find a function called "main". This function is provided in the SGL startup file. Now it's complaining that it can't find the functions "slInitSystem", "slTVOff", "slLocate" and "slPrint". As you can see from the error message, these functions are called from "ss_main", which is your code.

From the error messages you can also see what the link script did. Originally the start address defaulted to 0x00001000, which on a Saturn would be somewhere in the BIOS ROM. Now it's putting the start at 0x06004000, which is near the start of workram-high, after the stacks and vector tables.
 
I had the same problem at the beginning. This "main error" problem was when I added manually all the .a and .o files from the SGL/LIB directory.

The normal thing after seeing the "build lines" would be to think that the lib dir is incorrectly added, but it isn't. I have even added it to the command line(on HEW) by writing -Ldir and the same problem appears.

I've also thought it was a problem of spaces in name again, but even writing them using ~, the same problem happens.
 
Yes, I have also thought that but:

1. Even if I put the SGL directory the first, the same happens.

2. Even if I don't call any startup file, the same happens.

3. The code compiles right using a makefile, it's the SEGA2D_1 example.

This is very strange. It has to be a stupid thing for sure, but right now I am incapable of finding it.

I think I will uninstall HEW and use the standard method, like all the others.
 
The order any directories are listed makes no difference, you have to list the libraries you want to link before your own code. It may be necessary to use the -nostartfiles compiler directive since you're using a custom one (and if you don't use it, your code will never be called).
 
Back
Top