This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

ndk_2_23_01_01 _INCLUDE_NIMU_CODE undefined

I would like to know when and how the _INCLUDE_NIMU_CODE should be defined for the NDK.

I previously was advised that the reason for IFSetPad undefined error in linking a project with PPP was because the if.c file is encased in

#ifndef _INCLUDE_NIMU_CODE

I overcame this by copying the if.c file into my project director and removing the #ifndef wrapper.

However this then makes me wonder are there other bits of code I should be executing which are not because _INCLUDE_NIMU_CODE is not defined

I have searched everywhere and can find a couple of other instances where people have had linker errors because this is not defined but no instructions as to when it should be defined and where that define needs to be made.

There is reference to adding -D _INCLUDE_NIMU_CODE to the compiler, but in which file do I do this and under what conditions? I don't wish to randomly search through all the NDK files in the hope of finding the one which needs it added.

  • Narrowed the problem down a little.

    I have to rebuild the NDK to allow the use of PPP

    When I do this the build functions do -D _INCLUDE_NIMU_CODE which means the file

    tirtos_tivac_2_00_01_23\products\ndk_2_23_01_01\packages\ti\ndk\stack\res\if.c will effectively NOT be compiled as all the code is wrapped in #ifndef _INCLUDE_NIMU_CODE

    However this means the function IFSetPad doesn't exist anywhere in the library.

    This appears to be an error in the if.c file which should have the IFSetPad function outside the #ifndef _INCLUDE_NIMU_CODE

    This is also the case for the resif.h file (Although this doesn't have a problem as it includes a prototype bot in the condition and the #else

    However further confusion arises because IFSetPad just sets static variables in the if.c file so unless you also call IFCreatePacket you are just setting a static variable and then never using it?

    Would be good to know if I actually need to use the IFSetPad at all for my PPP over serial code, examples use it but evaluating NDK code indicates it will do nothing???

     

  • Hi Barry,

    Sorry for the delayed response.

    TIRTOS drivers are “NIMU compliant drivers” (NIMU is the current driver design).The IFSetPad API is only used by the (outdated) non-NIMU driver design, which is no longer supported. Instead, you can use the NIMU version of PPP/PPPoE, which does not need IFSetPad().

    For example, the code is in the “NIMU flavor” of the PPP files:
    • ti/ndk/stack/ppp/nimuppp.c
    • ti/ndk/stack/pppoe/nimupppoe.c

    To use these libraries, you will need to re-build the NDK as TI-RTOS ships the base libraries only.

    To rebuild NDK library, open tirtos.mak (its in the ti-rtos root directory). Set BUILDMINSTACK_CONFIG variable to the following value:

    BUILDMINSTACK_CONFIG     := BUILDMINSTACK=0

    Run make

    make -f tirtos.mak ndk

    Once the libraries are built, in your application .cfg file add PPP module. This will automatically link in the correct flavor of the library with NIMU and PPP. The different flavors of library that are supported are described in UG in section 1.3.4 The Stack Library. You can verify that the correct library is linked by checking the linker.cmd generated under Debug/configPkg directory.

    now you can use the PPP APIs without needing the IFSetPad APIs.

    Hope this helps.

    Vikram

  • Hello Vikram

    Thanks for the response and confirming I don't need to use IFSetPad.

    I now have everything working with the PPP.

    The problem for me was that the included header says IFSetPad() is part of the NIMU and the examples I found from NDK 2.0 called this function.  However linking gave an error as the function didn't exist for NIMU.

    I went through the code and determined it did nothing and as such should not be included in the header code for NIMU version.  It is defined in the header resif.h but conditionally removed from the actual code.  Should also be removed from the header to avoid confusion.

    Below is from resif.h

    /* NIMU */
    #define IFGetType(h) (((NETIF_DEVICE *)(h))->type)
    #define IFGetIndex( h ) (((NETIF_DEVICE *)(h))->index)
    #define IFGetMTU( h ) (((NETIF_DEVICE *)(h))->mtu)

    _extern void IFSetPad( uint Header, uint Trailer );

    #endif /* _INCLUDE_NIMU_CODE */

     

  • Thanks Barry! I will pass on the feedback to the networking team.

  • Just checked with the networking team. This issue has been taken care of in the NDK v2.24.

    Vikram