|
View:
New views
4 Messages
—
Rating Filter:
Alert me
|
|
|
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 (); while (1) return 0; ---->by modification: while (1) return 0; } _______________________________________________ http://www.opencores.org/mailman/listinfo/openrisc |
|
|
RE: Local Variable vs Global VariableThere
won't be a .data section as the pointer is now an auto variable and will be
either a register or on the stack (most likely a register). So there is no
static variable anymore. The string itself will I presume be stored in .rodata -
check the output using or32-uclinux-objdump.
Robert Cragie, Design
Engineer
_______________________________________________ http://www.opencores.org/mailman/listinfo/openrisc |
|
|
Re: Local Variable vs Global Variablehi,华文:
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,.....
|
|
|
Re: Local Variable vs Global Variable* Robert Cragie <rcc@...> wrote:
> There won't be a .data section as the pointer is now an auto variable and > will be either a register or on the stack (most likely a register). So there > is no static variable anymore. The string itself will I presume be stored in > .rodata - check the output using or32-uclinux-objdump. BTW: what happens if that global variable is changed to static const char* ? cu -- --------------------------------------------------------------------- Enrico Weigelt == metux IT service - http://www.metux.de/ --------------------------------------------------------------------- Please visit the OpenSource QM Taskforce: http://wiki.metux.de/public/OpenSource_QM_Taskforce Patches / Fixes for a lot dozens of packages in dozens of versions: http://patches.metux.de/ --------------------------------------------------------------------- _______________________________________________ http://www.opencores.org/mailman/listinfo/openrisc |
| Free embeddable forum powered by Nabble | Forum Help |