Saturday, October 24, 2009

Eclipse 3.5 SR1 Galileo (C/C++ IDE) devkitpro on Linux Mint 7

Im trying different enviorment on which devel. Today i wanna keep information i found on how to set up an linux eclipse c/cpp IDE for nintendo DS programming. Especially this work for Linux Mint 7 but i guess this should work for most linux distros.

If you try to install eclipse for c/cpp from mintInstall you will notice that it is an older version, which is not compatible with an interesting plugin:
NDS Managedbuilder
.

So the way you have to follow is to download the latest eclipse version from the official site.
Well you love to do it all by shell, so open up your terminal, look on the web the download link and get it.
Now you need to extract it everywhere you want in your filesystem. I dowload it in my home folder and extract in /opt/

~ $ wget <link>
~ $ tar -C /opt/ -xvjf <archivename>


And about eclipse it's all. You can launch it from there or link it eveywhere you want.

the latest link is: http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/galileo/SR1/eclipse-cpp-galileo-SR1-linux-gtk.tar.gz.

Now we will move on the devkitpro getting started web-site. There is deeply and clearely explained how to install the toolchain.
It's easy, just build the filesystem tree, download the libraries and extract in the right folder.
You can finde the wiki here: devkitARM.

Well it's time to install the eclipse plugin so move to NDS Managerbuilder, open eclipse

Help > Install New Software > click "Add" button > http://dev.snipah.com/nds/updater

follow the instruction, restart eclipse and you are ready to develop for Nintendo DS (c/cpp too) on eclipse in a linux enviorment!

[EDIT] Stay tuned, gonna look to add PAlib too ;)

Tuesday, October 13, 2009

c Kernighan & Ritchie exercise

Lately im into c programming, really newbie, so im reading Kernighan & Ritchie famous book.
Here a funny exercise that reverse an input line string:

"Write a function reverse(s) that reverses the character string s. Use it to write a program that reverses its input a line at a time."

i change the params as you can see..


#include <stdio.h>

#define MAXLEN 30

int getline(char s[], int lim);
void reverse(char s[], char r[], int len);

int main()
{
int len;
char line[MAXLEN];
char reversed[MAXLEN];

len = 0;

while((len = getline(line, MAXLEN)) > 0)
{
reverse(line, reversed, len);
printf("\nReversed = %s\n\n", reversed);
}

return 0;
}

int getline(char s[],int lim)
{
int c, i;
for (i=0; i < lim-1 && (c=getchar())!=EOF && c!='\n'; ++i)
s[i] = c;
if (c == '\n') {
s[i] = c;
++i;
}
s[i] = '\0';
return i;
}

void reverse(char s[], char r[], int len)
{
int i;

for(i = 0; i < len; i++)
r[i] = 0;

for(i = 0; i < len; i++)
{
/* -2 will strip \n in the original string (-1 the original end of string */
r[i] = s[len-i-2];
}
r[len] = '\0';
}

Monday, October 5, 2009

Devkitpro 1.5.0, PAlib and Visual c++ 2008 Express

Few days ago i started to think about devkitpro, to develop nintendo DS homebrew software. So i start to chill around PAlib. Just to check out. So i move to the wiki to installing the toolchain.
I soon discover that it was possible to use PAlib with Visual c++ 2008 Express.
I notice that the step to follow was outdated.

If you want to get it work just follow that steps but with this difference:

  1. Set PAPATH enviorment variable to this one: <path to devkitpro>/PAlib/lib

  2. After the launch of the PAlib application wizard, change the makefile inside <path to PAlib application wizard>/Files/Templates/1033 with one you can find in the PAlib examples

  3. If you want to keep logos inside the data folder change the icon path in the make file from ICON := -b $(CURDIR)/../logo.bmp to ICON := -b $(CURDIR)/../data/logo.bmp

that's all, this work fine, hope someone could find this useful.