WIP updated homebrew toolchain for PS2

Discussion in 'General PS2 Discussion' started by uyjulian, Aug 25, 2018.

  1. 250
    457
    122
    uyjulian

    uyjulian Developer

    Joined:
    May 27, 2017
    Messages:
    250
    Likes Received:
    457
    Trophy Points:
    122
    Gender:
    Male
    The new WIP toolchain uses n32 ABI and newer versions of GCC and Binutils. However, since it is a work in progress, it has issues in some circumstances, so it is not upstream.
    Progress is being made on the "ps2max" group on GitLab SaaS.

    1. Remove your old PS2DEV/PS2SDK/GSKIT etc variables.
    2. Open a NEW terminal session (after removing the variables).
    3.
    Code:
    mkdir ps2dev-newtoolchain
    cd ps2dev-newtoolchain
    repo init -u https://gitlab.com/ps2max/ps2dev-repo.git -b ee-toolchain-gcc9 --depth=1
    repo sync -j12 -c --no-tags
    source ./envsetup.sh
    nice -n19 bash ./build-all.sh
    
    Do you get "command not found", "library not found", etc. errors? Install the respective dependency.
    Programs need to be fixed to compile and run using the new toolchain.
    The new toolchain also has issues in some circumstances.

    If you need something that is known to work, use the old toolchain: https://github.com/ps2dev/ps2dev
     
    Last edited: Jun 9, 2020
  2. 250
    457
    122
    uyjulian

    uyjulian Developer

    Joined:
    May 27, 2017
    Messages:
    250
    Likes Received:
    457
    Trophy Points:
    122
    Gender:
    Male
    Here's what will probably happen: EE will be held back at binutils 2.25.1 and GCC 6.3.0, while the IOP toolchain will be continuously updated to latest binutils and GCC combos. I'm not well-versed in binutils and GCC changes, so I'll leave it at that.

    Someone is working on a LLVM/Clang toolchain for the EE.

    If you need assistance with this toolchain, feel free to pop open #psugnd on freenode.

    Here's what already happened: EE and DVP will be held back at binutils 2.25.1, but the rest will be using latest GCC and binutils. It works so far.
     
    Last edited: Sep 9, 2018
    TnA and STLcardsWS like this.
  3. 250
    457
    122
    uyjulian

    uyjulian Developer

    Joined:
    May 27, 2017
    Messages:
    250
    Likes Received:
    457
    Trophy Points:
    122
    Gender:
    Male
    gsKit has been updated and fixed.
     
    TnA likes this.
  4. 1,594
    897
    222
    TnA

    TnA Moderator

    Joined:
    Jul 1, 2018
    Messages:
    1,594
    Likes Received:
    897
    Trophy Points:
    222
    Gender:
    Male
    Location:
    Germany --> Saxony
    gskit works? Interesting!

    Does any project compile on it 'right out of the box'?
     
  5. 250
    457
    122
    uyjulian

    uyjulian Developer

    Joined:
    May 27, 2017
    Messages:
    250
    Likes Received:
    457
    Trophy Points:
    122
    Gender:
    Male
    No, you have to change the makefile to point it to the new toolchain, and you have to fix any errors (example: wrong l-value assignment)
     
    TnA likes this.
  6. 250
    457
    122
    uyjulian

    uyjulian Developer

    Joined:
    May 27, 2017
    Messages:
    250
    Likes Received:
    457
    Trophy Points:
    122
    Gender:
    Male
    I'm working on patches for upstream ps2sdk and ps2toolchain that will cleanup the code and merge some newlib changes. This will reduce the amount of non-upstreamed code in my branch.
     
  7. 250
    457
    122
    uyjulian

    uyjulian Developer

    Joined:
    May 27, 2017
    Messages:
    250
    Likes Received:
    457
    Trophy Points:
    122
    Gender:
    Male
    GCC 9 will transition to bugfixes on November 11 and regression fixes and documentation fixes on January 6.

    Binutils 2.31.1 has been released a while back, and I'm planning to update to that version.

    I need to fix gsKit so all the samples will work properly. The hires sample complied with my toolchain will error on my PS2 TOOL for some reason.
    I should eventually upstream the working patches, and fix the old patches that differ from upstream.

    libc-test: https://github.com/AssemblyScript/libc-test
    Information about the GCC C unit test suite: https://gcc.gnu.org/onlinedocs/gccint/C-Tests.html
     
    Last edited: Nov 12, 2018
    akuhak, Anonamous, klx and 3 others like this.
  8. 250
    457
    122
    uyjulian

    uyjulian Developer

    Joined:
    May 27, 2017
    Messages:
    250
    Likes Received:
    457
    Trophy Points:
    122
    Gender:
    Male
    I updated gsKit and PS2SDK. The samples I tried work in PCSX2, but I haven't tested on a real PS2 yet.

    GCC 9 is in the stabilization phrase (Stage 4). I won't touch my toolchain fork (update Binutils or GCC) until GCC 9.1 is released.

    fileXioInit seems to hang. I need to figure out why.
     
    Last edited: Feb 17, 2019
    Anonamous, TnA, jolek and 1 other person like this.
  9. 67
    20
    37
    Anonamous

    Anonamous Member

    Joined:
    Aug 26, 2018
    Messages:
    67
    Likes Received:
    20
    Trophy Points:
    37
    Occupation:
    Electrical Engineering Student
    Doh, that explains it. I thought it was something I was doing wrong lol. If I remember correctly from yesterday it's gets stuck in an infinite loop on the call to SifBindRpc. res = 0
     
    akuhak and TnA like this.
  10. 77
    124
    82
    akuhak

    akuhak Developer

    Joined:
    Jul 4, 2017
    Messages:
    77
    Likes Received:
    124
    Trophy Points:
    82
    @uyjulian
    1. Is it possible to port these changes into your fork? commit1 and commit2 .
    This will allow you to get rid of lc, lm and crt0. Example
    Some projects are already moved to simplified make flags and sometimes it is difficult to get these flags back.
    I was trying to port these changes by myself but failed... Something goes wrong.

    2. I made tests with different GCC version and unfortunately only GCC v6 (and v5) is working stuff for me. I was testing fceumm-ps2 stuff with travis matrix and precompiled docker images (link for travis output). I can confirm that ps2sdk samples and gsKit samples are working in all GCC versions (v5, v6, v7, v8) but fceumm-ps2 is working only with gcc5 and gcc6. I also tested different versions of newlib - it seems this is not source of problem.
     
  11. 250
    457
    122
    uyjulian

    uyjulian Developer

    Joined:
    May 27, 2017
    Messages:
    250
    Likes Received:
    457
    Trophy Points:
    122
    Gender:
    Male
    @akuhak
    1. Yes, it is possible.
    2. If you can give me an isolated test case, it would help immensely.
     
  12. 77
    124
    82
    akuhak

    akuhak Developer

    Joined:
    Jul 4, 2017
    Messages:
    77
    Likes Received:
    124
    Trophy Points:
    82
    @uyjulian
    Now transfer.sh is dead so it is more difficult to proceed tests. I can only post here results of my isolated tests.
    1) I realised that fceumm-ps2 doesn't work work when binutils 2.25.1 are mixing with binutils 2.31. So my first step I left only 2.25.1 Anyway it is better not to mix different versions
    2) I created special branch for isolated testing: https://github.com/AKuHAK/ps2toolchain/tree/new_gcc_teset_all_in_one. Added 3 environment variables for easy switch between versions.
    Code:
    ENV BINUTILS_VERSION 2.25.1
    ENV GCC_VERSION 6.3.0
    ENV NEWLIB_VERSION 3.0.0
    3) Created ps2sdk fork adopted for newest toolchain and based on up-to-date ps2sdk: https://github.com/ps2homebrew/ps2sdk/tree/test1
    3) I created various docker images based on this branch. It takes really long time - almost whole day until all images were built.
    4) I tested my gsKit fork adopted for newest toolchain. All docker images were fine - all samples (except hires) were working fine. https://github.com/AKuHAK/gsKit/tree/patch-5
    4) Then I created travis matrix for testing all images. Each image compiled working elf file. But some elf files failed to show main menu.
    5) After tests I confirmed that binutils should be 2.25.1 only, GCC version should be less then v7, newlib can be any version.
     
    Anonamous, uyjulian and TnA like this.
  13. 67
    20
    37
    Anonamous

    Anonamous Member

    Joined:
    Aug 26, 2018
    Messages:
    67
    Likes Received:
    20
    Trophy Points:
    37
    Occupation:
    Electrical Engineering Student
    So for clarity, is the move to gcc 9.1 still planned or will it be reverted to pre 7?
     
  14. 250
    457
    122
    uyjulian

    uyjulian Developer

    Joined:
    May 27, 2017
    Messages:
    250
    Likes Received:
    457
    Trophy Points:
    122
    Gender:
    Male
    Still planned
     
    TnA and Anonamous like this.
  15. 67
    20
    37
    Anonamous

    Anonamous Member

    Joined:
    Aug 26, 2018
    Messages:
    67
    Likes Received:
    20
    Trophy Points:
    37
    Occupation:
    Electrical Engineering Student
    Don't kill yourself with too much lol. I'll be around over the summer to help out.
     
  16. 250
    457
    122
    uyjulian

    uyjulian Developer

    Joined:
    May 27, 2017
    Messages:
    250
    Likes Received:
    457
    Trophy Points:
    122
    Gender:
    Male
    GCC 9.1 is out. I'm going to see how much has changed.
     
    TnA, jolek and Anonamous like this.
  17. 250
    457
    122
    uyjulian

    uyjulian Developer

    Joined:
    May 27, 2017
    Messages:
    250
    Likes Received:
    457
    Trophy Points:
    122
    Gender:
    Male
    I've rebased on top of binutils 2.32/gcc 9.1.0/newlib 3.1.0. In the process, I removed the EE core extension/MMI patches and DVP support temporarily.

    IOP modules are not working correctly. I need to figure out why.
     
    Last edited: May 28, 2019
    TnA, akuhak and jolek like this.
  18. 250
    457
    122
    uyjulian

    uyjulian Developer

    Joined:
    May 27, 2017
    Messages:
    250
    Likes Received:
    457
    Trophy Points:
    122
    Gender:
    Male
    IOP module problem was fixed by downgrading to binutils 2.31.1. It seems like something related with MIPS ELF relocation has changed in binutils 2.32. Also, related support code required for the DVP assembler was removed in binutils 2.32.
     
    fjtrujy, akuhak, jolek and 1 other person like this.
  19. 11
    47
    37
    fjtrujy

    fjtrujy Developer

    Joined:
    Sep 29, 2018
    Messages:
    11
    Likes Received:
    47
    Trophy Points:
    37
    Gender:
    Male
    Thanks for your advances!!
    I'm going to give a try right now.
     
    TnA likes this.
  20. 250
    457
    122
    uyjulian

    uyjulian Developer

    Joined:
    May 27, 2017
    Messages:
    250
    Likes Received:
    457
    Trophy Points:
    122
    Gender:
    Male
    Before I forget to mention: GNU sed needs to be used instead of BSD sed, since BSD sed doesn't support functions used by the building of the toolchain.

    Otherwise, you get this error:
    xgcc: error: addsf3: No such file or directory

    Make sure "sed" points to GNU sed, not BSD sed.
     
    Last edited: Aug 15, 2019

Share This Page