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++
12652 Diskussionen

Building static library with NIOS II Software Build Tools for Eclipse 13.0

Altera_Forum
Geehrter Beitragender II
2.046Aufrufe

Hello, 

I has started to work with the NIOS II Software Build Tools for Eclipse in version 13.0sp1 since two weeks.  

There I am going to build a static library. Therefore, I used the guidance of the NIOS II Software Developer’s Handbook (page 2-25, May 2011).  

I followed the example creating a software package for the BSP (which contains building a static library).  

The problem is that the library is always empty and the build process does not include any source files/object files. 

 

The generated makefile of the nios ii library project calls: 

 

make all  

info: archiving obj/default/libexample_sw_package_library.a 

rm -f -f obj/default/libexample_sw_package_library.a 

mkdir -p obj/default 

nios2-elf-ar -src obj/default/libexample_sw_package_library.a  

cp -f obj/default/libexample_sw_package_library.a libexample_sw_package_library.a 

 

If I go to console myself and compile the lib as following, I am able to generate a lib with content: 

 

nios2-elf-g++ -c *.cpp 

ar rvs libname.a *.o 

 

I tried also the NIOS II Software Build Tools for Eclipse in version 13.0 and 11.0, but they perform equal. 

For me it seems so as if the Nios II Library project or the documentation has a bug.  

Perhaps some can help me to find a way to build the lib in eclipse, in the best case without changing manually the eclipse generated makefile? 

 

Thank you very much in advance.  

 

Stefan
0 Kudos
3 Antworten
Altera_Forum
Geehrter Beitragender II
1.166Aufrufe

Hi  

 

Im also having build problems in Nios2 SBT in both version 8.1 and 9.1. Below is the error message. Please help. Thank you 

**** Build of configuration Nios II for project test_bsp **** 

 

 

make all  

Compiling alt_alarm_start.c... 

nios2-elf-gcc -xc -MP -MMD -c -I./drivers/inc -I. -I./drivers/inc -I./HAL/inc -DSYSTEM_BUS_WIDTH=32 -D__hal__ -pipe -DALT_NO_INSTRUCTION_EMULATION -DALTERA_TRIPLE_SPEED_MAC -DALT_SINGLE_THREADED -DRO_ZIPFS -O0 -g -Wall -mhw-div -mhw-mul -mno-hw-mulx -o obj/HAL/src/alt_alarm_start.o c:/NIOS-Download/niosii-ethernet-standard-3c25/software/test_bsp/HAL/src/alt_alarm_start.c 

In file included from ./HAL/inc/sys/alt_alarm.h:42, 

from c:/NIOS-Download/niosii-ethernet-standard-3c25/software/test_bsp/HAL/src/alt_alarm_start.c:48: 

./HAL/inc/sys/alt_llist.h:42:23: alt_types.h: No such file or directory 

In file included from ./HAL/inc/sys/alt_alarm.h:42, 

from c:/NIOS-Download/niosii-ethernet-standard-3c25/software/test_bsp/HAL/src/alt_alarm_start.c:48: 

./HAL/inc/sys/alt_llist.h:90: error: syntax error before "void" 

./HAL/inc/sys/alt_llist.h:92: warning: return type defaults to `int' 

./HAL/inc/sys/alt_llist.h:105: error: syntax error before "void" 

./HAL/inc/sys/alt_llist.h:106: warning: return type defaults to `int' 

In file included from ./HAL/inc/sys/alt_alarm.h:45, 

from c:/NIOS-Download/niosii-ethernet-standard-3c25/software/test_bsp/HAL/src/alt_alarm_start.c:48: 

./HAL/inc/priv/alt_alarm.h:42:23: alt_types.h: No such file or directory 

In file included from ./HAL/inc/sys/alt_alarm.h:45, 

from c:/NIOS-Download/niosii-ethernet-standard-3c25/software/test_bsp/HAL/src/alt_alarm_start.c:48: 

./HAL/inc/priv/alt_alarm.h:63: error: syntax error before "alt_u32" 

./HAL/inc/priv/alt_alarm.h:63: warning: no semicolon at end of struct or union 

