Recompile Yaroze Source

Need help for the Yaroze SDK? Ask a question or look for an answer here. For programming questions or anything else, please see the PlayStation 1 section since the Yaroze has the exact same hardware as a normal PlayStation
ChrisRx
What is PSXDEV?
What is PSXDEV?
Posts: 4
Joined: Jan 06, 2019

Post by ChrisRx » January 7th, 2019, 4:28 am

I started working on a cross compiler toolchain recently so I could do Net Yaroze programming on Linux, and I figured I would share my progress if anyone is interested:

https://github.com/ChrisRx/mipsel-ecoff-toolchain

I have built this on Arch Linux and in a docker container with Debian and successfully built out a toolchain that compiled the sample/check program provided by the SDK without errors (and the object dump looked correct as far as I can tell also). I ended up stepping down versions of GCC until I got to the one mentioned in the `Net Yaroze For Linux` document mentioned in this thread. I am working on getting it transfered to the Net Yaroze to make sure it actually works at the moment. Just wanted to say thanks to the information everyone has provided here, it was incredibly helpful and I look forward to (hopefully) finally doing some programming on my Net Yaroze!

User avatar
gwald
Verified
Net Yaroze Enthusiast
Net Yaroze Enthusiast
Posts: 282
Joined: Sep 18, 2013
I am a: programmer/DBA
PlayStation Model: Net Yaroze
Contact:

Post by gwald » January 11th, 2019, 9:36 am

Welcome Chris!!!
... you are a brave man!
Good work... thanks for sharing!

ChrisRx
What is PSXDEV?
What is PSXDEV?
Posts: 4
Joined: Jan 06, 2019

Post by ChrisRx » January 13th, 2019, 5:09 am

So good news, it appears to be valid since I can run it in an emulator! The bad new though is that I can't seem to get it transferred over unfortunately. I'm running into errors where it says "SYNC ERROR (FFFFFFFF)" and aborts the transfer everytime (this is using siocons compiled in linux). The "Net Yaroze for Linux" document seems to reference a better utility for loading it called hssutils, but I can't seem to find that anymore. Does anyone know if that is available anywhere to download still, or possibly has it download locally and would be willing to provide it?

danhans42
BANNED
BANNED
Posts: 329
Joined: Nov 28, 2012

Post by danhans42 » January 13th, 2019, 7:56 am

If you can't get that working try dosbox.. not ideal but at least you can try the DOS tools.

Siocons in Linux works fine for me on amd64 and on my raspberrypi, just not at slow speeds.. try changing the baud rate if you are using 9600bps

danhans42
BANNED
BANNED
Posts: 329
Joined: Nov 28, 2012

Post by danhans42 » March 12th, 2019, 1:36 am

Hi Chris,

Did you manage to test the output from your setup on real hardware at all? I have a nice linux machine setup for this and was going to give it a try.

Davermouse
What is PSXDEV?
What is PSXDEV?
Posts: 2
Joined: May 14, 2019

Post by Davermouse » May 14th, 2019, 8:35 am

Hi guys,

I've had a play with this on my Macbook Pro and I can confirm that it works really well and does produce binaries that work on the Yaroze - I've made a little Docker setup at https://github.com/Davermouse/docker-yaroze which builds a VM with the compiler in it which should in theory work anywhere you can use Docker.

I had a similar issue pushing binaries to my console over a USB serial adapter from the Mac, I'm not entirely convinced, but I made it work 80% of the time at least by adding some delays to the handshake code in siocons - my vague theory is that the emulated port wasn't setting handshake lines quite as quickly as would be ideal. I can upload my tweaked source somewhere if that'd be of use.

Many thanks for getting this all to work though!

User avatar
gwald
Verified
Net Yaroze Enthusiast
Net Yaroze Enthusiast
Posts: 282
Joined: Sep 18, 2013
I am a: programmer/DBA
PlayStation Model: Net Yaroze
Contact:

Post by gwald » May 17th, 2019, 11:14 am

Ha cool!
Have you used my yarexe by any chance?
https://github.com/gwald/Yarexe

