« Return to Thread: Local Variable vs Global Variable
Robert Cragie, Design
Engineer
_______________________________________________________________
Jennic
Ltd, Furnival Street, Sheffield, S1 4QT, UK
http://www.jennic.com Tel:
+44 (0) 114 281
2655
_______________________________________________________________
-----Original Message-----
From: openrisc-bounces@... [mailto:openrisc-bounces@...]On Behalf Of »ªÎÄ
Sent: 24 October 2007 09:17
To: openrisc@...
Subject: [openrisc] Local Variable vs Global Variablehi ! 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;
}
« Return to Thread: Local Variable vs Global Variable
| Free embeddable forum powered by Nabble | Forum Help |