2009-10-30 10:27:02     u-boot newbie

Document created by Aaronwu Employee on Sep 24, 2013
Version 1Show Document
  • View in full screen mode

2009-10-30 10:27:02     u-boot newbie

Filip Vanalme (BELGIUM)

Message: 81912   

 

Hi,

 

I'm writing a kind of "hello world" testing program that should run from u-boot prom.

 

 

This piece of code works fine :

 

void main (int argc, char* argv[])

{

char c = 0;

 

app_startup(argv);

 

putc('\n');

 

  putc('$');

 

  while (c != 'q')

  {

    printf ("+++");

    c = getc();

    putc ('%');

    printf ("TEST\n");

    udelay (1000);

  }

 

  return;

}

 

However, It does not work anymore when I change the code to this :

 

void mainmenu (void);

 

void main (int argc, char* argv[])

{

char c = 0;

 

app_startup(argv);

 

putc('\n');

 

  putc('$');

 

  while (c != 'q')

  {

    mainmenu ();

    c = getc();

    putc ('%');

    printf ("TEST\n");

    udelay (1000);

  }

 

}

 

void mainmenu (void)

{

    printf ("+++");

  

    return;

}

 

The only difference is the function call to mainmenu. In this case I only see  :

## Starting application at 0x00001000 ...

+++## Application terminated, rc = 0x0

Even the '$' sign from the beginning of my program is not printed on the console. What am I doing wrong ?

 

Filip

TranslateQuoteReplyEditDelete

 

 

2009-10-30 11:11:14     Re: u-boot newbie

Filip Vanalme (BELGIUM)

Message: 81913   

 

Problem solved by making the called function static.

TranslateQuoteReplyEditDelete

 

 

2009-10-30 12:31:18     Re: u-boot newbie

Mike Frysinger (UNITED STATES)

Message: 81918   

 

the loader probably doesnt handle relocation.  not sure if this is by design or a bug.

QuoteReplyEditDelete

 

 

2009-11-04 08:45:45     Re: u-boot newbie

Filip Vanalme (BELGIUM)

Message: 82053   

 

I now wrote kind of a configuration program that runs from u-boot prompt. Works fine, but at the end of the configuration, I would like to reset the board. I hoped that the function do_reset() would do this, but it seems not to work. The program quits without rebooting. Do I have to modify other things before a reset will work ?

Is there a way to execute a command line command from within a u-boot runned program ( maybe something similar to the 'system()' call that can be used in a user mode application program)

 

Filip

TranslateQuoteReplyEditDelete

 

 

2009-11-04 08:56:39     Re: u-boot newbie

Mike Frysinger (UNITED STATES)

Message: 82054   

 

looks like a bug in the jump table init

 

try editing common/exports.c and adding a line like:

    gd->jt[XF_do_reset] = (void *) do_reset;

QuoteReplyEditDelete

 

 

2009-11-04 09:09:14     Re: u-boot newbie

Filip Vanalme (BELGIUM)

Message: 82055   

 

Thanks Mike !

 

Seems to work now.

 

Filip

Attachments

    Outcomes