It's a hack of all the exe's that turn the yaroze's siocon's auto file into a single ps1 exe, which then the emulator ran, with printf debugging.. that was 90% of my workflow and worked pretty well, way faster then hardware (I used no$PSX and PCSXR).

It's for windows, never thought of porting it to linux, but it 'should' run in wine too.. never tested it :?

edit: I just compiled it in linux, it was missing the strlwr strupr funcs and it compiled, I haven't tested it tho, but it should work, not sure how 64bit compliant that hacky coding is :lol: :lol: :shrug
Anyway, let me know if you use it or have issues with it.

Mike.

danhans42
BANNED
BANNED
Posts: 329
Joined: Nov 28, 2012

Post by danhans42 » May 18th, 2019, 1:00 am

This is great work and a great first post!! will give it a try.

So with this approach, along with the source version of siocons we pretty much can leave DOS behind for Yaroze development. Yay!

Davermouse
What is PSXDEV?
What is PSXDEV?
Posts: 2
Joined: May 14, 2019

Post by Davermouse » May 19th, 2019, 7:06 am

Cheers, hopefully it's of some use to somebody.

I've actually got a matching slightly more hackily fixed version of Yarexe I've used on the Mac - cheers for updating it properly, if you don't mind I'll have a go at adding it to the Docker image - then it should be possible to make your exe entirely in the image and remove another external step.

I did have some fun and games finding a nice native emulator for Mac which accepts a exe - in the end I'm using mednafen, I've had some funky cmake issues with PCSXR but I should give that another go at some point.

I've just made a little tweak to the project to improve the first run experience - it'll now copy the sample check project into place for you so you have something to play with straight away. If anyone does have a go with it please let me know how it goes...

paulm
Curious PSXDEV User
Curious PSXDEV User
Posts: 18
Joined: Jun 06, 2019
Location: milkyway

Post by paulm » August 4th, 2019, 8:28 pm

Could this work as a replacement for the official PSYQ SDK compiler? I heard that psymake can be replaced with an old version of wmake. Perhaps CC can be replaced with this too?

ChrisRx
What is PSXDEV?
What is PSXDEV?
Posts: 4
Joined: Jan 06, 2019

Post by ChrisRx » December 25th, 2019, 4:38 am

I apologize for waiting so long to reply, however, I recently dusted off this code to dive back in where I left off in Jan. of this year.
danhans42 wrote: January 13th, 2019, 7:56 am If you can't get that working try dosbox.. not ideal but at least you can try the DOS tools.

Siocons in Linux works fine for me on amd64 and on my raspberrypi, just not at slow speeds.. try changing the baud rate if you are using 9600bps
danhans42 wrote: March 12th, 2019, 1:36 am Hi Chris,

Did you manage to test the output from your setup on real hardware at all? I have a nice linux machine setup for this and was going to give it a try.
Thank you for the tip with dosbox, at the time I was able to upload an executable built by my cross-compile toolchain and run it successfully on my DTL-H3001. After that I started trying to figure out what was wrong with the linux version of siocons since the source code was available, but didn't get anywhere with that initially before stepping away from it for a while. I did find some considerable bugs and WTFs in that code. For example, the executable sections are being written to the serial connection in a way that crosses the boundaries of each section and writes data from subsequent sections. It ends up working still, but its why the checksums for the same binary are different with the linux siocons vs. using dosbox and the dos siocons.exe.
Davermouse wrote: May 14th, 2019, 8:35 am Hi guys,

I've had a play with this on my Macbook Pro and I can confirm that it works really well and does produce binaries that work on the Yaroze - I've made a little Docker setup at https://github.com/Davermouse/docker-yaroze which builds a VM with the compiler in it which should in theory work anywhere you can use Docker.

I had a similar issue pushing binaries to my console over a USB serial adapter from the Mac, I'm not entirely convinced, but I made it work 80% of the time at least by adding some delays to the handshake code in siocons - my vague theory is that the emulated port wasn't setting handshake lines quite as quickly as would be ideal. I can upload my tweaked source somewhere if that'd be of use.

