Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
16 years ago

Error in Hello_world_small compilation !

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 ?

13 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

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

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    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;

    }

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

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