./HAL/inc/priv/alt_alarm.h:64: error: syntax error before '*' token 

./HAL/inc/priv/alt_alarm.h:64: warning: type defaults to `int' in declaration of `alt_u32' 

./HAL/inc/priv/alt_alarm.h:64: error: `alt_u32' declared as function returning a function 

./HAL/inc/priv/alt_alarm.h:64: warning: data definition has no type or storage class 

./HAL/inc/priv/alt_alarm.h:69: error: syntax error before "rollover" 

./HAL/inc/priv/alt_alarm.h:69: warning: type defaults to `int' in declaration of `rollover' 

./HAL/inc/priv/alt_alarm.h:69: warning: data definition has no type or storage class 

./HAL/inc/priv/alt_alarm.h:72: error: syntax error before '}' token 

./HAL/inc/priv/alt_alarm.h:83: error: syntax error before "_alt_tick_rate" 

./HAL/inc/priv/alt_alarm.h:83: warning: type defaults to `int' in declaration of `_alt_tick_rate' 

./HAL/inc/priv/alt_alarm.h:83: warning: data definition has no type or storage class 

./HAL/inc/priv/alt_alarm.h:91: error: syntax error before "_alt_nticks" 

./HAL/inc/priv/alt_alarm.h:91: warning: type defaults to `int' in declaration of `_alt_nticks' 

./HAL/inc/priv/alt_alarm.h:91: warning: data definition has no type or storage class 

In file included from c:/NIOS-Download/niosii-ethernet-standard-3c25/software/test_bsp/HAL/src/alt_alarm_start.c:48: 

./HAL/inc/sys/alt_alarm.h:68: error: syntax error before "alt_u32" 

./HAL/inc/sys/alt_alarm.h:69: error: `alt_alarm_start' declared as function returning a function 

./HAL/inc/sys/alt_alarm.h:70: error: syntax error before "void" 

./HAL/inc/sys/alt_alarm.h:83: error: syntax error before "alt_u32" 

./HAL/inc/sys/alt_alarm.h:84: warning: return type defaults to `int' 

./HAL/inc/sys/alt_alarm.h:93: error: syntax error before "int" 

./HAL/inc/sys/alt_alarm.h:93: error: syntax error before "nticks" 

./HAL/inc/sys/alt_alarm.h:94: warning: return type defaults to `int' 

./HAL/inc/sys/alt_alarm.h: In function `alt_sysclk_init': 

./HAL/inc/sys/alt_alarm.h:97: error: `nticks' undeclared (first use in this function) 

./HAL/inc/sys/alt_alarm.h:97: error: (Each undeclared identifier is reported only once 

./HAL/inc/sys/alt_alarm.h:97: error: for each function it appears in.) 

./HAL/inc/sys/alt_alarm.h: At top level: 

./HAL/inc/sys/alt_alarm.h:110: error: syntax error before "alt_u32" 

./HAL/inc/sys/alt_alarm.h:111: warning: return type defaults to `int' 

c:/NIOS-Download/niosii-ethernet-standard-3c25/software/test_bsp/HAL/src/alt_alarm_start.c:49:25: sys/alt_irq.h: No such file or directory 

c:/NIOS-Download/niosii-ethernet-standard-3c25/software/test_bsp/HAL/src/alt_alarm_start.c:77: error: syntax error before "alt_u32" 

c:/NIOS-Download/niosii-ethernet-standard-3c25/software/test_bsp/HAL/src/alt_alarm_start.c:78: error: `alt_alarm_start' declared as function returning a function 

c:/NIOS-Download/niosii-ethernet-standard-3c25/software/test_bsp/HAL/src/alt_alarm_start.c:79: error: syntax error before "void" 

c:/NIOS-Download/niosii-ethernet-standard-3c25/software/test_bsp/HAL/src/alt_alarm_start.c:82: warning: type defaults to `int' in declaration of `current_nticks' 

c:/NIOS-Download/niosii-ethernet-standard-3c25/software/test_bsp/HAL/src/alt_alarm_start.c:82: warning: data definition has no type or storage class 

