'2007/11'에 해당되는 글 4건

  1. 2007/11/24 이야기꾼 v0.11 by 키네낵 (5)
  2. 2007/11/22 이야기꾼 v0.1 - PSP 텍스트 뷰어 by 키네낵 (4)
  3. 2007/11/03 이클립스로 통합환경 셋팅하기 by 키네낵 (1)
  4. 2007/11/03 VC++ 포팅용 정의 by 키네낵 (1)

이야기꾼 v0.11

Release 2007/11/24 14:04

버그 수정 버전입니다.

변경된 사항

이야기꾼 0.11 - 2007-11-24
==========================
- 프로그램 내에서 설정 파일의 설정이 적용되지 않고, 프로그램을 실행하고 나면
 설정 파일이 기본값으로 돌아와 있는 버그 수정 (채민석님 감사드립니다.)
- 제목 표시줄의 개발자 닉네임 삭제
- 본 설명서 추가
Posted by 키네낵

v0.11로 업데이트 되었습니다.

Posted by 키네낵
Quick guide for anyone who wants to try out Eclipse. I use SuSE so cygwin/windows users will have to fiddle with the instructions. Bearing in mind I've hardly used Eclipse, I just played around until I got it all working, so use this as a guide and correct anything that's wrong.

1. Download Eclipse from http://www.eclipse.org/downloads. I think that page detects your browser agent and puts the right download at the top of the list. I grabbed the linux one.

2. Untar it somewhere (I used /usr/local/bin/eclipse). It comes as a prebuilt exe so no compiling needed.

3. Run Eclipse as root, or at least with a user that has write permission to the Eclipse directory. The interface will be crappy but functional. Don't worry.

4. Go to Help -> Software Updates, select "Find new software to install".

5. Add a new Remote Site, name it "CDT" and set the URL to http://download.eclipse.org/tools/cdt/releases/eclipse3.1. Uncheck any other update site options (I have Callisto and Eclipse), make sure only your new CDT entry is checked. CDT is the C/C++ extensions for Eclipse.

6. Make sure "Ignore features not applicable to the environment" is checked

7. Click Finish. Eclipse will go and check for new updates. It will find CDT, just check the entire tree (ie: click the top level checkbox). Hit Next, accept the license, let it run. It'll take a while if you're on a slow connect, lots to download. Did you forget to run Eclipse suid root? Bad luck, you're going to have to redownload everything :)

8. When it's finished it will prompt you to either restart the environment, quit Eclipse or carry on (not sure of the exact wording now, you'll see the prompt). Select "Restart Eclipse", or, if I've just suffered amnesia and there isn't an option, quit Eclipse then reload it as root. This is really really important because files are written during the reload.

9. When Eclipse has loaded, click the option to go to the workbench (far right icon/image thing). Go to Help - About, then click Plugin Details. If CDT installed you'll have lots of C/C++ items in the list.

10. Exit Eclipse again. Bored yet?

11. Open a shell and edit <install>eclipse/plugins/org.eclipse.cdt.debug.mi.core_3.0.2/plugins.xml

12. Look for tag: point="org.eclipse.cdt.debug.core.CDebugger", in this node you'll see cpu="native", change this to cpu="*". Save and exit.

13. Run Eclipse again as root but with the -clean flag specified as a command line option.

14. Finally quit Eclipse. Now you can start using it properly.


We'll debug the SDK sprite sample as a demo. This assumes you have PSPLink and PSP-GDB working from shell correctly.


15. Load Eclipse under your normal user account. Yay, it looks like a 21st Century IDE.

16. Go File - New Project. In the dialog expand "C" and select "Standard Make C". Hit Next, name the project "Sprite". Hit Finish.

17. You'll be left with an empty project (or workspace, or solution for you Visual Studio people). On the left hand side you'll see what would be a tree thing for your project, with Sprite at the top. Right click in the panel and select Import

18. Select General -> FileSystem and hit Next. The next dialog is basically an import browser for existing code. Use the top browse button to go and select the pspsdk/samples/gu/sprite directory. Don't worry, this process doesn't affect the original, it will create a duplicate in your workspace folder (which is your home folder by default). Make sure you select all the files, sometimes Eclipse didn't select everything.

19. Now we need to fiddle the SDK code. There are relative paths to headers in the common/ directory - because Eclipse duped the project into the workspace folder these are now broken. Fix the paths in sprite.c AND in Makefile.

Ok, that's what you have to do to get PSP code loaded into Eclipse. One thing that's *really* annoying if you're a VS user is Eclipse won't build changed files unless they're saved (Imight be wrong but it wouldn't for me). So go Window -> Preferences, expand General and click on Workspace. In there check "Save before build". Will save your sanity when you wonder why your new build didn't get the code changes :)