Many thanks for getting this all to work though!
I'm really glad it worked for you on macOS, that is so cool! BTW, the insight about adding delays to the handshake code for siocons was a huge help in figuring out what was going on with it. I'm hoping to have a better version available soon (at least a prototype of loading via serial for NY) after I get all my spaghetti code cleaned up.
gwald wrote: May 17th, 2019, 11:14 am Ha cool!
Have you used my yarexe by any chance?
https://github.com/gwald/Yarexe

It's a hack of all the exe's that turn the yaroze's siocon's auto file into a single ps1 exe, which then the emulator ran, with printf debugging.. that was 90% of my workflow and worked pretty well, way faster then hardware (I used no$PSX and PCSXR).

It's for windows, never thought of porting it to linux, but it 'should' run in wine too.. never tested it :?

edit: I just compiled it in linux, it was missing the strlwr strupr funcs and it compiled, I haven't tested it tho, but it should work, not sure how 64bit compliant that hacky coding is :lol: :lol: :shrug
Anyway, let me know if you use it or have issues with it.

Mike.
I was using this to create exe's to run in an emulator and it was working great. I had started to formulate a PR to clean-up some of the code to work on linux and have better portability, but ended up finding it much easier to just rewrite in Go. I've been using that a lot lately for things like cross-platform tools since Go has a really powerful backend compiler for targeting a bunch of different platforms and producing single static binaries. I have it working locally and will be committing it to GitHub this week (along with any other tools I've created while trying to figure this stuff out). I couldn't have made any of this without using your work on Yarexe as a guide, so thank you for putting it out there!
paulm wrote: August 4th, 2019, 8:28 pm Could this work as a replacement for the official PSYQ SDK compiler? I heard that psymake can be replaced with an old version of wmake. Perhaps CC can be replaced with this too?
I haven't looked at the PsyQ SDK very much, but it appears that the pre-compiled parts of it are all .obj and .lib files, which are (at least generally) the standard file extensions for Windows object and static library files, respectively.

I am currently looking at converting the Net Yaroze SDK mipsel-ecoff static library into mipsel-elf and seeing if that will work (funny enough, the original question in this thread). I think it may actually be possible to convert the existing mipsel-ecoff static library into object files where the ecoff headers are replaced with elf32 headers (similar to how the current programs out there convert to psx-exe and leave the text sections mostly intact). If this is successful, it would mean that the newest versions of GCC/LLVM could be used to link the Net Yaroze static library instead of having to use an ancient version of GCC. I mention this because it may be possible to do the same with the Windows static library, replacing the OS-specific file format only with a new one that is more portable, and keeping the underlying architecture-specific code intact. This is not something I'm really familiar with so it may not work, but figured I would throw it out there in case anyone has some helpful input on the matter.

I'll also update again when I get the initial commit for my yaroze tools out, for those that may be interested. Thanks again to everyone for all the help, this has been really fun!

ChrisRx
What is PSXDEV?
What is PSXDEV?
Posts: 4
Joined: Jan 06, 2019

Post by ChrisRx » January 11th, 2020, 7:36 am

https://github.com/ChrisRx/psxsdk

I have an initial commit of the tools I've been developing while working on the Net Yaroze. objdump is what I made recently and have been using it to convert the Net Yaroze development library from ECOFF to ELF by disassembling the object files from libps.a and recompiling them with gcc as mipself-elf instead.

I'm still not 100% sure that this will work, but at this point I'm pretty optimistic that this will work. If it does my end goal is to make the assembly source available in a way that it can be recompiled by any compiler that still supports MIPS-I (llvm apparently does not, but that might be another project).

As a side note, the sioload program there seems to work flawlessly with all baud rates, as I think I figured out the nuances that were causing the linux siocons to not work. There are a few points where modern computers CPUs executed code more quickly than anticipated by the original writer(s) of the linux siocons and it caused the data to be sent after initial a binary transfer before the Net Yaroze mon.exe was ready. Putting trivial waits in those places seems to have fixed it. I had a productive Holiday vacation this time around :)

