Intel® Quartus® Prime Software
Intel® Quartus® Prime Design Software, Design Entry, Synthesis, Simulation, Verification, Timing Analysis, System Design (Platform Designer, formerly Qsys)
17254 Discussions

Error in Hello_world_small compilation !

Altera_Forum
Honored Contributor II
4,051 Views

Hi, 

 

I'm just trying to get nios II ide to work with a simple Hello_world_small application. 

But I get a compilation error related to the "alt_putstr()" function... 

The board is working without this function (ie. led counting etc..) 

 

I leave all the setting to the defaults settings ... 

 

Here, the first error : 

/cygdrive/c/altera/81/nios2eds/components/altera_hal/HAL/src/alt_putstr.c undefined reference to `null' 

 

Then the following 4 errors are related to this function... 

 

Here the console output : 

**** Build of configuration Release for project hello_world_small_1 **** make -s all includes Compiling hello_world_small.c... Linking hello_world_small_0.elf... /cygdrive/c/NiosII/software/hello_world_small_0_syslib/Release/libhello_world_small_0_syslib.a(alt_putstr.o)(.text+0x1c): In function `alt_putstr': /cygdrive/c/altera/81/nios2eds/components/altera_hal/HAL/src/alt_putstr.c:64: undefined reference to `null' /cygdrive/c/NiosII/software/hello_world_small_0_syslib/Release/libhello_world_small_0_syslib.a(alt_putstr.o)(.text+0x20):/cygdrive/c/altera/81/nios2eds/components/altera_hal/HAL/src/alt_putstr.c:64: undefined reference to `null' /cygdrive/c/NiosII/software/hello_world_small_0_syslib/Release/libhello_world_small_0_syslib.a(alt_putstr.o)(.text+0x28):/cygdrive/c/altera/81/nios2eds/components/altera_hal/HAL/src/alt_putstr.c:64: undefined reference to `ALT_MODULE_CLASS_null_write' /cygdrive/c/NiosII/software/hello_world_small_0_syslib/Release/libhello_world_small_0_syslib.a(alt_putstr.o)(.text+0x2c):/cygdrive/c/altera/81/nios2eds/components/altera_hal/HAL/src/alt_putstr.c:64: undefined reference to `ALT_MODULE_CLASS_null_write' collect2: ld returned 1 exit status make: *** Error 1 Build completed in 14.321 seconds  

 

Please help me, what's wrong ?
0 Kudos
13 Replies
Altera_Forum
Honored Contributor II
2,388 Views

i think you can turn off the lightweight device driver API to get around this.

0 Kudos
Altera_Forum
Honored Contributor II
2,388 Views

Thank you very much for your fast reply.. 

But what is the lightweight driver ? 

And where I can turn off this driver ? 

 

Thanks...
0 Kudos
Altera_Forum
Honored Contributor II
2,388 Views

in Nios IDE right click on your project hello_world_small0 and go down to System Library Properties. then uncheck the Lightweight device driver API box.

0 Kudos
Altera_Forum
Honored Contributor II
2,388 Views

thepancake !! Thank you ! 

 

It was my problem !! 

Now I don't have this problem !!! 

 

 

But, I don't see anything in the console of the nios II IDE... 

 

How can I get message in the console ? 

 

Thank you again for your previous fast replies !!
0 Kudos
Altera_Forum
Honored Contributor II
2,388 Views

make sure the stdout is set as jtag_uart in the same System Libraries window. 

 

then run on your target hardware.
0 Kudos
Altera_Forum
Honored Contributor II
2,388 Views

Man, you're the best ! 

Thank you for your fast reply ! 

 

I don't have the choice... 

I have only the "null" choice in the stdout, even in the stdin and stderr etc..
0 Kudos
Altera_Forum
Honored Contributor II
2,388 Views

What's wrong ?

0 Kudos
Altera_Forum
Honored Contributor II
2,388 Views

Uhhh... I forgot to place the jtag_uart module in SOPC... 

 

Now I have jtag_uart_0, which is appear...  

 

But even it's selected, I don't have any echos in the console ? 

 

Here : the output of the console 

Using cable "USB-Blaster ", device 1, instance 0x00 Pausing target processor: OK Initializing CPU cache (if present) OK Downloading 00002000 ( 0%) Downloaded 3KB in 0.0s Verifying 00002000 ( 0%) Verified OK Leaving target processor paused  

 

I made some reset (hard reset with a push button..) and I don't have anything else in the console output... 

 

What's is wrong please ?
0 Kudos
Altera_Forum
Honored Contributor II
2,388 Views

is the clock connected and are you sure the reset is of correct polarity, it should be active high. i am not sure whether NIOS IDE will download the program file if either the clock or reset is not connected correctly. you might check niosforum.com for similar issues.

0 Kudos
Altera_Forum
Honored Contributor II
2,388 Views

Hi, i'm using Nios2 9.1 and i'm getting the same error...i cant find any system library properties...any way to solve it? 

 

*Solved the problem by adding a JTAG_UART (stdout device) in SOPC
0 Kudos
Altera_Forum
Honored Contributor II
2,388 Views

i use quartus 10.1,and i can't find what you say " uncheck the Lightweight device driver API box",eager for your answer

0 Kudos
Altera_Forum
Honored Contributor II
2,388 Views

I too hit this issue. It is rather a shame that the HAL does not provide the trivial support required to have both Lightweight Drivers enabled *and* no stdin/stdout/stderr devices selected. 

 

The solution is pretty trivial. Drop something like this into a .c file in your project: 

 

struct ALT_MODULE_CLASS_null_state_s {void * dummy;} null; 

int alt_module_class_null_write(struct ALT_MODULE_CLASS_null_state_s * sp, const char* ptr, int len, int flags) 

return len; 

0 Kudos
Altera_Forum
Honored Contributor II
2,388 Views

I've had this issue on my board when I had switch for programm/run located in the wrong position.

0 Kudos
Reply