gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

DS development > Bug in DevkitARM?

#41306 - Jalava - Wed Apr 27, 2005 11:36 am

Consider this kind of piece of code

Code:

u8 foo = 6;

void testFunction(void)
{
    consolePrintf("%X",foo); // Prints out zero!
}


It seems that global variables cannot be initialized to certain value, which is clearly a bug.

#41309 - Locke - Wed Apr 27, 2005 1:47 pm

Try consolePrintf ("%d", foo);

Just to see if there is a problem of devkit or consolePrintf function.

#41310 - Jalava - Wed Apr 27, 2005 1:54 pm

That was just small example code i wrote from top of my head, i can confirm in lots of other ways that this really is this way.

For example simple while-loop :

Code:
u8 times = 10;

void testLoop(void)
{
   int i=0;
   while(i<times)
   {
     i++;
   }
}


Following loop doest run even once because times is initialized to zero. Not sure which causes this bug, need to investigate a bit more.

#41319 - tepples - Wed Apr 27, 2005 3:05 pm

How is your program's main() function declared?

Are you using the default crt0 and link script?
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#41326 - Rinkwraith - Wed Apr 27, 2005 4:21 pm

Out of interest, does this work (have no access to my dev kit at the moment)?

Code:

u8 times;

void testLoop(void)
{
   int i=0;
   times = 10;
   while(i<times)
   {
     i++;
   }
}


Edit: Think it must, I'm sure I've used that form in my own proggies.
Edit2: Certainly used a constant value that way...

R