Need some help configuring a development environment.
-
- Posts: 5
- Joined: Thu Mar 15, 2007 7:06 am
Need some help configuring a development environment.
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.
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.
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
c:\cygwin\vs-pspdev.sh
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++.
Assuming cygwin is installed in C:\cygwin create the following two files:
c:\cygwin\vs-pspdev.bat
Code: Select all
@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"'
Code: Select all
#!/bin/bash
make 2>&1 $@ | sed -e 's/\([^:]*\):\([0-9][0-9]*\)\(.*\)/\1 (\2) \3/'
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.
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.
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.
-
- Posts: 5
- Joined: Thu Mar 15, 2007 7:06 am
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:
Thinking that this was because of a space in "Documents and Settings", I added quotes to line 4 of the vs-pspdev batch file:
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. >_<
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: Select all
------ 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'.
Now, the error log just says:c:\cygwin\bin\bash -c 'export VS_PATH=`pwd`; /bin/bash --login -c "cd \"$VS_PATH\"; /vs-pspdev.sh %1 %2 %3 %4 %5"'
Code: Select all
------ 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'.
Sorry about the problems, but I don't have any clue about what to do. >_<
-
- Posts: 5
- Joined: Thu Mar 15, 2007 7:06 am
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:
Nevertheless, when we get to
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.
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:
but I am no master of scripts so that is only my guess.c:\cygwin\bin\bash -c 'export VS_PATH=`pwd`; /bin/bash --login -c "cd \"$VS_PATH\"; /vs-pspdev.sh %1 %2 %3 %4 %5"'
Nevertheless, when we get to
Code: Select all
#!/bin/bash
make 2>&1 $@ | sed -e 's/\([^:]*\):\([0-9][0-9]*\)\(.*\)/\1 (\2) \3/'
Would anyone happen to have an idea for a solution?
Thank you.
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.
It could maybe be a problem with your makefile, causing make to output some odd errors that sed can't parse.
-
- Posts: 5
- Joined: Thu Mar 15, 2007 7:06 am
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
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?
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: Select all
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
Where should I place the makefile and what should I do with it?
-
- Posts: 5
- Joined: Thu Mar 15, 2007 7:06 am
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 toand now everything is good.
Thanks for the help.
To get it to work with Visual C++, I edited vs-pspdev.bat to
Code: Select all
del /F /Q *.o *.elf *.PBP *.SFO
make
Thanks for the help.