Nios® II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
Announcements
Intel Support hours are Monday-Fridays, 8am-5pm PST, except Holidays. Thanks to our community members who provide support during our down time or before we get to your questions. We appreciate you!

Need Forum Guidance? Click here
Search our FPGA Knowledge Articles here.
12434 Discussions

Problem creating a new project with existing source code.

Altera_Forum
Honored Contributor II
1,024 Views

Hello i am using NIOS2 SBT 11.0sp1 and i am trying make a new project with existing source code. 

When i select new project & bsp from template choosing hello world everything compiles and work. 

 

When i select new project & bsp from template choosing blank project and then adding my header files (properties -> application properties-> application libraries and inclues) and my source code (properties -> c/c++ builder path -> c/c++ source code) 

i get an undefined reference to main error pointing to the alt_main file in the bsp/hal/src folder 

 

Any suggestions?
0 Kudos
3 Replies
Altera_Forum
Honored Contributor II
112 Views

Please refer to Nios II Developer's Handbook, page 6-37 and following, 

namely the section named "Boot Sequence and Entry Point". 

alt_main() is the standard entry point for a raw Nios application, while main() is the entry point for a HAL based application. In the latter, an alt_main function is automatically generated which provides system initialization and calls your application main(). 

If you don't use any template, you must define the entry point function: 

void alt_main(void)
Altera_Forum
Honored Contributor II
112 Views

Cris72 thanks for the help. 

However i still get the same error. My .c file is the generated by the "hello world" template. Is really just a printf with hello world. 

 

I tried to change the main to alt_main but the error persists.
Altera_Forum
Honored Contributor II
112 Views

Ok now it works... even setting the path i have to click on the file and select "ADD TO NIOS2 BUILD". 

Isnt there an easier way? I have to do this to every path? Adding the library AND setting it as a nios2 build library.. seriously?
Reply