c:/NIOS-Download/niosii-ethernet-standard-3c25/software/test_bsp/HAL/src/alt_alarm_start.c:84: error: syntax error before "if" 

c:/NIOS-Download/niosii-ethernet-standard-3c25/software/test_bsp/HAL/src/alt_alarm_start.c:91: warning: type defaults to `int' in declaration of `irq_context' 

c:/NIOS-Download/niosii-ethernet-standard-3c25/software/test_bsp/HAL/src/alt_alarm_start.c:91: warning: implicit declaration of function `alt_irq_disable_all' 

c:/NIOS-Download/niosii-ethernet-standard-3c25/software/test_bsp/HAL/src/alt_alarm_start.c:91: error: initializer element is not constant 

c:/NIOS-Download/niosii-ethernet-standard-3c25/software/test_bsp/HAL/src/alt_alarm_start.c:91: warning: data definition has no type or storage class 

c:/NIOS-Download/niosii-ethernet-standard-3c25/software/test_bsp/HAL/src/alt_alarm_start.c:93: warning: type defaults to `int' in declaration of `current_nticks' 

c:/NIOS-Download/niosii-ethernet-standard-3c25/software/test_bsp/HAL/src/alt_alarm_start.c:93: error: redefinition of 'current_nticks' 

c:/NIOS-Download/niosii-ethernet-standard-3c25/software/test_bsp/HAL/src/alt_alarm_start.c:82: error: previous definition of 'current_nticks' was here 

c:/NIOS-Download/niosii-ethernet-standard-3c25/software/test_bsp/HAL/src/alt_alarm_start.c:93: error: initializer element is not constant 

c:/NIOS-Download/niosii-ethernet-standard-3c25/software/test_bsp/HAL/src/alt_alarm_start.c:93: warning: data definition has no type or storage class 

c:/NIOS-Download/niosii-ethernet-standard-3c25/software/test_bsp/HAL/src/alt_alarm_start.c:95: error: syntax error before '->' token 

c:/NIOS-Download/niosii-ethernet-standard-3c25/software/test_bsp/HAL/src/alt_alarm_start.c:111: error: syntax error before '&' token 

c:/NIOS-Download/niosii-ethernet-standard-3c25/software/test_bsp/HAL/src/alt_alarm_start.c:111: warning: type defaults to `int' in declaration of `alt_llist_insert' 

c:/NIOS-Download/niosii-ethernet-standard-3c25/software/test_bsp/HAL/src/alt_alarm_start.c:111: warning: data definition has no type or storage class 

c:/NIOS-Download/niosii-ethernet-standard-3c25/software/test_bsp/HAL/src/alt_alarm_start.c:112: warning: type defaults to `int' in declaration of `alt_irq_enable_all' 

c:/NIOS-Download/niosii-ethernet-standard-3c25/software/test_bsp/HAL/src/alt_alarm_start.c:112: warning: parameter names (without types) in function declaration 

c:/NIOS-Download/niosii-ethernet-standard-3c25/software/test_bsp/HAL/src/alt_alarm_start.c:112: warning: data definition has no type or storage class 

c:/NIOS-Download/niosii-ethernet-standard-3c25/software/test_bsp/HAL/src/alt_alarm_start.c:114: error: syntax error before "return" 

{standard input}: Assembler messages: 

{standard input}:52: Error: symbol `current_nticks' is already defined 

make: *** [obj/HAL/src/alt_alarm_start.o] Error 1
Altera_Forum
Geehrter Beitragender II
1.166Aufrufe

Did either of you guys have an success with this? Seems to be a common problem

Altera_Forum
Geehrter Beitragender II
1.166Aufrufe

I realize this is an old post, but this might help others. 

 

You need to call these command from the Nios II Command Shell: 

To clear the sources from the makefile: 

nios2-lib-update-makefile --lib-dir /path/to/your/lib --no-src 

To insert all source files in the folder to the makefile: 

nios2-lib-update-makefile --lib-dir /path/to/your/lib --add-src-rdir /path/to/your/sources 

 

You can read the NIOS-II manual for more info on this.
Antworten