« Return to Thread: Local Variable vs Global Variable

Re: Local Variable vs Global Variable

by beking :: Rate this Message:

Reply to Author | View in Thread

hi,华文:
now i want to run "hello world " on my dev_board(cycloneII),but when compiling all .v files,some errors coming,did you come into contact with this error in your experiment,.....
华文 wrote:
hi ! I have run the simple Hello world program on the or1200 processor
following the  Basic custom openrisc system HW/SW tutorial.
The hardware only contains the processor, debug unit,ram and the uart unit.
And  I find a  very strange  phenomenon I do not konw why.
That is  if I modify the hello.c code by making the  'char *str = "Hello
world!!!\n" ' inside the main  funciton, the hello world program can not run
on the or1200 processor.
By modification,there is not a .data section.  Thank you for your attention,
looking forward the answer.

the original codes:
*char *str = "Hello world!!!\n";*
int main (void)
{
  char *s;

  uart_init ();
  for (s = str; *s; s++)
    uart_putc (*s);

  while (1)
    uart_putc (uart_getc () + 1);

  return 0;
}

---->by modification:
int main (void)
{
  char *s;
  *char *str = "Hello world!!!\n";*
  uart_init ();
  for (s = str; *s; s++)
    uart_putc (*s);

  while (1)
    uart_putc (uart_getc () + 1);

  return 0;

}

_______________________________________________
http://www.opencores.org/mailman/listinfo/openrisc

 « Return to Thread: Local Variable vs Global Variable