July 25, 2008 Re: GDC on psptoolchain | ||||
---|---|---|---|---|
| ||||
Posted in reply to Vince | Vince wrote: > Hi Kostas, > > I am interested in your PSP port and I would like to add it to my cegdc (gdc for window CE), it could be interesting to have a gcc for embedded targets. > I am working on scripts to build differents versions, something like : > > > sh build-gdc.sh --target psp or > sh build-gdc.sh --target arm-mingw32ce > ... Hi Vince, Personally I don't have a problem. Building, however, the full psp toolchain and sdk for scratch involves many more steps. The method I described is just for rebuilding the toolchain with D support. The difficult work was done the pspdev community. To get idea of what is involved in building the entire toolchain/sdk from scratch have a look at svn://svn.ps2dev.org/psp/trunk/psptoolchain especially the scripts directory. (binutils, gcc stage1, pspsdk stage1, newlib, gcc stage2, psp sdk stage2, etc) However, if you are just interested in making easy for people to build just gdc given a working toolchain, then that's ok. |
July 25, 2008 Re: GDC on psptoolchain | ||||
---|---|---|---|---|
| ||||
Posted in reply to Kostas Karanikolas | Thanks very much. That actually worked and libgphobos.a appeared where it should (in psp next to libiberty, libc++ or whatever).
Are you using garbage collection without calling Phobos's Cmain function? I thought it inits GC with gc_init() so how is that possible?
I wonder if it is possible to write a C-source function wrapper around the PSP_MODULE_MACRO so that one could use a D main function (as normal)?
Kostas Karanikolas wrote:
> John Grindstaff wrote:
>
>> Thanks. How exactly do you compile libgphobos.a for the PSP? I tried it
>> but got errors about missing files. What directory should I be in and
>> what command do I type?
>
> Build instructions
>
> First of all I'm running OSX Leopard on a PowerPC, so what you need to
> do may vary, not by much on a Unix system but potentially a lot on Windows.
>
> I assume you have the latest and complete psp toolchain. If not I
> suggest you try downloading & installing a prebuilt one or preferably
> use the "psptoolchain" build scripts found on:
> svn://svn.ps2dev.org/psp/trunk/psptoolchain
>
> Ok, here we go:
>
> 1. Make a temporary directory for your build
> mkdir pspd
> cd pspd
>
> 2. Setup environment paths
> export PSPDEV=/the/path/where/the/pspsdk/is/already/installed
> export PATH=$PATH:$PSPDEV/bin
>
> # If your native compiler tools are in some extra non standard path
> # also export these variables.
> # In my case I use macports, installed on /opt/local
> export C_INCLUDE_PATH="/opt/local/include"
> export CPLUS_INCLUDE_PATH="/opt/local/include"
> export LIBRARY_PATH="/opt/local/lib"
>
> 3. Download and unpack gcc
> wget --continue ftp://ftp.gnu.org/pub/gnu/gcc/gcc-4.1.0/gcc-4.1.0.tar.bz2
>
> tar -xvjf gcc-4.1.0.tar.bz2
>
> 4. Download and apply psp toolchain patches to gcc
> svn export
> svn://svn.ps2dev.org/psp/trunk/psptoolchain/patches/gcc-4.1.0-PSP.patch
> cd gcc-4.1.0
> patch -p1 <../gcc-4.1.0-PSP.patch
>
> 5. Download and setup gdc
> cd gcc
> # we now must be in directory ...../pspd/gcc-4.1.0/gcc
>
> # Checkout dgcc from svn
> svn co https://dgcc.svn.sourceforge.net/svnroot/dgcc/trunk/d
>
> cd ..
>
> # setup dgcc
> ./gcc/d/setup-gcc.sh --d-language-version=1
>
> 5.5 Optional step, for those compiling GCC under Leopard/PowerPC. Apply a patch to fix some GCC compiler errors
>
> cd gcc/config/rs6000/
> wget "http://trac.macports.org/attachment/ticket/13191/gcc_patch?format=raw" -Oleopard_ppc.patch
> patch -p1 <leopard_ppc.patch
> cd ../../../
>
>
> 6. Configure, build, and install gcc (gdc & libgphobos included)
> # Make a separate build subdirectory
> # we must be ...../pspd/gcc-4.1.0
> mkdir build-psp
> cd build-psp
>
> # Configure GCC
> ../configure --prefix="$PSPDEV" --target="psp" --enable-languages="c,d,c++" --with-newlib --enable-cxx-flags="-G0" --disable-libssp --enable-static --disable-shared
>
> # Compile GCC
> CFLAGS_FOR_TARGET="-G0" make
>
> # Install GCC
> make install
>
> And that should be enough to get a funcional GCC with D/libgphobos
>
> As far as my small libgphobos patch is concerned, I agree that it might not be necessary. However given the temperamental behaviour of the linker (especially when it comes to the order of the PSPSDK libraries) I removed the extra definition of main, to make sure that if no main is declared a linker error would be raised. At any rate it works fine without the change.
>
> Have fun !
>
> Kostas
>
>
> FreekSh0w86 wrote:
>> Oh yeah that's true... I forgot because I made an example without libgphobos but that _would_ interfere. I don't have libgphobos.a compiled yet so I wouldn't know directly. David Friedman wrote:
>>> Assuming the C main() in libgphobos is not actually interfering with the PSP SDK (e.g., duplicate symbols), you do not have to rename it. You can call the following function which exists for exactly this purpose.
>>>
>>> extern (C) int _d_run_Dmain(int argc, char **argv);
>>>
>>> David
>>>
>
>
>
>
|
July 25, 2008 Re: GDC on psptoolchain | ||||
---|---|---|---|---|
| ||||
Posted in reply to John Grindstaff | To clarify, I meant "PSP_MODULE_INFO" macro, and its C wrapper would ideally be built into libgphobos as a patch so that one could write D psp projects without the C source file "glue."
John Grindstaff wrote:
> Thanks very much. That actually worked and libgphobos.a appeared where it should (in psp next to libiberty, libc++ or whatever).
>
> Are you using garbage collection without calling Phobos's Cmain function? I thought it inits GC with gc_init() so how is that possible?
>
> I wonder if it is possible to write a C-source function wrapper around the PSP_MODULE_MACRO so that one could use a D main function (as normal)?
>
> Kostas Karanikolas wrote:
>> John Grindstaff wrote:
>>
>>> Thanks. How exactly do you compile libgphobos.a for the PSP? I tried it
>>> but got errors about missing files. What directory should I be in and
>>> what command do I type?
>>
>> Build instructions
>>
>> First of all I'm running OSX Leopard on a PowerPC, so what you need to
>> do may vary, not by much on a Unix system but potentially a lot on Windows.
>>
>> I assume you have the latest and complete psp toolchain. If not I
>> suggest you try downloading & installing a prebuilt one or preferably
>> use the "psptoolchain" build scripts found on:
>> svn://svn.ps2dev.org/psp/trunk/psptoolchain
>>
>> Ok, here we go:
>>
>> 1. Make a temporary directory for your build
>> mkdir pspd
>> cd pspd
>>
>> 2. Setup environment paths
>> export PSPDEV=/the/path/where/the/pspsdk/is/already/installed
>> export PATH=$PATH:$PSPDEV/bin
>>
>> # If your native compiler tools are in some extra non standard path
>> # also export these variables.
>> # In my case I use macports, installed on /opt/local
>> export C_INCLUDE_PATH="/opt/local/include"
>> export CPLUS_INCLUDE_PATH="/opt/local/include"
>> export LIBRARY_PATH="/opt/local/lib"
>>
>> 3. Download and unpack gcc
>> wget --continue ftp://ftp.gnu.org/pub/gnu/gcc/gcc-4.1.0/gcc-4.1.0.tar.bz2
>>
>> tar -xvjf gcc-4.1.0.tar.bz2
>>
>> 4. Download and apply psp toolchain patches to gcc
>> svn export
>> svn://svn.ps2dev.org/psp/trunk/psptoolchain/patches/gcc-4.1.0-PSP.patch
>> cd gcc-4.1.0
>> patch -p1 <../gcc-4.1.0-PSP.patch
>>
>> 5. Download and setup gdc
>> cd gcc
>> # we now must be in directory ...../pspd/gcc-4.1.0/gcc
>>
>> # Checkout dgcc from svn
>> svn co https://dgcc.svn.sourceforge.net/svnroot/dgcc/trunk/d
>>
>> cd ..
>>
>> # setup dgcc
>> ./gcc/d/setup-gcc.sh --d-language-version=1
>>
>> 5.5 Optional step, for those compiling GCC under Leopard/PowerPC. Apply a patch to fix some GCC compiler errors
>>
>> cd gcc/config/rs6000/
>> wget "http://trac.macports.org/attachment/ticket/13191/gcc_patch?format=raw" -Oleopard_ppc.patch
>> patch -p1 <leopard_ppc.patch
>> cd ../../../
>>
>>
>> 6. Configure, build, and install gcc (gdc & libgphobos included)
>> # Make a separate build subdirectory
>> # we must be ...../pspd/gcc-4.1.0
>> mkdir build-psp
>> cd build-psp
>>
>> # Configure GCC
>> ../configure --prefix="$PSPDEV" --target="psp" --enable-languages="c,d,c++" --with-newlib --enable-cxx-flags="-G0" --disable-libssp --enable-static --disable-shared
>>
>> # Compile GCC
>> CFLAGS_FOR_TARGET="-G0" make
>>
>> # Install GCC
>> make install
>>
>> And that should be enough to get a funcional GCC with D/libgphobos
>>
>> As far as my small libgphobos patch is concerned, I agree that it might not be necessary. However given the temperamental behaviour of the linker (especially when it comes to the order of the PSPSDK libraries) I removed the extra definition of main, to make sure that if no main is declared a linker error would be raised. At any rate it works fine without the change.
>>
>> Have fun !
>>
>> Kostas
>>
>>
>> FreekSh0w86 wrote:
>>> Oh yeah that's true... I forgot because I made an example without libgphobos but that _would_ interfere. I don't have libgphobos.a compiled yet so I wouldn't know directly. David Friedman wrote:
>>>> Assuming the C main() in libgphobos is not actually interfering with the PSP SDK (e.g., duplicate symbols), you do not have to rename it. You can call the following function which exists for exactly this purpose.
>>>>
>>>> extern (C) int _d_run_Dmain(int argc, char **argv);
>>>>
>>>> David
>>>>
>>
>>
>>
>>
|
July 26, 2008 Re: GDC on psptoolchain | ||||
---|---|---|---|---|
| ||||
Posted in reply to David Friedman | On Sun, 20 Jul 2008 03:45:57 +0400, David Friedman <dvdfrdmn@users.ess-eff.net> wrote:
> John Grindstaff wrote:
>> Building GDC for the psptoolchain (as psp-gdc) is it possible? I get compile errors such as this:
>> http://paste.dprogramming.com/dppq5raf
>> Even though I did apply PSP patches and ran d language setup.sh
>> I'm not sure how to patch gdc for PSP use. I like programming on Playstation Portable, but I only desire to return to that scene if I can program in a sensible, modern language such as D.
>>
>
> The latest SVN version has fixes that will allow GDC to build with psptoolchain (and MIPS, in general). I do not have a PSP, so I cannot really test it beyond this.
>
> David
I have official psp-gcc sources (patches to gcc), and since they are covered by GPL I think it's ok to share them. Will it help make better psp-gdc?
|
July 26, 2008 Re: GDC on psptoolchain | ||||
---|---|---|---|---|
| ||||
Posted in reply to Koroskin Denis | GPL allows full sharing as long as you make available the source code of your changes if you release something with it. Thanks to Kostas advice, I am able to use D on GDC and posted an example of a PSP app that uses D's real main function (still with a minor glue C source file). Link: http://forums.qj.net/showthread.php?t=142864 Right now I'm porting all of the PSP SDK's header files to D. I just finished with pspgu.h, look forever with its 1000+ lines but most of it is comments anyway. Koroskin Denis wrote: > On Sun, 20 Jul 2008 03:45:57 +0400, David Friedman <dvdfrdmn@users.ess-eff.net> wrote: > >> John Grindstaff wrote: >>> Building GDC for the psptoolchain (as psp-gdc) is it possible? I get compile errors such as this: >>> http://paste.dprogramming.com/dppq5raf >>> Even though I did apply PSP patches and ran d language setup.sh >>> I'm not sure how to patch gdc for PSP use. I like programming on Playstation Portable, but I only desire to return to that scene if I can program in a sensible, modern language such as D. >>> >> >> The latest SVN version has fixes that will allow GDC to build with psptoolchain (and MIPS, in general). I do not have a PSP, so I cannot really test it beyond this. >> >> David > > I have official psp-gcc sources (patches to gcc), and since they are covered by GPL I think it's ok to share them. Will it help make better psp-gdc? |
July 27, 2008 Re: GDC on psptoolchain | ||||
---|---|---|---|---|
| ||||
Posted in reply to John Grindstaff | I think it's better if the PSP_* macros are maintained in a user .c file that gets compiled along with the user application. For example: pspconfig.c: #include <pspkernel.h> PSP_MODULE_INFO("my-dmodule", 0, 1, 1); PSP_MAIN_THREAD_ATTR(THREAD_ATTR_USER | THREAD_ATTR_VFPU); PSP_HEAP_SIZE_MAX(); Note that no c main function is necessary, just the macros. These declarations do vary per application, and give the option of customizing things (thread attributes, kernel/usermode, heap size configuration, etc.). John Grindstaff wrote: > To clarify, I meant "PSP_MODULE_INFO" macro, and its C wrapper would ideally be built into libgphobos as a patch so that one could write D psp projects without the C source file "glue." > > John Grindstaff wrote: >> Thanks very much. That actually worked and libgphobos.a appeared where it should (in psp next to libiberty, libc++ or whatever). >> >> Are you using garbage collection without calling Phobos's Cmain function? I thought it inits GC with gc_init() so how is that possible? >> >> I wonder if it is possible to write a C-source function wrapper around the PSP_MODULE_MACRO so that one could use a D main function (as normal)? |
July 27, 2008 Re: GDC on psptoolchain | ||||
---|---|---|---|---|
| ||||
Posted in reply to Kostas Karanikolas | That's how I have it setup now, but someone reminded me that GDC actually supports the old gcc-style of inline assembly. So it _may_ actually be possible to port those macros to D after all. I'd rather not try it though, right now I am busy wrestling with png.h trying to convert it to D, but it is the worst C header file I've ever tried to look at...
Kostas Karanikolas wrote:
> I think it's better if the PSP_* macros are maintained in a user .c file that gets compiled along with the user application.
>
> For example:
>
> pspconfig.c:
> #include <pspkernel.h>
> PSP_MODULE_INFO("my-dmodule", 0, 1, 1);
> PSP_MAIN_THREAD_ATTR(THREAD_ATTR_USER | THREAD_ATTR_VFPU);
> PSP_HEAP_SIZE_MAX();
>
> Note that no c main function is necessary, just the macros.
>
> These declarations do vary per application, and give the option of customizing things (thread attributes, kernel/usermode, heap size configuration, etc.).
>
> John Grindstaff wrote:
>> To clarify, I meant "PSP_MODULE_INFO" macro, and its C wrapper would ideally be built into libgphobos as a patch so that one could write D psp projects without the C source file "glue."
>>
>> John Grindstaff wrote:
>>> Thanks very much. That actually worked and libgphobos.a appeared where it should (in psp next to libiberty, libc++ or whatever).
>>>
>>> Are you using garbage collection without calling Phobos's Cmain function? I thought it inits GC with gc_init() so how is that possible?
>>>
>>> I wonder if it is possible to write a C-source function wrapper around the PSP_MODULE_MACRO so that one could use a D main function (as normal)?
|
Copyright © 1999-2021 by the D Language Foundation