20. Now you can go Project -> Build Project or Build All. You might need to make a random change and save again before the build works. If you got it all right Eclipse will pick up the Makefile, use psp-gcc, pop the console window to front and show you the build output. You're done. Now you could switch back to pcterm and ./sprite.elf, but don't do that just yet.

21. Add the -g flag to CFLAGS in the Makefile to indicate we want debugging symbols (line 5:)
Code:
CFLAGS = -g -G0 -Wall -O2


22. Go Project -> Clean and select Clean All. If you don't do this Eclipse won't pick up the addition of the -g flag in the makefile, and so won't rebuild the code. Anyone know how to get Eclipse to notice a change to the Makefile so we don't have to use the clean option?

23. Go Project -> Build Project. Check the output in the console to make sure the new -g flag in the Makefile was noticed.
Code:
psp-gcc -I. -I/usr/local/pspdev/psp/sdk/include -g -G0 -Wall -O2   -c -o sprite.o sprite.c


24. Ok, we're done with the building. <deleted this step, was caused by some local issue to me>

25. Go to your pcterm session and type:
Code:
debug ./sprite.elf

(obviously that assumes that usbhostfs_pc was started in the Eclipse workspace sprite directory - remember that Eclipse copies the source to the workspace, so if you selected /home/myarse as your workspace folder you'll need to start usbhostfs_pc /home/myarse/sprite)

26. A grand total of nothing should happen on your PSP, you'll see this in pcterm:
Code:
host0:/> debug ./sprite.elf

host0:/> PSPLink GDBServer (c) 2k6 TyRaNiD/Lovely2
GDBServer: Loaded host0:/sprite.elf - UID 0x044C7627


27. Go back to Eclipse. Go to the Run menu and select Debug. You actually init the debug from this dialog, which isn't particularly obvious the first time you do it.

28. Click on "C/C++ Local Application", then click the New Item button (the paper sheet with the yellow star thing).

29. This will pop a new entry into the list and bring up its settings on the left side of the dialog. Name it something like PSPGDB or whatever. On the Main tab, select the sprite project for "Project" and select sprite.elf for the "C/C++ Application".

30. Skip all the other tabs, go to the Debugger tab. In the Debugger field, drop down the selection and choose GDB Server. Check "Stop at Main on startup". Under the "Main" subtab on the Debugger tab, enter psp-gdb for the debugger. Drop down the connection options and choose TCP, set Hostname to "localhost" (or 127.0.0.1 if your box is retarded), set port to 10001.

31. Magically, if you got it all right, the Debug button at the bottom will spring into life. Click it!

32. Eclipse will look like it did nothing. Yes, this can be a dumb IDE IMO. But go to your usbhostfs session and (if you used -v option) you'll see all the GDB communications.

33. In Eclipse go to Window -> Open Perspective -> Debug. Yay, here's your debug stuff. As proof it works click the green arrow button that clearly looks like a Run option, and watch the PSP execute sprite.elf

Things I haven't quite figured out yet... Eclipse won't always show the values of vars. Also I can't get it to properly terminate the app on the PSP once you've clicked the run button (although you can terminate it properly if you've stopped at a breakpoint and are stepping over code). If anyone figures that out, let me know.

*edit* Tyranid says it's his fault, please fill his inbox with spam requesting it's fixed immediately ;)

Hopefully this will help someone, or at least provide a quick guide to trying out Eclipse. With a bit more work I'm pretty sure it can all be made mostly automatic.

Cheers...
Posted by 키네낵

VC++ 포팅용 정의

Debug 2007/11/03 10:40

#include <io.h>
#include <fcntl.h>

#define SceUID int

#define sceIoOpen(file, mode, access) open(file, mode | _O_BINARY)
#define sceIoClose(handle) close(handle)
#define sceIoRead(handle, data, size) read(handle, data, size)
#define sceIoWrite(handle, data, size) write(handle, data, size)
#define sceIoLseek(handle, offset, whence) _lseeki64(handle, offset, whence)
#define sceIoLseek32(handle, offset, whence) lseek(handle, offset, whence)

#define PSP_O_RDONLY _O_RDONLY
#define PSP_O_WRONLY _O_WRONLY
#define PSP_O_RDWR   _O_RDWR

#define PSP_SEEK_SET SEEK_SET
#define PSP_SEEK_END SEEK_END
#define PSP_SEEK_CUR SEEK_CUR

typedef unsigned int u32;
typedef unsigned short u16;
typedef unsigned char u8;

파일 관련 디버그 할 때...
PSP로 직접 디버그 하는 것보다 소스를 VC++용으로 포팅해서 하는게 더 편하므로

Posted by 키네낵