mrhaboobi
Active PSXDEV User
Active PSXDEV User
Posts: 59
Joined: Nov 18, 2012

Post by mrhaboobi » January 14th, 2020, 7:09 am

Might be a stupid question but what would be the steps to get this working natively on windows machine, eg the original yaroze was DJGPP and didnt require a linux/unix shell etc.. is there a way to get it cross compiled to work natively on a windows machine?

User avatar
gwald
Verified
Net Yaroze Enthusiast
Net Yaroze Enthusiast
Posts: 282
Joined: Sep 18, 2013
I am a: programmer/DBA
PlayStation Model: Net Yaroze
Contact:

Post by gwald » December 14th, 2020, 9:07 am

mrhaboobi wrote: January 14th, 2020, 7:09 am Might be a stupid question but what would be the steps to get this working natively on windows machine, eg the original yaroze was DJGPP and didnt require a linux/unix shell etc.. is there a way to get it cross compiled to work natively on a windows machine?
there is, I've compiled it and used it and works okay in linux.

But the way to do it, is setting up linux with a windows target toolchain ie:
sudo apt-get install mingw-w64

Then you can create 32-bit Windows executable with:
i686-w64-mingw32-gcc -o main32.exe main.c

And 64-bit Windows executable with:
x86_64-w64-mingw32-gcc -o main64.exe main.c

I was thinking about doing this, not sure if I will though.


ChrisRx wrote: January 11th, 2020, 7:36 am https://github.com/ChrisRx/psxsdk

As a side note, the sioload program there seems to work flawlessly with all baud rates, as I think I figured out the nuances that were causing the linux siocons to not work. There are a few points where modern computers CPUs executed code more quickly than anticipated by the original writer(s) of the linux siocons and it caused the data to be sent after initial a binary transfer before the Net Yaroze mon.exe was ready. Putting trivial waits in those places seems to have fixed it. I had a productive Holiday vacation this time around :)
Thanks Chris, i'll have to check that out!

mrhaboobi
Active PSXDEV User
Active PSXDEV User
Posts: 59
Joined: Nov 18, 2012

Post by mrhaboobi » December 15th, 2020, 9:19 am

Be cool if you could target windows. i dont have a linux set up :)

gwald wrote: December 14th, 2020, 9:07 am
mrhaboobi wrote: January 14th, 2020, 7:09 am Might be a stupid question but what would be the steps to get this working natively on windows machine, eg the original yaroze was DJGPP and didnt require a linux/unix shell etc.. is there a way to get it cross compiled to work natively on a windows machine?
there is, I've compiled it and used it and works okay in linux.

But the way to do it, is setting up linux with a windows target toolchain ie:
sudo apt-get install mingw-w64

Then you can create 32-bit Windows executable with:
i686-w64-mingw32-gcc -o main32.exe main.c

And 64-bit Windows executable with:
x86_64-w64-mingw32-gcc -o main64.exe main.c

I was thinking about doing this, not sure if I will though.


ChrisRx wrote: January 11th, 2020, 7:36 am https://github.com/ChrisRx/psxsdk

As a side note, the sioload program there seems to work flawlessly with all baud rates, as I think I figured out the nuances that were causing the linux siocons to not work. There are a few points where modern computers CPUs executed code more quickly than anticipated by the original writer(s) of the linux siocons and it caused the data to be sent after initial a binary transfer before the Net Yaroze mon.exe was ready. Putting trivial waits in those places seems to have fixed it. I had a productive Holiday vacation this time around :)
Thanks Chris, i'll have to check that out!

User avatar
gwald
Verified
Net Yaroze Enthusiast
Net Yaroze Enthusiast
Posts: 282
Joined: Sep 18, 2013
I am a: programmer/DBA
PlayStation Model: Net Yaroze
Contact:

Post by gwald » December 15th, 2020, 11:02 am

actually I forgot gcc gets compiled twice, so it needs to be compiled in windows, probably using wls windows linux subsystem or cygwin stuff.

neither which I use :/

Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests