Forum Discussion
Altera_Forum
Honored Contributor
19 years agoSorry. To be more accurate: g++ under Windows or Linux? I knowed that g++ didn't work under Linux. Right?
--- Quote Start --- originally posted by shachris23@Jan 17 2006, 01:16 AM http://forum.niosforum.com/work2/style_emoticons/<#emo_dir#>/smile.gif hi paolo and everybody,
the problem is solved. the error happened because of the link flags that i passed when the program was linking.
at first, i didn't strictly follow microtronix's linking flags, and just used
$(cc) -o <program> $(mylibs) $(ldlibs)
and when i changed to
$(cc) $(ldflags) -o <program> -lpthread $(mylibs) $(ldlibs)
voila, the program links with no problem.
so i guess the lesson learned is if it aint broke, dont mess with it.
but thanks paolo so much for your detailed response. i sure learned new things, and i will try it next time i encountered problems like this again. http://forum.niosforum.com/work2/style_emoticons/<#emo_dir#>/smile.gif
--- quote start ---
originally posted by paolo.gai+jan 14 2006, 03:21 am--><div class='quotetop'>quote (paolo.gai @ jan 14 2006, 03:21 am)
--- quote end ---
--- quote start ---
<!--quotebegin-shachris23@jan 14 2006, 03:37 am
It does work when I link to a dummy application. However, is there a way to increase the size though for global pointer though? Because we tried compiling and linking the same project under Fedora Core 4 with the gcc version 3.4.1, and it linked in just fine. Thus, we suspect this is a NIOS-II-specific problem? What does everybody think? <div align='right'><{post_snapback}> (index.php?act=findpost&pid=12190) --- Quote End --- [/b] --- Quote End --- Yes, because the Nios compiler uses a register to speedup data access. In general you cannot increase the amount of GP-relative memory, but there are two ways: You can either - compile using the -G0 option or, - put your small data (global ints, global chars, ...) inside a struct, or allocate them in another section... you can try something like
int foo __attribute__ ((section (".data"))) = 57;
int bar __attribute__ ((section (".bss"))); // initialized to 0 the section attribute must stay both in the declaration and on the definition of the variables. There is also a section about that in the ERIKA Enterprise manual, section 4.8.4, available for free at the evidence literature page (http://www.evidence.eu.com/nios2/literature.asp) bye Paolo <div align='right'><{post_snapback}> (index.php?act=findpost&pid=12193)</div> [/b] --- Quote End --- <div align='right'><{post_snapback}> (index.php?act=findpost&pid=12228)</div> [/b] --- Quote End ---