Forum Discussion

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

library compilation problem

I'm trying to build the eCos library for a board that includes a LAN91C111 ethernet interface. I started the nios2configtool in the prescribed manner, specifying my ptf file and giving the name of the cpu. I then went to build, templates and added the net package. When I tried to build the library, I got the compilation error shown below.

The error message ends up being a little obscure in that it grows out of a bunch of nested includes and inlines. As nearly as I can tell, though, the implementation of altera_avalon_lan91c11_get_esa is not being included from altera_avalon_lan91c111.inl - probably because EXT_FLASH_BASE is not defined. I believe that this becomes a problem later in the same file when the lan91cxx_priv_data is defined. I don't really want this implementation of the get_esa function, but I think that I do need to have a prototype and an extern declaration in order to get the priv_data initializer to compile.

I can see where I could change the name of CYGDAT_LAN91C111_GET_ESA in the configtool, but it isn't clear that this would do me any good. I would still need a prototype and an extern declaration.

Compilation error:

nios2-elf-gcc -c -I/cygdrive/c/kla/mci_ecos/mci_nios_install/include -I/cygdrive/c/altera/kits/nios2/components/ecos/ecos-current/packages/devs/eth/smsc/lan91cxx/current -I/cygdrive/c/altera/kits/nios2/components/ecos/ecos-current/packages/devs/eth/smsc/lan91cxx/current/src -I/cygdrive/c/altera/kits/nios2/components/ecos/ecos-current/packages/devs/eth/smsc/lan91cxx/current/tests -I. -I/cygdrive/c/altera/kits/nios2/components/ecos/ecos-current/packages/devs/eth/smsc/lan91cxx/current/src/ -finline-limit=7000 -g -O3 -ffunction-sections -fdata-sections -fno-exceptions -DSYSTEM_BUS_WIDTH=32 -mno-hw-mul -mno-hw-div -D_KERNEL -D__ECOS -Wp,-MD,src/if_lan91cxx.tmp -o src/devs_eth_smsc_lan91cxx_if_lan91cxx.o /cygdrive/c/altera/kits/nios2/components/ecos/ecos-current/packages/devs/eth/smsc/lan91cxx/current/src/if_lan91cxx.c

make[1]: Leaving directory `/cygdrive/c/kla/mci_ecos/mci_nios_build/devs/eth/smsc/lan91cxx/current'

In file included from /cygdrive/c/kla/mci_ecos/mci_nios_install/include/cyg/sopc/altera_avalon_lan91c111.inl:144,

make: Leaving directory `/cygdrive/c/kla/mci_ecos/mci_nios_build'

from /cygdrive/c/altera/kits/nios2/components/ecos/ecos-current/packages/devs/eth/smsc/lan91cxx/current/src/smsc_lan91cxx.h:340,

from /cygdrive/c/altera/kits/nios2/components/ecos/ecos-current/packages/devs/eth/smsc/lan91cxx/current/src/if_lan91cxx.c:153:

/cygdrive/c/kla/mci_ecos/mci_nios_install/include/cyg/hal/devices.h:300: error: `altera_avalon_lan91c111_get_esa' undeclared here (not in a function)

/cygdrive/c/kla/mci_ecos/mci_nios_install/include/cyg/hal/devices.h:300: error: initializer element is not constant

/cygdrive/c/kla/mci_ecos/mci_nios_install/include/cyg/hal/devices.h:300: error: (near initialization for `mac_priv_data.config_enaddr')

/cygdrive/c/kla/mci_ecos/mci_nios_install/include/cyg/hal/devices.h:300: warning: initialization makes pointer from integer without a cast

make[1]: *** [src/if_lan91cxx.o.d] Error 1

make: *** [build] Error 2

1 Reply

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

    Yes, you're right. There is a definite problem here. One way round it would be to add the external decleration to altera_avalon_lan91c111.inl:

    extern void CYGDAT_LAN91C111_GET_ESA(struct lan91cxx_priv_data* cpd);

    This would then allow you to provide externally the function with the name you defined in the configtool. However this will require you to use the header file smsc_lan91cxx.h, which is private to the lan91cxx component - so that's not a very satisfying solution.

    In the short term you can simply provide your own function in altera_avalon_lan91c111.inl to set the MAC address, and we can look at providing a better solution for the next release.

    Thanks for pointing this out!