forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Need some help configuring a development environment.

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
chocoflyer



Joined: 15 Mar 2007
Posts: 5

PostPosted: Thu Mar 15, 2007 10:16 am    Post subject: Need some help configuring a development environment. Reply with quote

Hi, I'm new to the C programming language (I've spent time studying the specification) and PSP development, but I'd like to give it a shot. I tried to work with Lua, but I found C to be easier (probably because I'm used to C-style languages) so I thought to try out "real" PSP programming.

My IDE of choice is Visual C++ Express. I looked at the thread about using VC++ with the PSP toolchain, but I thought I'd make a new thread since I'm starting for scratch essentially and have very little experience with VC++ and cygwin.

I'm running on Windows XP, so I installed cygwin with just the default settings (looks like it comes with bin, bash, gawk, bzip2, and maybe a few other standard utilities; is that sufficient?). I've got VC++ Express installed as well, but that's where I'm at. I have absolutely no experience with making PRXs or EBOOTs, but if I can get "hello world" running, that would be great, and from there I think I'll be fine (to a certain extent, of course :P).

I guess what I'm asking is:
• Is using the default installation settings for cygwin fine, or did I need to install something else?
• Will Visual C++ Express work, or do I need the fancier Visual C++ 2005/Visual Studio 2005?
• After that, will the tutorial on how to configure VC++ work for me?
• If not, what is the simplest alternative? I do not require any debugging utilities; I usually just use printf statements at certain points in the code, and I hope that will suffice.

Thanks in advance.
Back to top
View user's profile Send private message AIM Address
Bytrix



Joined: 14 Sep 2005
Posts: 72
Location: England

PostPosted: Thu Mar 15, 2007 11:59 am    Post subject: Reply with quote

Those tutorials didn't work for me with the latest cygwin/toolchain/Visual C++ Express. Here's how I got mine to compile though so should work for you:

Assuming cygwin is installed in C:\cygwin create the following two files:

c:\cygwin\vs-pspdev.bat
Code:
@echo off
set path=%path%;c:/cygwin/usr/local/pspdev/bin
set PSPSDK=c:/cygwin/usr/local/pspdev
c:\cygwin\bin\bash -c 'export VS_PATH=`pwd`; /bin/bash --login -c "cd $VS_PATH; /vs-pspdev.sh %1 %2 %3 %4 %5"'


c:\cygwin\vs-pspdev.sh
Code:
#!/bin/bash
make 2>&1 $@ | sed -e 's/\([^:]*\):\([0-9][0-9]*\)\(.*\)/\1 (\2) \3/'


Then in Visual Studio start a new Makefile Project and enter c:\cygwin\vs-pspdev.bat as your build command line and c:\cygwin\vs-pspdev.bat clean as your clean commands. Then set the Include Search Path to C:\cygwin\usr\local\pspdev\include;C:\cygwin\usr\local\pspdev\psp\include;C:\cygwin\usr\local\pspdev\psp\sdk\include

I haven't yet looked into any of the methods which can auto-generate a make file so I would copy one of the makefiles from the sdk samples and change it as you need to.

That's it for compiling.. I do all my testing and debugging using psplinkusb and I don't think it can be linked in with Visual C++.


Last edited by Bytrix on Thu Mar 15, 2007 6:16 pm; edited 1 time in total
Back to top
View user's profile Send private message Send e-mail
sturatt



Joined: 13 Jul 2006
Posts: 46

PostPosted: Thu Mar 15, 2007 1:31 pm    Post subject: Reply with quote

Bytrix

I tried to setup my Visual c++ like you said, but when i try to build the project it says device not ready?

1>------ Build started: Project: TestProj, Configuration: Debug Win32 ------
1>Performing Makefile project actions
1>The device is not ready.
1>Project : error PRJ0002 : Error result 1 returned from 'C:\WINDOWS\system32\cmd.exe'.
1>Build log was saved at "file://c:\cygwin\home\Administrator\projects\TestProj\Debug\BuildLog.htm"
1>TestProj - 1 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Edit:

nevermind, in your vs-pspdev.bat you had an e:\cygwin\... instead of c:\cygwin so it was trying to do my dvd drive.
Back to top
View user's profile Send private message
Bytrix



Joined: 14 Sep 2005
Posts: 72
Location: England

PostPosted: Thu Mar 15, 2007 6:14 pm    Post subject: Reply with quote

Yeah sorry I have my cygwin on drive e: but I tried to change all the references to c: as that's the most common place for it.
Back to top
View user's profile Send private message Send e-mail
chocoflyer



Joined: 15 Mar 2007
Posts: 5

PostPosted: Fri Mar 16, 2007 2:07 pm    Post subject: Reply with quote

Thank you very much for the tutorial. I just began trying to compile my first PSP program (installing the toolchain took so long!) so I copied a simple Hello World tutorial I found.

I am sure that I followed your instructions exactly, but I am not able to compile my program.

At first, the error log said:
Code:
------ Build started: Project: PSP Hello World, Configuration: Debug Win32 ------
Performing Makefile project actions
/bin/bash: line 0: cd: /cygdrive/c/Documents: No such file or directory
sed: -e expression #1, char 46: unknown option to `s'
Project : error PRJ0002 : Error result 1 returned from 'C:\WINDOWS\system32\cmd.exe'.

