GP32 Bizarre Bug With Mrmirkosdk And Gcc Under Windows


HalfNelson

Still Fresh
Joined
May 26, 2004
Messages
16
Gday Guys,

I'm having a little trouble spotting a bug while using Mr Mirko's fantastic SDK. Im trying to use the gp_drawString() function but am having mixed results.
Code:
#undef fixit

#include <gp32.h>

unsigned short *framebuffer;

void main () {
  framebuffer = (u16*) FRAMEBUFFER;
  gp_setCpuspeed(33);
  gp_initFramebuffer(framebuffer,16,80);
  gp_clearFramebuffer16(framebuffer,0xFFFF);
   {
#ifdef fixit
    char text[80];
    sprintf(text,"%x",123); 
#endif
    gp_drawString(10,123,15,"Hello out there",0xF800,framebuffer);  
   }
  while (1) {   }
}
This code does not work !!!!
with gcc3.3.0 from mr mirko's website or 3.4.0 from mr mirkos website under windows
yet if it change the line "#undef fixit" to "#define fixit" it works.
I looked at the disassembly of the file with fixit undefined and it was garbage
any ideas? Or anyone with a working copy of gcc who wants to try it out too?
Uses 0.84 of mirko SDK and mrMirkosdk for windows 2.1 by bobintrees
 

mr.mirko

Certified Guru
Joined
Nov 24, 2003
Messages
471
Location
Germany
Website
mirkoroller.de
Gday Guys,

I'm having a little trouble spotting a bug while using Mr Mirko's fantastic SDK. Im trying to use the gp_drawString() function but am having mixed results.
Code:
#undef fixit

#include <gp32.h>

unsigned short *framebuffer;

void main () {
  framebuffer = (u16*) FRAMEBUFFER;
  gp_setCpuspeed(33);
  gp_initFramebuffer(framebuffer,16,80);
  gp_clearFramebuffer16(framebuffer,0xFFFF);
   {
#ifdef fixit
    char text[80];
    sprintf(text,"%x",123); 
#endif
    gp_drawString(10,123,15,"Hello out there",0xF800,framebuffer);  
   }
  while (1) {   }
}
This code does not work !!!!
with gcc3.3.0 from mr mirko's website or 3.4.0 from mr mirkos website under windows
yet if it change the line "#undef fixit" to "#define fixit" it works.
I looked at the disassembly of the file with fixit undefined and it was garbage
any ideas? Or anyone with a working copy of gcc who wants to try it out too?
Uses 0.84 of mirko SDK and mrMirkosdk for windows 2.1 by bobintrees
char text[80];
sprintf(text,"Hello %x",123);

gp_drawString(10,123,15,text,0xF800,framebuffer);



returns Hello 7b on screen...

compiled under linux, no clue why its not working with windows compiler, ask bobintress ...
 
Last edited by a moderator:

bobintrees

Still Fresh
Joined
Feb 7, 2004
Messages
35
It works for me too using the kit I just released and cygwin.

Do you have any of the other kits and have your path pointing at one of them?
 

HalfNelson

Still Fresh
Joined
May 26, 2004
Messages
16
I managed to fix it, It seems to be the crt0.o stage of the make file. I was using the crt0.S and init2.c from an example directory in the sdk along with the make file (just copied from the font example)

For some reason my compiler generates a dud crt0.o file in certain situations (who knows why)
so i found a good crt0.o file and removed the crt0.o steps from the make file and all works again without touching the original c file that was broken. Thanks for your help guys :)
 
Top