How do I get the KPIT Compiler?

slinga

Established Member
Hey guys,

I submitted my email for request to download the KPIT compiler from: http://www.kpitgnutools.com/, a while ago. I still haven't heard from them back. If it's free software, why do they have to preapprove everybody who downloads it? Is this even the right place to get the compiler? Also what does Antime mean when he refers to "tool chain" on his site?

I'm asking all this stuff because I have the rough outline of my guide to newbs done, but I was waiting to get the KPIT compiler before I started to write up the technical stuff. A lot of the devers have said that the Sega compiler should be avoided so I wanted to have the guide explaining how to install and use the new KPIT compiler (something which obviously I have no idea how to do yet). Thanks in advance.
 
They offer a good service for free (precompiled, tested compilers and free technical support), so asking for the users to register isn't a completely unreasonable request. Installing is easy, as it comes packaged in a installer - just run it and click "ok" a few times. The only thing you may want to modify is the install location, as the default location makes all paths (in makefiles etc.) unnecessarily long. The installer also adds a shortcut so you get a command-line window with everything set up to run the compiler from. You can then use TakaIsSilly's guide to get SGL working.

It's a toolchain because it's more than just the compiler. GCC just creates assembly-language output files, you need at least an assembler and a linker (from binutils) to make anything useful. The third major component that's included is the Newlib embedded C library.
 
If it's free software, why do they have to preapprove everybody who downloads it?

It's their decision whether or not to distribute and to whom to distribute; the GPL basically only says that people who get binaries are entitled to source, and to the freedom to further modify and redistribute the software. It does not require that distribution be to the public, nor that it be not-for-profit. I could write a super-optimizing version of GCC and charge $50,000 a copy for it if I wanted to and it would be completely legal, but the first person I sell it to could decide to put it on his website for public download and that would be completely legal too. This balance of freedom is what Free Software is all about.

Also what does Antime mean when he refers to "tool chain" on his site?

A "tool chain" refers to a core set of tools used to turn source code into executable code. Often people just say "compiler", but a tool chain typically consists of three different programs - a compiler (to convert high-level languages to assembly language), an assembler (to convert assembly language to object code) and a linker (to combine program code with library routines into a final executable format), and these programs may operate and be maintained independently. The GNU tool chain consists primarily of GCC, GNU as, and GNU ld. The former is considered an independent project, while the latter two are part of the GNU binutils package, which contains various other build-related utilities.
 
Thanks for your fast responses.

I got a reply on my school email address last night (favor university addresses over yahoo addresses??) with the login information. I'm not sure which file I need to download though, is it "GNUSH v0303 Windows Tool Chain (COFF) - 2nd Rel.", "GNUSH v0304 Windows Tool Chain (COFF)" or something else? (I'm assuming SH stands for the same thing as SH in SH2 could be completely wrong though, oh well time for guess and check...)
 
v0304 is the latest release as of writing so I suggest you get that one. If you intend to use the SGL or SBL libraries get the COFF version. Don't download the GNUH8 toolchain, it's for Renesas' H8 series microcontrollers.
 
Hey guys,

I've been at it for a while, I'm still stuck. I installed “GNUSH v0304 Windows Tool Chain (COFF)” to D:\satprog\GNUSHv0304-COFF. I then installed SGL302j to d:\satprog\GNUSHv0304-COFF\sh-coff\sgl. I then modified the gnu bat file so it's now as follows:

@Echo Off

Set PATH=d:\satprog\GNUSHV~1\sh-coff\bin;d:\satprog\GNUSHV~1\OtherU~1;%PATH%

Set C_INCLUDE_PATH=d:\satprog\GNUSHV~1\sh-coff\include;d:\satprog\GNUSHV~1\sh-coff\SGL\inc

Set CPLUS_INCLUDE_PATH=d:\satprog\GNUSHV~1\sh-coff\include\cxx;d:\satprog\GNUSHV~1\sh-coff\include;d:\satprog\GNUSHV~1\sh-coff\SGL\inc

Set MAKE_MODE=unix

Cmd "cd\" /k


When I try and compile code in the SGL\Samples directory, I get an error saying there's no targets to make. If I try to manually specify it to compile (sh-coff-gcc), I messages saying that there are errors in the SGL header files.

D:\satprog\GNUSHv0304-COFF\sh-coff\SGL\SAMPLE2\SEGA2D_1>make

make: *** No targets specified and no makefile found. Stop.

D:\satprog\GNUSHv0304-COFF\sh-coff\SGL\SAMPLE2\SEGA2D_1>sh-coff-gcc main.c

In file included from d:/satprog/GNUSHV~1/sh-coff/SGL/inc/sgl.h:4,