Thinking that this was because of a space in "Documents and Settings", I added quotes to line 4 of the vs-pspdev batch file:
Quote:
c:\cygwin\bin\bash -c 'export VS_PATH=`pwd`; /bin/bash --login -c "cd \"$VS_PATH\"; /vs-pspdev.sh %1 %2 %3 %4 %5"'

Now, the error log just says:
Code:
------ Build started: Project: PSP Hello World, Configuration: Debug Win32 ------
Performing Makefile project actions
sed: -e expression #1, char 46: unknown option to `s'
Project : error PRJ0002 : Error result 1 returned from 'C:\WINDOWS\system32\cmd.exe'.

I have also tried deleting a newline from the end of the vs-pspdev.bat and vs-pspdev.sh files, but that only resulted in more problems, so I replaced the newline (and perhaps a linefeed; IIRC Notepad does that) if that matters.

Sorry about the problems, but I don't have any clue about what to do. >_<
Back to top
View user's profile Send private message AIM Address
Bytrix



Joined: 14 Sep 2005
Posts: 72
Location: England

PostPosted: Fri Mar 16, 2007 5:39 pm    Post subject: Reply with quote

Try starting a new project or moving your project to a path with no spaces and attempting to compile. Then you'll know if it's because of the space in the path. eg: c:\projects\myproject
Back to top
View user's profile Send private message Send e-mail
chocoflyer



Joined: 15 Mar 2007
Posts: 5

PostPosted: Sat Mar 17, 2007 12:00 pm    Post subject: Reply with quote

No, that doesn't seem to be the issue unfortunately.
I am nearly sure that the problem exists with passing arguments to sed. After the regex, if I add "foo", VC++ shows an error saying that no file or folder called "foo" exists. Thus, I am guessing that the problem I am having is a result of not passing a filename argument to sed.

It looks like arguments are passed to bash when /vs-pspdev.sh is called:
Quote:
c:\cygwin\bin\bash -c 'export VS_PATH=`pwd`; /bin/bash --login -c "cd \"$VS_PATH\"; /vs-pspdev.sh %1 %2 %3 %4 %5"'
but I am no master of scripts so that is only my guess.

Nevertheless, when we get to
Code:
#!/bin/bash
make 2>&1 $@ | sed -e 's/\([^:]*\):\([0-9][0-9]*\)\(.*\)/\1 (\2) \3/'

I do not think that sed is getting passed any arguments since if I append anything to that last line, the script works "fine" in that it does not choke on the regex. But if I leave it as is, I think that it is looking for another argument but can't find one.

Would anyone happen to have an idea for a solution?
Thank you.
Back to top
View user's profile Send private message AIM Address
Bytrix



Joined: 14 Sep 2005
Posts: 72
Location: England

PostPosted: Sat Mar 17, 2007 8:41 pm    Post subject: Reply with quote

Sorry, no idea. Works perfectly for me. Is your cygwin install completely up to date? Perhaps it could be a problem with an old sed ($ sed --version, the one I have in a cygwin install from the weekend is 4.1.5).

It could maybe be a problem with your makefile, causing make to output some odd errors that sed can't parse.
Back to top
View user's profile Send private message Send e-mail
chocoflyer



Joined: 15 Mar 2007
Posts: 5

PostPosted: Sun Mar 18, 2007 12:23 pm    Post subject: Reply with quote

Yes, I have the same sed version.

I think that my problem is with the makefile. I went into the SDK samples and copied main.c from the basic controller sample, and took the makefile as well.

The makefile looks like
Code:
TARGET = controller_basic
OBJS = main.o

INCDIR =
CFLAGS = -O2 -G0 -Wall
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS)

LIBDIR =
LDFLAGS =

EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = Basic controller sample

PSPSDK=$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build.mak

I created a new project and solution in VC++, threw main.c and Makefile into the innermost directory (which contains the VC++ project configuration file), added main.c to the project, and tried to build it. I have a feeling that this is not what I should be doing with the makefile.

Where should I place the makefile and what should I do with it?
Back to top
View user's profile Send private message AIM Address
Bytrix



Joined: 14 Sep 2005
Posts: 72
Location: England

PostPosted: Sun Mar 18, 2007 9:57 pm    Post subject: Reply with quote

try entering the directory and running a make from cygwin/cmd. See if it compiles correctly, if it does then it's probably not a problem with the makefile. If it is the problem you should be able to see what's wrong.
Back to top
View user's profile Send private message Send e-mail
chocoflyer



Joined: 15 Mar 2007
Posts: 5

PostPosted: Mon Mar 19, 2007 9:19 am    Post subject: Reply with quote

I resolved the problem with compiling the code by adding the bin directories of the PSP SDK to my PATH environment variable.

To get it to work with Visual C++, I edited vs-pspdev.bat to
Code:
del /F /Q *.o *.elf *.PBP *.SFO
make
and now everything is good.
Thanks for the help.
Back to top
View user's profile Send private message AIM Address
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group