GP32 Can't Make My "hello World" Work On The Real Gp

larienna

Still Fresh
Joined
Jul 14, 2005
Messages
8
Hi

I have downloaded recently the Mirko's SDK. Very nice tool.

I have commented the line in the compiler lib to make sure the examples can run on the emulator. I recompiled everything. All examples work on emulator and real GP32.

Now I tried to make an hello world. It works fine on the emulator, but I get a white blank screen on the GP32.

After many test I modified the doublebuffer example makefile to use arm-elf-g++ instead of gcc, and it created the same result. So I said to myself, maybe it did not work because my file was in CPP. Still, the pure cpp example work. I changed my hello world back to simple C and it still does not work on my GP.

Does anybody have an idea why it does not work. Any help would be appreciated.

----- Here is my hello world code sample -----

Code:
// simple test programm for the gp32
#include <gp32.h>

int main ( void )
{
   gp_setCpuspeed(66);
  
   unsigned short *framebuffer = 
      (unsigned short*) FRAMEBUFFER;
   gp_initFramebuffer( framebuffer, 16, 85 );
   gp_clearFramebuffer16(framebuffer, 0xFFFF);
     
   gp_drawString ( 20, 50, 11, "Hello World", 0x444F, 
     framebuffer );

   while (1)
   {
   }     
  
   return(0);
}
----- My make file is -----
Code:
CC = arm-elf-gcc
LD = arm-elf-g++
AS = arm-elf-as
AR = arm-elf-ar
CXX = arm-elf-c++


PRG = hello

LIBS = -Lf:/gp32sdk/lib -lmirkoSDK
CRT0 = f:/gp32sdk/lib/crt0.S
LNKSCRIPT = f:/gp32sdk/lib/lnkscript

INCLUDES = -If:/gp32sdk/include

CFLAGS = $(INCLUDES) -O2 -s -mtune=arm9tdmi
 
OBJS =  hello.o 

all:	$(OBJS)
	$(CC) -c -o crt0.o $(CRT0)
	$(LD) -nostartfiles -s -Wall -Wl,-Map,Test.map  -T $(LNKSCRIPT) crt0.o -o $(PRG).elf $(OBJS) $(LIBS)
	arm-elf-objcopy -O binary $(PRG).elf $(PRG).bin
	b2fxec -a Mirko_Roller -t SDK_EXAMPLE_$(PRG) $(PRG).bin $(PRG).fxe

install:
	gplink put hello.fxe gpmm

clean:
	rm -f *.o *~ Test.map *.bin *.elf
 

larienna

Still Fresh
Joined
Jul 14, 2005
Messages
8
I tried adding the following line of code and it does not work
Code:
   gp_setFramebuffer(framebuffer,1);
I tried to modify the make file like below in case it did not like g++ and it did not work either.
Code:
CC = arm-elf-gcc
LD = arm-elf-gcc
AS = arm-elf-as
AR = arm-elf-ar
#CXX = arm-elf-c++
I currently have 2 gcc compiler on my computer. Mingw32 and Mirko SDK. Is it possible that there is some conflict between the 2 compilers. Maybe not since it works on the emulator.

The other thing would be the uncomment the lines that allow to make the program work on the emulator.

Code:
   if (vsync) {
     while(1) {if(((rLCDCON5>>17)&3)==2) break;} // wait for active line  
     while(1) {if(((rLCDCON5>>17)&3)!=2) break;} // wait for active line to end - start of front porch and hsync
   }
I have not tried it because I did not want to recompile the library again. But it is probably what I will try next.

If it works, is it possible to have both version of the of SDK installed. One for the emulator and one for the gp. Then add a different make file entry to compile each version of my software. It could probably be done by renaming the lib and including a different lib when linking.
 

pea

developer
Joined
Oct 3, 2004
Messages
1,086
Age
41
Location
New Zealand
Website
www.projectitis.com
If you have downloaded a recent version of Mr.Mirkos libs, like you say you have, then you will find that there already ARE two version of the compiled lib in the lib directory - one called libmirkoSDK.a and the other libmirkoSDK_GEEPEE.a