from main.c:1:

d:/satprog/GNUSHV~1/sh-coff/SGL/inc/machine.h:55: error: stray '\32' in program

In file included from d:/satprog/GNUSHV~1/sh-coff/SGL/inc/sgl.h:5,

from main.c:1:

d:/satprog/GNUSHV~1/sh-coff/SGL/inc/sl_def.h:1904: error: stray '\32' in program

In file included from main.c:1:

d:/satprog/GNUSHV~1/sh-coff/SGL/inc/sgl.h:58: error: stray '\32' in program

In file included from d:/satprog/GNUSHV~1/sh-coff/SGL/inc/sega_sys.h:104,

from main.c:2:

d:/satprog/GNUSHV~1/sh-coff/SGL/inc/sega_xpt.h:83: error: stray '\32' in program

In file included from main.c:2:

d:/satprog/GNUSHV~1/sh-coff/SGL/inc/sega_sys.h:155: error: stray '\32' in progra

m

In file included from main.c:4:

sega2d.h:9: error: stray '\32' in program

In file included from main.c:4:

sega2d.h:9:2: warning: no newline at end of file

main.c:67: error: stray '\32' in program

main.c:67:2: warning: no newline at end of file

D:\satprog\GNUSHv0304-COFF\sh-coff\SGL\SAMPLE2\SEGA2D_1>


For all it's bloatware visual studio's looking mighty sweet right now...any idea what I'm doing wrong? If it's giving me errors in the header file, I'm guessing I set up the paths correctly, I'm guessing I'm missing a step somewhere.
 
Try installing ExCyber's cleaned SGL version, the old one has several DOS-isms that don't work anymore (the default makefile must be named "Makefile", try "make -f MAKEFILE" instead, and C spec states that source files must end in a newline which is why you get the errors in the header files. There's probably a compiler switch to get rid of the error, check the docs.)

Finally, I'd strongly advise against installing the libs under the compiler's directories. That's one of the things that's bound to give you troubles sooner or later.
 
Hey Antime,

I'm still at it. I've installed ExCyber's SGL to D:\satprog\sgl, and I have the compiler in D:\satprog\GNUSHv0304-COFF. I modified the compiler's environment variables, and it seems to working. I also made the modifications that Takashi said to in the makefile in the Common directory. When I try to make something the Common directory I get this output:

D:\satprog\sgl\sample\common>make

sh-coff-gcc cinit.c -O2 -m2 -g -c -I../../../gccsh/include -I../../inc -o cinit

.o

cinit.c: In function `main':

cinit.c:18: warning: return type of `main' is not `int'


The *.o file is created, but no sl.bin.

If I try to make something in another directory I get this error:

D:\satprog\sgl\sample\torus2>make

make: *** No rule to make target `/home/excyber/local/sh-elf/sgl/lib/sglarea.o',

needed by `sl.coff'. Stop.


Any idea what I'm doing wrong? Thanks in advance, and sorry for bugging you so much.

No wait I think I got it...needed to modify the makefile.template file...seems to be creating a .bin now...

Edit #2: Still lost. It's definitely a problem with my makefiles though.
 
No rule to make target `/home/excyber/local/sh-elf/sgl/lib/sglarea.o',

Oops? I dunno, I thought I wrapped all those paths in informative #ifdef / #error bits, but maybe one slipped through somehow; the release was slightly in haste. Make sure that SGLDIR/SGLIDR/SGLLDR are set correctly in the main Makefile.template.

edit: D'oh! Didn't see your edit. What's the output from a build process now?
 
I made a new directory, D:\satprog\myproj. In myProj I copied over the common directory from the samples directory, and modified the makefile. I also copied over the makefile.template file, and made some changes to it. I then copied over one of the directories from the samples folder, and modified it to run a simple test code, it works fine now. Hopefully my results will be repeatable tomorrow 😛

D:\satprog\myProj\Test>make

sh-coff-gcc main.c -O2 -m2 -g -c -Id:/satprog/sgl/inc -o main.o

main.c:18:2: warning: no newline at end of file

sh-coff-gcc -m2 -Ld:/satprog/sgl/lib -Xlinker --strip-debug -Xlinker --format=co

ff-sh -Xlinker -T../common/sl.lnk -Xlinker -Map -Xlinker sl.map -Xlinker -e -Xli

nker ___Start -nostartfiles ../common/cinit.o d:/satprog/sgl/lib/sglarea.o main.

o -lcd -lsgl -o sl.coff

sh-coff-objcopy -O binary sl.coff sl.bin


I'll hopefully have the first portion of the guide (installing KPIT Compiler + SGL) ready by tomorrow.
 
Back
Top