Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
12748 Discussions

Application Initialization Problem

Altera_Forum
Honored Contributor II
1,147 Views

I have an application that compiles and somewhat runs on my system. However, it's not very impressive because much of the init stuff is not done at after the application is launched. There are a lot of internal "command not found" errors. This is because there are several global constructors that should be called at the startup of the application, and I'm pretty sure this is not being done.  

 

What I think? 

The startup file crt0.o does not make calls to the constructors. I've looked at the crti.o and crtn.o, but for now, this stuff is over my head. 

 

Also what I think? 

I see that the linker script has some entries for *(.ctors.*) and *(.ctors) in the .data section, and nothing in the .text section. My problem here is that I can read the script, but I can't make much sense out of it. Again, over my head for now. 

 

I can run nios2-elf-readelf, and nios2-elf-objdump. Everything seems to be there.  

 

Can I add anything to the linker to get the constructors called? 

 

My linker currently goes something like this. 

 

/cygdrive/c/altera/kits/nios2/bin/nios2-gnutools/H-i686-pc-cygwin/bin/nios2-elf-g++ -o first -Wl,-Bstatic -L../../../li 

b/NiosII/ -msys-crt0=/cygdrive/c/altera/kits/nios2/bin/eclipse/plugins/com.microtronix.nios2linux.uClibc_1.4.0/lib/crt0. 

o -r -d first_registerRecordDeviceDriver.o dbSubExample.o firstMain.o -lxxxSupport -lrecIoc -lsoftDevIoc -liocs 

h -lmiscIoc -lrsrvIoc -ldbtoolsIoc -lasIoc -ldbIoc -lregistryIoc -ldbStaticIoc -lca -lCom -lpthread -lm -lrt -lc 

 

I have copied libm.a, librt.a, and libc.a to the local directory above for now. 

 

Doug
0 Kudos
0 Replies
Reply