Just change the makefile from:
Code:
LIBS = -Lf:/gp32sdk/lib -lmirkoSDK
to
Code:
LIBS = -Lf:/gp32sdk/lib -lmirkoSDK_GEEPEE
If not, upgrade to the latest version!

Edit: By the way, in theory, the GEEPEE version (and the version you have which works on the emulator) should work on the hardware too. it may just flicker a little or something when you flip the framebuffer...
 

larienna

Still Fresh
Joined
Jul 14, 2005
Messages
8
I downloaded version 095 of the SDK and I did not found 2 libs. So I renamed the one I have as mirkoSDK_GEEPEE and I re-extracted the original mirkoSDK lib from the zip file.

I recompiled my hello world program with the original lib and it does not work either.

I made a new hello world programm that does page flipping on a white or black screen. I said to myself thay maybe nothing happen because there is not activity on the screen. The new programm works well on the emu but still not on the GP whatever the lib version. (Code included at the end of this post)

I was wondering, does the CPU speed matter? Should I try it at 133?

I am going to recheck the double buffer example, and I will try to recompile my programm at the same place than this example in case it is a compiler environment problem ( since I also have mingw32 installed ).

I also tought about drawing graphics instead of text.

It's a pretty weird bug and it is probably a stupid detail. But I need to successfully run at least a "hello world" program before trying to make anything else.

Thanks again for your help.

Here is my new hello world programm with page flipping
Code:
// simple test programm for the gp32
#include <gp32.h>

int main ( void )
{
   int i;
   unsigned short *framebuffer = 
      (unsigned short*) FRAMEBUFFER;
   unsigned short *framebuffer2 = 
      (unsigned short*) FRAMEBUFFER2;

   gp_setCpuspeed(66);
   gp_initFramebuffer( framebuffer, 16, 85 );
   gp_clearFramebuffer16(framebuffer, 0xFFFF);     
   gp_drawString ( 20, 50, 11, "Hello World", 0x0000, 
     framebuffer );
  
   gp_clearFramebuffer16(framebuffer2, 0x0000);
   gp_drawString ( 20, 100, 17, "Hello World again", 0xFFFF, 
     framebuffer2 );

   while (1)
   {
      gp_setFramebuffer(framebuffer,1);                          
      for (i=0;i<2000000;i++);
      gp_setFramebuffer(framebuffer2,1);                          
      for (i=0;i<2000000;i++);
   }
  
   return(0);
}
 

pea

developer
Joined
Oct 3, 2004
Messages
1,086
Age
41
Location
New Zealand
Website
www.projectitis.com
When you say that 'it does not work' on the gp32 - do you just get a blank screen, or do you get some horizontal bars that rin accross the screen near the top?

If you get the bars, then the problem is that your code is being output for the BLU when you actually have a BLU+. Do you know which gp32 you have?

Apart from that, I can't see any problem with your code, especially if it runs in geepee32.

EDIT: Clock speed should not matter at all. Even 66 is very fast for this example :)
 

larienna

Still Fresh
Joined
Jul 14, 2005
Messages
8
Not sure what kind of BLU I have. I bought my GP last year and Hexen for BLU+ work perfectly on my GP, so I imagine that I have a BLU+.( did not know they was 2 kind of BLU).

I don't get any white bars. It's plain blank. It's like if the screen was shutting down(for example when you batteries run out).

I have not made any new tests yet. Thanks again for trying to help. I am going to recheck the examples and modify them for fun.
 

larienna

Still Fresh
Joined
Jul 14, 2005
Messages
8
HI, I found the problem. A bit weird but it now works. The problem is here

Code:
int main ( void )
{
  int i;
  unsigned short *framebuffer =
     (unsigned short*) FRAMEBUFFER;
  unsigned short *framebuffer2 =
     (unsigned short*) FRAMEBUFFER2;

Have you found it? To make it work on my GP, I must declare the frame buffer variables as global variables like this :

Code:
unsigned short *framebuffer;
unsigned short *framebuffer2;

int main ( void )
{
  int i;
   framebuffer = (unsigned short*) FRAMEBUFFER;
   framebuffer2 = (unsigned short*) FRAMEBUFFER2;
 
Top