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.

AM4376: tcpecho example and sntp

Part Number: AM4376
Other Parts Discussed in Thread: SYSBIOS

Hello,

TI_RTOS is used.

1) I want to use tcpecho example. how to generate project for the same?

2) what is the difference between

2.1)C:\ti\pdk_am437x_1_0_17\packages\ti\transport\ndk\nimu
and 2.2) C:\ti\pdk_am437x_1_0_17\packages\ti\transport\ndk\nimu_icss??
3) if i want to run tcpecho and other application along with EIP adapter functionality is it possible?

or do i have to create two different projcet (binaries) ?

4) How to add sntp example to EIP adapter project?

Regards,

Vrund

  • Vrund,

    1) You can start from processor_sdk_rtos_am437x_6_03_00_106\demos\rtos_template_app project and then add the tcpecho server example described in NDK API user guide section 5.4.2 Server Daemon Example to the project.

    2) \ndk\nimu is based on CPSW whearas the nimu_Icss is based on ICSS_EMAC.

    3) You can integrate the tcpecho into the EIP.

    4) Essentially you can use one of the methods below

    1. You want to use default NTP servers (SNTP_getTime(), with a NULL server list)
    2. You have the string names of one or more NTP servers (SNTP_getTime(), with your server list)
    3. You have the sockaddr of the NTP server (SNTP_getTimeByAddr(), with your sockaddr)

    as explained in file:///C:/ti/ns_2_40_01_02/docs/ns/html/group__ti__net__sntp__SNTP.html#details to the EIP project.

    Regards,

    Garrett

  • Hello,

    1) You can start from processor_sdk_rtos_am437x_6_03_00_106\demos\rtos_template_app project and then add the tcpecho server example described in NDK API user guide section 5.4.2 Server Daemon Example to the project.

    -- I have created the project and add demon.c  example provided "C:\ti\ndk_3_40_01_01\packages\ti\ndk\nettools\daemon" but it is not getting build. below is the build log.

    **** Build of configuration Debug for project rtos_template_app_am335x_a8 ****

    "C:\\ti\\ccsv7\\utils\\bin\\gmake" -k -j 8 all -O 

    gmake[1]: Entering directory 'C:/Users/vrund rana/workspace_v7/rtos_template_app_am335x_a8/Debug'

    'Building file: ../main.cfg'

    'Invoking: XDCtools'

    "C:/ti/xdctools_3_50_03_33_core/xs" --xdcpath="C:/ti/bios_6_73_00_12/packages;C:/ti/pdk_am335x_1_0_12/packages;C:/ti/ccsv7/ccs_base;" xdc.tools.configuro -o configPkg -t gnu.targets.arm.A8F -p ti.platforms.evmAM3359 -r release -c "C:/ti/gcc-arm-none-eabi-6-2017-q1-update" "../main.cfg"

    making package.mak (because of package.bld) ...

    generating interfaces for package configPkg (because package/package.xdc.inc is older than package.xdc) ...

    configuring main.xa8fg from package/cfg/main_pa8fg.cfg ...

    generating custom ti.sysbios library makefile ... 

    Linking with library ti.drv.spi:./lib/am335x/a8/release/ti.drv.spi.aa8fg

    Linking with library ti.drv.uart:./lib/am335x/a8/release/ti.drv.uart.aa8fg

    Linking with library ti.drv.i2c:./lib/am335x/a8/release/ti.drv.i2c.aa8fg

    Linking with library ti.csl:./lib/am335x/a8/release/ti.csl.aa8fg

    Linking with library ti.osal:./lib/tirtos/a8/release/ti.osal.aa8fg

    Starting build of library sources ...

    making C:/Users/VRUNDR~1/workspace_v7/rtos_template_app_am335x_a8/src/sysbios/sysbios.aa8fg ...

    gmake[1]: Entering directory `C:/Users/VRUNDR~1/workspace_v7/rtos_template_app_am335x_a8/src/sysbios'

    gmake[1]: Nothing to be done for `all'.

    gmake[1]: Leaving directory `C:/Users/VRUNDR~1/workspace_v7/rtos_template_app_am335x_a8/src/sysbios'

    Build of libraries done.

    cla8fg package/cfg/main_pa8fg.c ...

    'Finished building: ../main.cfg'

    ' '

    gmake[1]: Leaving directory 'C:/Users/vrund rana/workspace_v7/rtos_template_app_am335x_a8/Debug'

    'Building file: ../daemon.c'

    'Invoking: GNU Compiler'

    "C:/ti/gcc-arm-none-eabi-6-2017-q1-update/bin/arm-none-eabi-gcc.exe" -c -mcpu=cortex-a8 -mtune=cortex-a8 -march=armv7-a -marm -mfloat-abi=hard -Dam3358 -DevmAM335x -DSOC_AM335x -I"C:/Users/vrund rana/workspace_v7/rtos_template_app_am335x_a8" -I"C:/ti/gcc-arm-none-eabi-6-2017-q1-update/arm-none-eabi/include" -g -gdwarf-3 -gstrict-dwarf -Wall -MMD -MP -MF"daemon.d" -MT"daemon.o" -o"daemon.o" @"configPkg/compiler.opt" "../daemon.c"

    subdir_rules.mk:9: recipe for target 'daemon.o' failed

    ../daemon.c:42:21: fatal error: netmain.h: No such file or directory

     #include <netmain.h>

                         ^

    compilation terminated.

    gmake: *** [daemon.o] Error 1

    'Building file: ../main.c'

    'Invoking: GNU Compiler'

    "C:/ti/gcc-arm-none-eabi-6-2017-q1-update/bin/arm-none-eabi-gcc.exe" -c -mcpu=cortex-a8 -mtune=cortex-a8 -march=armv7-a -marm -mfloat-abi=hard -Dam3358 -DevmAM335x -DSOC_AM335x -I"C:/Users/vrund rana/workspace_v7/rtos_template_app_am335x_a8" -I"C:/ti/gcc-arm-none-eabi-6-2017-q1-update/arm-none-eabi/include" -g -gdwarf-3 -gstrict-dwarf -Wall -MMD -MP -MF"main.d" -MT"main.o" -o"main.o" @"configPkg/compiler.opt" "../main.c"

    'Finished building: ../main.c'

    ' '

    'Building file: ../app.c'

    'Invoking: GNU Compiler'

    "C:/ti/gcc-arm-none-eabi-6-2017-q1-update/bin/arm-none-eabi-gcc.exe" -c -mcpu=cortex-a8 -mtune=cortex-a8 -march=armv7-a -marm -mfloat-abi=hard -Dam3358 -DevmAM335x -DSOC_AM335x -I"C:/Users/vrund rana/workspace_v7/rtos_template_app_am335x_a8" -I"C:/ti/gcc-arm-none-eabi-6-2017-q1-update/arm-none-eabi/include" -g -gdwarf-3 -gstrict-dwarf -Wall -MMD -MP -MF"app.d" -MT"app.o" -o"app.o" @"configPkg/compiler.opt" "../app.c"

    'Finished building: ../app.c'

    ' '

    gmake: Target 'all' not remade because of errors.

    **** Build Finished ****

    Kindly suggest.

    Regards,

    /* * Copyright (c) 2014-2017, Texas Instruments Incorporated * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * *  Redistributions of source code must retain the above copyright *    notice, this list of conditions and the following disclaimer. * * *  Redistributions in binary form must reproduce the above copyright *    notice, this list of conditions and the following disclaimer in the *    documentation and/or other materials provided with the distribution. * * *  Neither the name of Texas Instruments Incorporated nor the names of *    its contributors may be used to endorse or promote products derived *    from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * *//* * ======== daemon.c ======== * * This file implements a simple network daemon. * */
    #include <string.h>#include <stdint.h>
    #include <netmain.h>#include <_stack.h>
    /********************************************************************** *************************** Local Definitions ************************ **********************************************************************/
    #define DAEMON_MAXRECORD  12
    /********************************************************************** *************************** Local Structures ************************* **********************************************************************/
    /**  * @brief  *  The structure describes the Daemon Entry. */typedef struct {    /**     * @brief   Type of socket. For V4 this could be SOCK_STREAM,      * SOCK_STREAMNC, SOCK_DGRAM But for V6 this can only be      * SOCK_STREAM and SOCK_DGRAM.      */    uint32_t    Type;
        /**     * @brief   Local V4 Address to which the socket is bound to     *  For most cases this is passed as INADDR_ANY     */    uint32_t    LocalAddress;
    #ifdef _INCLUDE_IPv6_CODE    /**     * @brief   Local V6 address to which the socket is bound to     *  For most cases this is passed as IPV6_UNSPECIFIED_ADDRESS.     */    IP6N        LocalV6Address;#endif
        /**     * @brief   Local Port to which the daemon will be bound to     * This cannot be NULL.     */    uint32_t    LocalPort;
        /**     * @brief   Call back function which is invoked when data is     * received on the registered daemon.     */    int         (*pCb)(SOCKET,uint32_t);        /**     * @brief   Priority of the child task.     */    uint32_t    Priority;
        /**     * @brief   Stack size of the child task.     */    uint32_t    StackSize;
        /**     * @brief   Argument which is to passed to the call back routine.     */    uint32_t    Argument;
        /**     * @brief   Maximum number of tasks which can be spawned to handle     * the daemon.     */    uint32_t    MaxSpawn;
        /**     * @brief   Internal socket created by the daemon for use.     */    SOCKET      s;
        /**     * @brief   Number of tasks spawned to handle the daemon.     */        uint32_t    TasksSpawned;
        /**     * @brief   Pointer to children.     */    struct _child *pC;} DREC;
    /**  * @brief  *  The structure describes the data instance for daemon child task. */typedef struct _child {    /**     * @brief   Pointer to previous child or NULL     */    struct _child *pPrev;
        /**     * @brief   Pointer to next child or NULL     */        struct _child *pNext;
        /**     * @brief   Handle to the child task     */    void     *hTask;
        /**     * @brief   Socket on which the child task is operating.     */    SOCKET      s;
        /**     * @brief   Flag which determine if the 'child' socket is to be closed     * or not.     */    int         closeSock;} CHILD;
    /********************************************************************** *************************** GLOBAL Structures ************************ **********************************************************************/
    static DREC drec[DAEMON_MAXRECORD];static FDPOLLITEM pollitem[DAEMON_MAXRECORD];
    static void *hDTask = 0;       /* Handle to the main daemon task thread */static void *hDSem = 0;        /* Handle our exclusion semaphore */static uint32_t RequestedRecords; /* Number of initialized records in drec */
    static void daemon();static void dchild( DREC *pd, CHILD *pc );
    /********************************************************************** *************************** DAEMON Functions ************************* **********************************************************************/
    /**  *  @b Description *  @n   *      The function creates a V4 Daemon. * *  @param[in]  Type *      This is the type of socket being opened through the daemon. In the case *      of IPv4 all socket types are supported i.e. SOCK_STREAM, SOCK_STREAMNC and *      SOCK_DGRAM. *  @param[in]  LocalAddress *      This is the Local Address to which the socket will be bound to. *      In most cases this is typically passed as NULL. *  @param[in]  LocalPort *      This is the Local Port to serve (cannot be NULL) *  @param[in]  pCb *      Call back function which is to be invoked. *  @param[in]  Priority *      Priority of new task to create for callback function  *  @param[in]  StackSize *      Stack size of new task to create for callback function *  @param[in]  Argument *      Argument (besides socket) to pass to callback function *  @param[in]  MaxSpawn *      Maximum number of callback function instances (must be 1 for UDP) * *  @retval *      Success - Handle to the spawned Daemon. *  @retval *      Error   - 0 */void *DaemonNew( uint32_t Type, uint32_t LocalAddress, uint32_t LocalPort,                  int (*pCb)(SOCKET,uint32_t), uint32_t Priority,                  uint32_t StackSize, uintptr_t Argument, uint32_t MaxSpawn ){    int i;    DREC *pdr = 0;
        /* Sanity check the arguments */    if( Type==SOCK_DGRAM )        MaxSpawn=1;    else if( Type!=SOCK_STREAM && Type!=SOCK_STREAMNC )        return(0);
        if( !LocalPort || !pCb || Priority<1 || Priority>15 || !StackSize || !MaxSpawn )        return(0);
        /* We'll borrow the stack's kernel mode for a temp exclusion method */    llEnter();    if( !hDSem )    {        hDSem = SemCreate( 1 );        memset( drec, 0, sizeof(drec) );        RequestedRecords = 0;    }    llExit();
        /* At this point we must have a semaphore */    if( !hDSem )        return(0);
        /* Enter our own lock */    SemPend( hDSem, SEM_FOREVER );
        /* Scan the list for a free slot */    for( i=0; i<DAEMON_MAXRECORD; i++ )        if( !drec[i].Type && !drec[i].TasksSpawned )            break;
        /* Break out if no free records */    if(i==DAEMON_MAXRECORD)        goto errorout;
        /* Build the new record */    pdr = &drec[i];    pdr->Type         = Type;    pdr->LocalAddress = LocalAddress;    pdr->LocalPort    = LocalPort;    pdr->pCb          = pCb;    pdr->Priority     = Priority;    pdr->StackSize    = StackSize;    pdr->Argument     = Argument;    pdr->MaxSpawn     = MaxSpawn;    pdr->s            = INVALID_SOCKET;
        /* If the Deamon task exists, ping it, otherwise create it */    if( hDTask )        fdSelectAbort( hDTask );    else    {        hDTask = TaskCreate(daemon, "daemon", Priority, StackSize, 0, 0, 0);        if( hDTask )            fdOpenSession(hDTask);        else        {            pdr->Type = 0;            pdr = 0;            goto errorout;        }    }
        RequestedRecords++;
    errorout:    /* Exit our lock */    SemPost( hDSem );    return( pdr );}
    /**  *  @b Description *  @n   *      The function is to used cleanup a previously created V4 daemon. * *  @param[in]  hEntry *      This is the handle to the daemon which was previously created  *      using DaemonNew *  @sa *      DaemonNew * *  @retval *      Not Applicable. */void DaemonFree( void *hEntry ){    DREC *pdr = (DREC *)hEntry;    CHILD *pc;
        /* At this point we must have a semaphore */    if( !hDSem )        return;
        /* Enter our own lock */    SemPend( hDSem, SEM_FOREVER );
        /* Sanity check */    if( pdr->Type!=SOCK_STREAM && pdr->Type!=SOCK_STREAMNC && pdr->Type!=SOCK_DGRAM )        goto errorout;
        /* Clear the record */    pdr->Type = 0;    RequestedRecords--;
        /* Close the socket session of all children. This will */    /* cause them to eventually fall out of their code and */    /* close their sockets */    pc = pdr->pC;    while( pc )    {        if( pc->hTask )        {            fdCloseSession( pc->hTask );            pc->hTask = 0;        }        pc = pc->pNext;    }
        /* Close the socket (this will wake anyone who's using it) */    if( pdr->s != INVALID_SOCKET )    {        fdClose( pdr->s );        pdr->s = INVALID_SOCKET;    }
        /* If there are no more records, close the daemon task's */    /* file descriptor session. That will cause it to error */    /* out and remove itself */    if( !RequestedRecords )    {        fdCloseSession( hDTask );        hDTask = 0;    }
    errorout:    /* Exit our lock */    SemPost( hDSem );}
    static void daemon(){    int                i,closeSock;    struct sockaddr_in sin1;    SOCKET             tsock;    CHILD              *pc;
        /* Enter our lock */    SemPend( hDSem, SEM_FOREVER );
        for(;;)    {        /* Create any socket that needs to be created */        for( i=0; i<DAEMON_MAXRECORD; i++ )        {            if( drec[i].Type && drec[i].s == INVALID_SOCKET )            {                /* Create UDP or TCP as needed */                if( drec[i].Type == SOCK_DGRAM )                    drec[i].s = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);                else                    drec[i].s = socket(AF_INET, drec[i].Type, IPPROTO_TCP);
                    /* If the socket was created, bind it */                if( drec[i].s != INVALID_SOCKET )                {                    /* Bind to the specified Server port */                    memset( &sin1, 0, sizeof(struct sockaddr_in) );                    sin1.sin_family      = AF_INET;                    sin1.sin_addr.s_addr = drec[i].LocalAddress;                    sin1.sin_port        = NDK_htons(drec[i].LocalPort);
                        if( bind( drec[i].s,(struct sockaddr *)&sin1, sizeof(sin1) ) < 0 )                    {                        fdClose( drec[i].s );                        drec[i].s = INVALID_SOCKET;                    }                }
                    /* If the socket is bound and TCP, start listening */                if( drec[i].s != INVALID_SOCKET && drec[i].Type != SOCK_DGRAM )                {                    if( listen( drec[i].s, drec[i].MaxSpawn ) < 0 )                    {                        fdClose( drec[i].s );                        drec[i].s = INVALID_SOCKET;                    }                }            }
                /* Update the fdPoll array */            pollitem[i].fd = drec[i].s;            if( drec[i].Type && drec[i].TasksSpawned < drec[i].MaxSpawn )                pollitem[i].eventsRequested = POLLIN;            else                pollitem[i].eventsRequested = 0;        }
            /* Leave our lock */        SemPost( hDSem );
            /* Poll with a timeout of 10 second - to try and catch */        /* synchronization error */        if( fdPoll( pollitem, DAEMON_MAXRECORD, 10000 ) == SOCKET_ERROR )            break;
            /* Enter our lock */        SemPend( hDSem, SEM_FOREVER );
            /* Spawn tasks for any active sockets */        for( i=0; i<DAEMON_MAXRECORD; i++ )        {            /* If no poll results or the drec has been freed, skip it */            if( !pollitem[i].eventsDetected || !drec[i].Type )                continue;
                /* If the socket is invalid, close it */            if( pollitem[i].eventsDetected & POLLNVAL )            {                fdClose( drec[i].s);                drec[i].s = INVALID_SOCKET;                continue;            }
                if( pollitem[i].eventsDetected & POLLIN )            {                if( drec[i].Type == SOCK_DGRAM )                {                    tsock = drec[i].s;                    closeSock = 0;                }                else                {                    tsock = accept( drec[i].s, 0, 0 );                    closeSock = 1;                }
                    if( tsock != INVALID_SOCKET )                {                    /* Create a record to track this task */                    pc = mmAlloc( sizeof(CHILD) );                    if( !pc )                        goto spawnComplete;
                        /* Create the task */                    pc->hTask = TaskCreate( dchild, "dchild",                            drec[i].Priority, drec[i].StackSize,                            (uintptr_t)&drec[i], (uintptr_t)pc, 0);
                        if( !pc->hTask )                    {                        mmFree( pc );                        goto spawnComplete;                    }
                        /* Open a socket session for the child task */                    fdOpenSession( pc->hTask );
                        /* Fill in the rest of the child record */                    pc->closeSock = closeSock;                    pc->s = tsock;
                        /* Now we won't close the socket here */                    closeSock = 0;
                        /* Link this record onto the DREC */                    drec[i].TasksSpawned++;                    pc->pPrev = 0;                    pc->pNext = drec[i].pC;                    drec[i].pC = pc;                    if( pc->pNext )                        pc->pNext->pPrev = pc;
    spawnComplete:                    /* If there was an error, we may need to close the socket */                    if( closeSock )                        fdClose( tsock );                }            }        }    }
        TaskExit();}
    static void dchild( DREC *pdr, CHILD *pc ){    int rc;
        /* Get the lock to synchronize with parent */    SemPend( hDSem, SEM_FOREVER );    SemPost( hDSem );
        /* This function returns "1" if the socket is still open, */    /* and "0" is the socket has been closed. */    rc = pdr->pCb( pc->s,  pdr->Argument );
        /* Close the socket if we need to */    /* We do this before we get the lock so if the socket */    /* uses LINGER, we don't hold everyone up */    if( rc && pc->closeSock )        fdClose( pc->s );
        /* Get our lock */    SemPend( hDSem, SEM_FOREVER );
        /* Close the socket session (if open) */    if( pc->hTask )        fdCloseSession( pc->hTask );
        /* Remove our record from the DREC */    if( pc->pNext )        pc->pNext->pPrev = pc->pPrev;    if( !pc->pPrev )        pdr->pC = pc->pNext;    else        pc->pPrev->pNext = pc->pNext;    pdr->TasksSpawned--;
        /* Free our record */    mmFree( pc );
        /* Kick the parent thread */    if( hDTask )        fdSelectAbort( hDTask );
        /* Release the lock */    SemPost( hDSem );
        TaskExit();}
    #ifdef _INCLUDE_IPv6_CODE
    static DREC       drec6[DAEMON_MAXRECORD];static FDPOLLITEM pollitem6[DAEMON_MAXRECORD];static void   *hDTask6 = 0;     /* Handle to the main V6 daemon task thread */static void   *hDSem6 = 0;      /* Handle to V6 exclusion semaphore */static uint32_t  RequestedRecords6; /* Number of initialized records in drec6 */
    static void dchild6( DREC *pdr, CHILD *pc ){    int rc;
        /* Get the lock to synchronize with parent */    SemPend( hDSem6, SEM_FOREVER );    SemPost( hDSem6 );
        /* This function returns "1" if the socket is still open, */    /* and "0" is the socket has been closed. */    rc = pdr->pCb( pc->s,  pdr->Argument );
        /* Close the socket if we need to */    /* We do this before we get the lock so if the socket */    /* uses LINGER, we don't hold everyone up */    if( rc && pc->closeSock )        fdClose( pc->s );
        /* Get our lock */    SemPend( hDSem6, SEM_FOREVER );
        /* Close the socket session (if open) */    if( pc->hTask )        fdCloseSession( pc->hTask );
        /* Remove our record from the DREC */    if( pc->pNext )        pc->pNext->pPrev = pc->pPrev;    if( !pc->pPrev )        pdr->pC = pc->pNext;    else        pc->pPrev->pNext = pc->pNext;    pdr->TasksSpawned--;
        /* Free our record */    mmFree( pc );
        /* Kick the parent thread */    if( hDTask6 )        fdSelectAbort( hDTask6 );
        /* Release the lock */    SemPost( hDSem6 );
        TaskExit();}
    static void daemon6(){    int                   i,closeSock;    struct sockaddr_in6   sin1;    SOCKET                tsock;    CHILD*                pc;
        /* Enter our lock */    SemPend( hDSem6, SEM_FOREVER );
        for(;;)    {        /* Create any socket that needs to be created */        for( i=0; i<DAEMON_MAXRECORD; i++ )        {            if( drec6[i].Type && drec6[i].s == INVALID_SOCKET )            {                /* Create UDP or TCP as needed */                if( drec6[i].Type == SOCK_DGRAM )                    drec6[i].s = socket(AF_INET6, SOCK_DGRAM, IPPROTO_UDP);                else                    drec6[i].s = socket(AF_INET6, SOCK_STREAM, IPPROTO_TCP);
                    /* If the socket was created, bind it */                if( drec6[i].s != INVALID_SOCKET )                {                    /* Bind to the specified Server port */                    memset( &sin1, 0, sizeof(struct sockaddr_in) );                    sin1.sin6_family     = AF_INET6;                    memcpy((void *)&sin1.sin6_addr,(void *)&drec6[i].LocalAddress, sizeof(struct in6_addr));                    sin1.sin6_port       = NDK_htons(drec6[i].LocalPort);
                        if( bind( drec6[i].s,(struct sockaddr *)&sin1, sizeof(sin1) ) < 0 )                    {                        fdClose( drec6[i].s );                        drec6[i].s = INVALID_SOCKET;                    }                }
                    /* If the socket is bound and TCP, start listening */                if( drec6[i].s != INVALID_SOCKET && drec6[i].Type != SOCK_DGRAM )                {                    if( listen( drec6[i].s, drec6[i].MaxSpawn ) < 0 )                    {                        fdClose( drec6[i].s );                        drec6[i].s = INVALID_SOCKET;                    }                }            }
                /* Update the fdPoll array */            pollitem6[i].fd = drec6[i].s;            if( drec6[i].Type && drec6[i].TasksSpawned < drec6[i].MaxSpawn )                pollitem6[i].eventsRequested = POLLIN;            else                pollitem6[i].eventsRequested = 0;        }
            /* Leave our lock */        SemPost( hDSem6 );
            /* Poll with a timeout of 10 second - to try and catch */        /* synchronization error */        if( fdPoll( pollitem6, DAEMON_MAXRECORD, 10000 ) == SOCKET_ERROR )            break;
            /* Enter our lock */        SemPend( hDSem6, SEM_FOREVER );
            /* Spawn tasks for any active sockets */        for( i=0; i<DAEMON_MAXRECORD; i++ )        {            /* If no poll results or the drec6 has been freed, skip it */            if( !pollitem6[i].eventsDetected || !drec6[i].Type )                continue;
                /* If the socket is invalid, close it */            if( pollitem6[i].eventsDetected & POLLNVAL )            {                fdClose( drec6[i].s);                drec6[i].s = INVALID_SOCKET;                continue;            }
                if( pollitem6[i].eventsDetected & POLLIN )            {                if( drec6[i].Type == SOCK_DGRAM )                {                    tsock = drec6[i].s;                    closeSock = 0;                }                else                {                    tsock = accept( drec6[i].s, 0, 0 );                    closeSock = 1;                }
                    if( tsock != INVALID_SOCKET )                {                    /* Create a record to track this task */                    pc = mmAlloc( sizeof(CHILD) );                    if( !pc )                        goto spawnComplete;
                        /* Create the task */                    pc->hTask = TaskCreate( dchild6, "dchild6",                            drec6[i].Priority, drec6[i].StackSize,                            (uintptr_t)&drec6[i], (uintptr_t)pc, 0);
                        if( !pc->hTask )                    {                        mmFree( pc );                        goto spawnComplete;                    }
                        /* Open a socket session for the child task */                    fdOpenSession( pc->hTask );
                        /* Fill in the rest of the child record */                    pc->closeSock = closeSock;                    pc->s = tsock;
                        /* Now we won't close the socket here */                    closeSock = 0;
                        /* Link this record onto the DREC */                    drec6[i].TasksSpawned++;                    pc->pPrev = 0;                    pc->pNext = drec6[i].pC;                    drec6[i].pC = pc;                    if( pc->pNext )                        pc->pNext->pPrev = pc;
    spawnComplete:                    /* If there was an error, we may need to close the socket */                    if( closeSock )                        fdClose( tsock );                }            }        }    }
        TaskExit();}
    /**  *  @b Description *  @n   *      The function creates a V6 Daemon. * *  @param[in]  Type *      This is the type of socket being opened through the daemon. In *      the case of IPv6 the following types are supported *          - SOCK_STREAM *              Use this for TCP Sockets. *          - SOCK_DGRAM *              Use this for UDP Sockets. *  @param[in]  LocalAddress *      This is the Local Address to which the socket will be bound to. *      In most cases this is typically passed as IPV6_UNSPECIFIED_ADDRESS *  @param[in]  LocalPort *      This is the Local Port to serve (cannot be NULL) *  @param[in]  pCb *      Call back function which is to be invoked. *  @param[in]  Priority *      Priority of new task to create for callback function  *  @param[in]  StackSize *      Stack size of new task to create for callback function *  @param[in]  Argument *      Argument (besides socket) to pass to callback function *  @param[in]  MaxSpawn *      Maximum number of callback function instances (must be 1 for UDP) * *  @retval *      Success - Handle to the spawned Daemon. *  @retval *      Error   - 0 */void *Daemon6New (uint32_t Type, IP6N LocalAddress, uint32_t LocalPort,                   int (*pCb)(SOCKET,uint32_t), uint32_t Priority,                   uint32_t StackSize, uintptr_t Argument, uint32_t MaxSpawn ){    int i;    DREC *pdr = 0;
        /* Sanity check the arguments */    if( Type==SOCK_DGRAM )        MaxSpawn=1;    else if( Type!=SOCK_STREAM)        return(0);
        if( !LocalPort || !pCb || Priority<1 || Priority>15 || !StackSize || !MaxSpawn )        return(0);
        /* We'll borrow the stack's kernel mode for a temp exclusion method */    llEnter();    if( !hDSem6 )    {        hDSem6 = SemCreate( 1 );        memset( drec6, 0, sizeof(drec6) );        RequestedRecords6 = 0;    }    llExit();
        /* At this point we must have a semaphore */    if( !hDSem6 )        return(0);
        /* Enter our own lock */    SemPend( hDSem6, SEM_FOREVER );
        /* Scan the list for a free slot */    for( i=0; i<DAEMON_MAXRECORD; i++ )        if( !drec6[i].Type && !drec6[i].TasksSpawned )            break;
        /* Break out if no free records */    if(i==DAEMON_MAXRECORD)        goto errorout;
        /* Build the new record */    pdr = &drec6[i];    pdr->Type           = Type;    pdr->LocalV6Address = LocalAddress;    pdr->LocalPort      = LocalPort;    pdr->pCb            = pCb;    pdr->Priority       = Priority;    pdr->StackSize      = StackSize;    pdr->Argument       = Argument;    pdr->MaxSpawn       = MaxSpawn;    pdr->s              = INVALID_SOCKET;
        /* If the Deamon task exists, ping it, otherwise create it */    if( hDTask6 )        fdSelectAbort( hDTask6 );    else    {        hDTask6 = TaskCreate(daemon6,"daemon6",OS_TASKPRINORM,OS_TASKSTKLOW,0,0,0);        if( hDTask6 )            fdOpenSession(hDTask6);        else        {            pdr->Type = 0;            pdr = 0;            goto errorout;        }    }
        RequestedRecords6++;
    errorout:    /* Exit our lock */    SemPost( hDSem6 );    return( pdr );}
    /**  *  @b Description *  @n   *      The function is to used cleanup a previously created V6 daemon. * *  @param[in]  hEntry *      This is the handle to the daemon which was previously created  *      using Daemon6New *  @sa *      Daemon6New * *  @retval *      Not Applicable. */void Daemon6Free( void *hEntry ){    DREC *pdr = (DREC *)hEntry;    CHILD *pc;
        /* At this point we must have a semaphore */    if( !hDSem6 )        return;
        /* Enter our own lock */    SemPend( hDSem6, SEM_FOREVER );
        /* Sanity check */    if( pdr->Type!=SOCK_STREAM && pdr->Type!=SOCK_DGRAM )        goto errorout;
        /* Clear the record */    pdr->Type = 0;    RequestedRecords6--;
        /* Close the socket session of all children. This will */    /* cause them to eventually fall out of their code and */    /* close their sockets */    pc = pdr->pC;    while( pc )    {        if( pc->hTask )        {            fdCloseSession( pc->hTask );            pc->hTask = 0;        }        pc = pc->pNext;    }
        /* Close the socket (this will wake anyone who's using it) */    if( pdr->s != INVALID_SOCKET )    {        fdClose( pdr->s );        pdr->s = INVALID_SOCKET;    }
        /* If there are no more records, close the daemon task's */    /* file descriptor session. That will cause it to error */    /* out and remove itself */    if( !RequestedRecords6 )    {        fdCloseSession( hDTask6 );        hDTask6 = 0;    }
    errorout:    /* Exit our lock */    SemPost( hDSem6 );}
    #endif /* _INCLUDE_IPv6_CODE */

  • >>../daemon.c:42:21: fatal error: netmain.h: No such file or directory

    Do you have netmain.h's directory (ti\ndk\inc) included?

    Regards,

    Garrett 

  • Yes.

    netmain.h directory is included in deamon file.(#include <netmain.h>)

    I have created project NIMU_ICSS_BasicExample_iceAMIC110_wSoCLib_armExampleproject

    I can see nethook.c file is already added.

    and it has 

    void netOpenHook()
    {
    // Create our local servers
    hEcho = DaemonNew( SOCK_STREAMNC, 0, 7, dtask_tcp_echo,
    OS_TASKPRINORM, OS_TASKSTKNORM, 0, 3 );
    hEchoUdp = DaemonNew( SOCK_DGRAM, 0, 7, dtask_udp_echo,
    OS_TASKPRINORM, OS_TASKSTKNORM, 0, 1 );
    hData = DaemonNew( SOCK_STREAM, 0, 1000, dtask_tcp_datasrv,
    OS_TASKPRINORM, OS_TASKSTKNORM, 0, 3 );
    hNull = DaemonNew( SOCK_STREAMNC, 0, 1001, dtask_tcp_nullsrv,
    OS_TASKPRINORM, OS_TASKSTKNORM, 0, 3 );
    hOob = DaemonNew( SOCK_STREAMNC, 0, 999, dtask_tcp_oobsrv,
    OS_TASKPRINORM, OS_TASKSTKNORM, 0, 3 );
    }

    void netCloseHook()
    {
    DaemonFree(hOob);
    DaemonFree(hNull);
    DaemonFree(hData);
    DaemonFree(hEchoUdp);
    DaemonFree(hEcho);
    }

    which file can i add tcpecho code from NDK API user guide section 5.4.2 Server Daemon Example to the project?

    Regards,

    Vrund

  • You need to include the path (ti\ndk\inc) in your project build 'Directories'. Currently you only have  -I"C:/Users/vrund rana/workspace_v7/rtos_template_app_am335x_a8" -I"C:/ti/gcc-arm-none-eabi-6-2017-q1-update/arm-none-eabi/include"

    Regards,

    Garrett

  • Hello,

    I have added inculde folder in project dirctory.

    "C:\ti\ndk_3_40_01_01\packages\ti\ndk\inc"

    but build not succesful.


    **** Build of configuration Debug for project rtos_template_app_am335x_a8 ****

    "C:\\ti\\ccsv7\\utils\\bin\\gmake" -k -j 4 all -O
    gmake[1]: Entering directory 'C:/Users/20033229/ccs_workspace/rtos_template_app_am335x_a8/Debug'
    'Building file: ../main.cfg'
    'Invoking: XDCtools'
    "C:/ti/xdctools_3_51_01_18_core/xs" --xdcpath="C:/ti/bios_6_76_03_01/packages;C:/ti/pdk_am335x_1_0_14/packages;C:/ti/ccsv7/ccs_base;" xdc.tools.configuro -o configPkg -t gnu.targets.arm.A8F -p ti.platforms.evmAM3359 -r release -c "C:/ti/gcc-arm-none-eabi-6-2017-q1-update" "../main.cfg"
    making package.mak (because of package.bld) ...
    generating interfaces for package configPkg (because package/package.xdc.inc is older than package.xdc) ...
    configuring main.xa8fg from package/cfg/main_pa8fg.cfg ...
    SoC Type is am335x
    SoC Type is am335x
    generating custom ti.sysbios library makefile ...
    Linking with library ti.drv.spi:./lib/am335x/a8/release/ti.drv.spi.aa8fg
    Linking with library ti.drv.uart:./lib/am335x/a8/release/ti.drv.uart.aa8fg
    Linking with library ti.drv.i2c:./lib/am335x/a8/release/ti.drv.i2c.aa8fg
    Linking with library ti.osal:./lib/tirtos/a8/release/ti.osal.aa8fg
    Linking with library ti.csl:./lib/am335x/a8/release/ti.csl.aa8fg
    Starting build of library sources ...
    making C:/Users/20033229/ccs_workspace/rtos_template_app_am335x_a8/src/sysbios/sysbios.aa8fg ...
    Build of libraries done.
    cla8fg package/cfg/main_pa8fg.c ...
    'Finished building: ../main.cfg'
    ' '
    gmake[1]: Leaving directory 'C:/Users/20033229/ccs_workspace/rtos_template_app_am335x_a8/Debug'
    'Building file: ../main.c'
    'Invoking: GNU Compiler'
    "C:/ti/gcc-arm-none-eabi-6-2017-q1-update/bin/arm-none-eabi-gcc.exe" -c -mcpu=cortex-a8 -mtune=cortex-a8 -march=armv7-a -marm -mfloat-abi=hard -Dam3358 -DevmAM335x -DSOC_AM335x -I"C:/ti/ndk_3_40_01_01/packages/ti/ndk/inc" -I"C:/Users/20033229/ccs_workspace/rtos_template_app_am335x_a8" -I"C:/ti/gcc-arm-none-eabi-6-2017-q1-update/arm-none-eabi/include" -g -gdwarf-3 -gstrict-dwarf -Wall -MMD -MP -MF"main.d" -MT"main.o" -o"main.o" @"configPkg/compiler.opt" "../main.c"
    'Finished building: ../main.c'
    ' '
    'Building file: ../app.c'
    'Invoking: GNU Compiler'
    "C:/ti/gcc-arm-none-eabi-6-2017-q1-update/bin/arm-none-eabi-gcc.exe" -c -mcpu=cortex-a8 -mtune=cortex-a8 -march=armv7-a -marm -mfloat-abi=hard -Dam3358 -DevmAM335x -DSOC_AM335x -I"C:/ti/ndk_3_40_01_01/packages/ti/ndk/inc" -I"C:/Users/20033229/ccs_workspace/rtos_template_app_am335x_a8" -I"C:/ti/gcc-arm-none-eabi-6-2017-q1-update/arm-none-eabi/include" -g -gdwarf-3 -gstrict-dwarf -Wall -MMD -MP -MF"app.d" -MT"app.o" -o"app.o" @"configPkg/compiler.opt" "../app.c"
    'Finished building: ../app.c'
    ' '
    'Building file: ../daemon.c'
    'Invoking: GNU Compiler'
    "C:/ti/gcc-arm-none-eabi-6-2017-q1-update/bin/arm-none-eabi-gcc.exe" -c -mcpu=cortex-a8 -mtune=cortex-a8 -march=armv7-a -marm -mfloat-abi=hard -Dam3358 -DevmAM335x -DSOC_AM335x -I"C:/ti/ndk_3_40_01_01/packages/ti/ndk/inc" -I"C:/Users/20033229/ccs_workspace/rtos_template_app_am335x_a8" -I"C:/ti/gcc-arm-none-eabi-6-2017-q1-update/arm-none-eabi/include" -g -gdwarf-3 -gstrict-dwarf -Wall -MMD -MP -MF"daemon.d" -MT"daemon.o" -o"daemon.o" @"configPkg/compiler.opt" "../daemon.c"
    In file included from C:/ti/ndk_3_40_01_01/packages/ti/ndk/inc/socket.h:43:0,
    from C:/ti/ndk_3_40_01_01/packages/ti/ndk/inc/stacksys.h:86,
    from C:/ti/ndk_3_40_01_01/packages/ti/ndk/inc/netmain.h:39,
    from ../daemon.c:42:
    C:/ti/ndk_3_40_01_01/packages/ti/ndk/inc/socketndk.h:94:0: warning: "_SYS_SELECT_H" redefined
    #define _SYS_SELECT_H 1 // TODO: still needed for struct timeval conflict

    In file included from c:\ti\bios_6_76_03_01\packages\gnu\targets\arm\libs\install-native\arm-none-eabi\include\sys\types.h:68:0,
    from c:\ti\bios_6_76_03_01\packages\gnu\targets\arm\libs\install-native\arm-none-eabi\include\sys\time.h:43,
    from C:/ti/ndk_3_40_01_01/packages/ti/ndk/inc/socketndk.h:48,
    from C:/ti/ndk_3_40_01_01/packages/ti/ndk/inc/socket.h:43,
    from C:/ti/ndk_3_40_01_01/packages/ti/ndk/inc/stacksys.h:86,
    from C:/ti/ndk_3_40_01_01/packages/ti/ndk/inc/netmain.h:39,
    from ../daemon.c:42:
    c:\ti\bios_6_76_03_01\packages\gnu\targets\arm\libs\install-native\arm-none-eabi\include\sys\select.h:13:0: note: this is the location of the previous definition
    #define _SYS_SELECT_H

    'Finished building: ../daemon.c'
    ' '
    'Building target: rtos_template_app_am335x_a8.out'
    'Invoking: GNU Linker'
    "C:/ti/gcc-arm-none-eabi-6-2017-q1-update/bin/arm-none-eabi-gcc.exe" -mtune=cortex-a8 -marm -Dam3358 -DevmAM335x -DSOC_AM335x -g -gdwarf-3 -gstrict-dwarf -Wall -mfloat-abi=hard -Wl,-Map,"rtos_template_app_am335x_a8.map" -nostartfiles -static -Wl,--gc-sections -L"C:/ti/pdk_am335x_1_0_14/packages/ti/board/lib/evmAM335x/a8/release/" -L"C:/ti/bios_6_76_03_01/packages/gnu/targets/arm/libs/install-native/arm-none-eabi/lib/hard" -Wl,--defsym,STACKSIZE=0x1C000 -Wl,--defsym,HEAPSIZE=0x400 --specs=nano.specs -o"rtos_template_app_am335x_a8.out" "./app.o" "./daemon.o" "./main.o" -Wl,-T"configPkg/linker.cmd" -Wl,--start-group -l:ti.board.aa8fg -lgcc -lm -lrdimon -lc -Wl,--end-group
    makefile:148: recipe for target 'rtos_template_app_am335x_a8.out' failed
    ./daemon.o: In function `accept':
    C:/ti/ndk_3_40_01_01/packages/ti/ndk/inc/socket.h:58: undefined reference to `NDK_accept'
    ./daemon.o: In function `bind':
    C:/ti/ndk_3_40_01_01/packages/ti/ndk/inc/socket.h:66: undefined reference to `NDK_bind'
    ./daemon.o: In function `listen':
    C:/ti/ndk_3_40_01_01/packages/ti/ndk/inc/socket.h:116: undefined reference to `NDK_listen'
    ./daemon.o: In function `socket':
    C:/ti/ndk_3_40_01_01/packages/ti/ndk/inc/socket.h:216: undefined reference to `NDK_socket'
    ./daemon.o: In function `DaemonNew':
    C:\Users\20033229\ccs_workspace\rtos_template_app_am335x_a8\Debug/../daemon.c:229: undefined reference to `llEnter'
    C:\Users\20033229\ccs_workspace\rtos_template_app_am335x_a8\Debug/../daemon.c:232: undefined reference to `SemCreate'
    C:\Users\20033229\ccs_workspace\rtos_template_app_am335x_a8\Debug/../daemon.c:236: undefined reference to `llExit'
    C:\Users\20033229\ccs_workspace\rtos_template_app_am335x_a8\Debug/../daemon.c:243: undefined reference to `SemPend'
    C:\Users\20033229\ccs_workspace\rtos_template_app_am335x_a8\Debug/../daemon.c:268: undefined reference to `fdSelectAbort'
    C:\Users\20033229\ccs_workspace\rtos_template_app_am335x_a8\Debug/../daemon.c:271: undefined reference to `TaskCreate'
    C:\Users\20033229\ccs_workspace\rtos_template_app_am335x_a8\Debug/../daemon.c:273: undefined reference to `fdOpenSession'
    C:\Users\20033229\ccs_workspace\rtos_template_app_am335x_a8\Debug/../daemon.c:286: undefined reference to `SemPost'
    ./daemon.o: In function `DaemonFree':
    C:\Users\20033229\ccs_workspace\rtos_template_app_am335x_a8\Debug/../daemon.c:314: undefined reference to `SemPend'
    C:\Users\20033229\ccs_workspace\rtos_template_app_am335x_a8\Debug/../daemon.c:332: undefined reference to `fdCloseSession'
    C:\Users\20033229\ccs_workspace\rtos_template_app_am335x_a8\Debug/../daemon.c:341: undefined reference to `fdClose'
    C:\Users\20033229\ccs_workspace\rtos_template_app_am335x_a8\Debug/../daemon.c:350: undefined reference to `fdCloseSession'
    C:\Users\20033229\ccs_workspace\rtos_template_app_am335x_a8\Debug/../daemon.c:356: undefined reference to `SemPost'
    ./daemon.o: In function `daemon':
    C:\Users\20033229\ccs_workspace\rtos_template_app_am335x_a8\Debug/../daemon.c:367: undefined reference to `SemPend'
    C:\Users\20033229\ccs_workspace\rtos_template_app_am335x_a8\Debug/../daemon.c:393: undefined reference to `fdClose'
    C:\Users\20033229\ccs_workspace\rtos_template_app_am335x_a8\Debug/../daemon.c:403: undefined reference to `fdClose'
    C:\Users\20033229\ccs_workspace\rtos_template_app_am335x_a8\Debug/../daemon.c:418: undefined reference to `SemPost'
    C:\Users\20033229\ccs_workspace\rtos_template_app_am335x_a8\Debug/../daemon.c:422: undefined reference to `fdPoll'
    C:\Users\20033229\ccs_workspace\rtos_template_app_am335x_a8\Debug/../daemon.c:426: undefined reference to `SemPend'
    C:\Users\20033229\ccs_workspace\rtos_template_app_am335x_a8\Debug/../daemon.c:438: undefined reference to `fdClose'
    C:\Users\20033229\ccs_workspace\rtos_template_app_am335x_a8\Debug/../daemon.c:459: undefined reference to `mmAlloc'
    C:\Users\20033229\ccs_workspace\rtos_template_app_am335x_a8\Debug/../daemon.c:464: undefined reference to `TaskCreate'
    C:\Users\20033229\ccs_workspace\rtos_template_app_am335x_a8\Debug/../daemon.c:470: undefined reference to `mmFree'
    C:\Users\20033229\ccs_workspace\rtos_template_app_am335x_a8\Debug/../daemon.c:475: undefined reference to `fdOpenSession'
    C:\Users\20033229\ccs_workspace\rtos_template_app_am335x_a8\Debug/../daemon.c:495: undefined reference to `fdClose'
    C:\Users\20033229\ccs_workspace\rtos_template_app_am335x_a8\Debug/../daemon.c:501: undefined reference to `TaskExit'
    ./daemon.o: In function `dchild':
    C:\Users\20033229\ccs_workspace\rtos_template_app_am335x_a8\Debug/../daemon.c:509: undefined reference to `SemPend'
    C:\Users\20033229\ccs_workspace\rtos_template_app_am335x_a8\Debug/../daemon.c:510: undefined reference to `SemPost'
    C:\Users\20033229\ccs_workspace\rtos_template_app_am335x_a8\Debug/../daemon.c:520: undefined reference to `fdClose'
    C:\Users\20033229\ccs_workspace\rtos_template_app_am335x_a8\Debug/../daemon.c:523: undefined reference to `SemPend'
    C:\Users\20033229\ccs_workspace\rtos_template_app_am335x_a8\Debug/../daemon.c:527: undefined reference to `fdCloseSession'
    C:\Users\20033229\ccs_workspace\rtos_template_app_am335x_a8\Debug/../daemon.c:539: undefined reference to `mmFree'
    C:\Users\20033229\ccs_workspace\rtos_template_app_am335x_a8\Debug/../daemon.c:543: undefined reference to `fdSelectAbort'
    C:\Users\20033229\ccs_workspace\rtos_template_app_am335x_a8\Debug/../daemon.c:546: undefined reference to `SemPost'
    C:\Users\20033229\ccs_workspace\rtos_template_app_am335x_a8\Debug/../daemon.c:548: undefined reference to `TaskExit'
    collect2.exe: error: ld returned 1 exit status
    gmake[1]: *** [rtos_template_app_am335x_a8.out] Error 1
    gmake: *** [all] Error 2
    makefile:144: recipe for target 'all' failed

    **** Build Finished ****

    Regards,

    Vrund

  • hello,

    Gentle Reminder.

    Regards,

    Vrund

  • It doesn't seem you have NDK library linked in your project build. Please refer to a NIMU example project in the PDK to see how NDK modules are included in the .cfg file, e.g. packages\ti\transport\ndk\nimu_icss\example\am335x\armv7\bios\am335x_app_icev2_wSoCLib.cfg

    Regards,

    Garrett

  • Hello,

    I have added ndk library as below mention in ndk guide.

    1.6.1 Adding NDK Support to an Existing Application If you have an existing application that has SYS/BIOS and XDCtools support, but does not have either TIRTOS or the NDK enabled, follow these steps to enable the NDK and NSP: 1. Right-click on the CCS project in the Project Explorer view. Choose Show Build Settings from the context menu. 2. Select the General category in the Properties dialog. 3. Go to the RTSC tab. 4. Check the boxes next to the most recently installed versions of the NDK and NDK Network Support Package products. 5. Click OK. 6. Reopen the *.cfg file in the project with XGCONF. The NDK and NSP should now be listed in the Available Products view if you expand TI-RTOS > Products. 7. Select the NDK > Global item in the Available Products view. Right-click on the Global module and select Use Global. You will see the Welcome sheet for NDK configuration. This sheet provides an overview of the NDK, configuration information, and documentation for the NDK. 8. Click the System Overview link at the top of the Welcome sheet to see a handy diagram of the NDK modules you can configure. 9. Right-click on the Emac module in the System Overview diagram and choose Use Emac. To configure the Emac module, select the device for which you are building. The Emac module will attempt to load the Ethernet driver for that device. If the device you are working with is not in the list, choose "NONE" as the device. In this case, you must link in your device's

    Ethernet driver yourself. 10. Open the project's Properties dialog and go to the Build > Compiler > Include Options category. Add ${NDK_INSTALL_DIR}/packages/ti/ndk/inc to your application's compiler include path.

    but still i am getting error.


    **** Build of configuration Debug for project rtos_template_app_am437x_a9 ****

    "C:\\ti\\ccs930\\ccs\\utils\\bin\\gmake" -k -j 4 all -O

    Building file: "../main.cfg"
    Invoking: XDCtools
    "C:/ti/xdctools_3_50_07_20_core/xs" --xdcpath="C:/ti/bios_6_73_00_12/packages;C:/ti/pdk_am437x_1_0_12/packages;C:/ti/ndk_3_40_01_01/packages;" xdc.tools.configuro -o configPkg -t gnu.targets.arm.A9F -p ti.platforms.evmAM437X -r release -c "C:/ti/ccs930/ccs/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32" "../main.cfg"
    making package.mak (because of package.bld) ...
    generating interfaces for package configPkg (because package/package.xdc.inc is older than package.xdc) ...
    configuring main.xa9fg from package/cfg/main_pa9fg.cfg ...
    generating custom ti.sysbios library makefile ...
    Linking with library ti.drv.spi:./lib/am437x/a9/release/ti.drv.spi.aa9fg
    Linking with library ti.drv.gpio:./lib/am437x/a9/release/ti.drv.gpio.aa9fg
    Linking with library ti.drv.uart:./lib/am437x/a9/release/ti.drv.uart.aa9fg
    Linking with library ti.drv.i2c:./lib/am437x/a9/release/ti.drv.i2c.aa9fg
    Linking with library ti.csl:./lib/am437x/a9/release/ti.csl.aa9fg
    Linking with library ti.osal:./lib/tirtos/a9/release/ti.osal.aa9fg
    Starting build of library sources ...
    making C:/Users/20033229/workspace_v9/rtos_template_app_am437x_a9/src/sysbios/sysbios.aa9fg ...
    gmake[1]: Entering directory `C:/Users/20033229/workspace_v9/rtos_template_app_am437x_a9/src/sysbios'
    asma9fg C:/ti/bios_6_73_00_12/packages/ti/sysbios/family/arm/IntrinsicsSupport_asm_gnu.asm ...
    asma9fg C:/ti/bios_6_73_00_12/packages/ti/sysbios/family/arm/TaskSupport_asm_gnu.asm ...
    asma9fg C:/ti/bios_6_73_00_12/packages/ti/sysbios/family/arm/gic/Hwi_asm_gnu.asm ...
    asma9fg C:/ti/bios_6_73_00_12/packages/ti/sysbios/family/arm/exc/Exception_asm_gnu.asm ...
    asma9fg C:/ti/bios_6_73_00_12/packages/ti/sysbios/family/arm/a9/Cache_asm_gnu.sv7A ...
    asma9fg C:/ti/bios_6_73_00_12/packages/ti/sysbios/family/arm/a8/Mmu_asm_gnu.sv7A ...
    asma9fg C:/ti/bios_6_73_00_12/packages/ti/sysbios/family/arm/a15/TimestampProvider_asm_gnu.asm ...
    cla9fg C:/ti/bios_6_73_00_12/packages/ti/sysbios/BIOS.c ...
    cla9fg C:/ti/bios_6_73_00_12/packages/ti/sysbios/family/arm/IntrinsicsSupport.c ...
    cla9fg C:/ti/bios_6_73_00_12/packages/ti/sysbios/family/arm/TaskSupport.c ...
    cla9fg C:/ti/bios_6_73_00_12/packages/ti/sysbios/knl/Clock.c ...
    cla9fg C:/ti/bios_6_73_00_12/packages/ti/sysbios/knl/Idle.c ...
    cla9fg C:/ti/bios_6_73_00_12/packages/ti/sysbios/knl/Intrinsics.c ...
    cla9fg C:/ti/bios_6_73_00_12/packages/ti/sysbios/knl/Event.c ...
    cla9fg C:/ti/bios_6_73_00_12/packages/ti/sysbios/knl/Mailbox.c ...
    cla9fg C:/ti/bios_6_73_00_12/packages/ti/sysbios/knl/Queue.c ...
    cla9fg C:/ti/bios_6_73_00_12/packages/ti/sysbios/knl/Semaphore.c ...
    cla9fg C:/ti/bios_6_73_00_12/packages/ti/sysbios/knl/Swi.c ...
    cla9fg C:/ti/bios_6_73_00_12/packages/ti/sysbios/knl/Task.c ...
    cla9fg C:/ti/bios_6_73_00_12/packages/ti/sysbios/hal/Cache.c ...
    cla9fg C:/ti/bios_6_73_00_12/packages/ti/sysbios/hal/Core.c ...
    cla9fg C:/ti/bios_6_73_00_12/packages/ti/sysbios/hal/CoreNull.c ...
    cla9fg C:/ti/bios_6_73_00_12/packages/ti/sysbios/hal/Hwi.c ...
    cla9fg C:/ti/bios_6_73_00_12/packages/ti/sysbios/hal/Hwi_stack.c ...
    cla9fg C:/ti/bios_6_73_00_12/packages/ti/sysbios/hal/Hwi_startup.c ...
    cla9fg C:/ti/bios_6_73_00_12/packages/ti/sysbios/hal/Seconds.c ...
    cla9fg C:/ti/bios_6_73_00_12/packages/ti/sysbios/hal/SecondsClock.c ...
    cla9fg C:/ti/bios_6_73_00_12/packages/ti/sysbios/rts/gnu/ReentSupport.c ...
    cla9fg C:/ti/bios_6_73_00_12/packages/ti/sysbios/rts/gnu/SemiHostSupport.c ...
    cla9fg C:/ti/bios_6_73_00_12/packages/ti/sysbios/family/arm/gic/Hwi.c ...
    cla9fg C:/ti/bios_6_73_00_12/packages/ti/sysbios/family/arm/exc/Exception.c ...
    cla9fg C:/ti/bios_6_73_00_12/packages/ti/sysbios/family/arm/a9/Cache.c ...
    cla9fg C:/ti/bios_6_73_00_12/packages/ti/sysbios/family/arm/a9/Timer.c ...
    cla9fg C:/ti/bios_6_73_00_12/packages/ti/sysbios/family/arm/a8/Mmu.c ...
    cla9fg C:/ti/bios_6_73_00_12/packages/ti/sysbios/gates/GateHwi.c ...
    cla9fg C:/ti/bios_6_73_00_12/packages/ti/sysbios/gates/GateMutex.c ...
    cla9fg C:/ti/bios_6_73_00_12/packages/ti/sysbios/heaps/HeapMem.c ...
    cla9fg C:/ti/bios_6_73_00_12/packages/ti/sysbios/family/arm/a15/TimestampProvider.c ...
    cla9fg C:/ti/bios_6_73_00_12/packages/ti/posix/tirtos/clock.c ...
    cla9fg C:/ti/bios_6_73_00_12/packages/ti/posix/tirtos/mqueue.c ...
    cla9fg C:/ti/bios_6_73_00_12/packages/ti/posix/tirtos/pthread.c ...
    cla9fg C:/ti/bios_6_73_00_12/packages/ti/posix/tirtos/pthread_barrier.c ...
    cla9fg C:/ti/bios_6_73_00_12/packages/ti/posix/tirtos/pthread_cond.c ...
    cla9fg C:/ti/bios_6_73_00_12/packages/ti/posix/tirtos/pthread_key.c ...
    cla9fg C:/ti/bios_6_73_00_12/packages/ti/posix/tirtos/pthread_mutex.c ...
    cla9fg C:/ti/bios_6_73_00_12/packages/ti/posix/tirtos/pthread_rwlock.c ...
    cla9fg C:/ti/bios_6_73_00_12/packages/ti/posix/tirtos/pthread_util.c ...
    cla9fg C:/ti/bios_6_73_00_12/packages/ti/posix/tirtos/sched.c ...
    cla9fg C:/ti/bios_6_73_00_12/packages/ti/posix/tirtos/semaphore.c ...
    cla9fg C:/ti/bios_6_73_00_12/packages/ti/posix/tirtos/sleep.c ...
    cla9fg C:/ti/bios_6_73_00_12/packages/ti/posix/tirtos/timer.c ...
    ara9fg arm_IntrinsicsSupport_asm_gnu.o arm_TaskSupport_asm_gnu.o gic_Hwi_asm_gnu.o exc_Exception_asm_gnu.o a9_Cache_asm_gnu.o a8_Mmu_asm_gnu.o a15_TimestampProvider_asm_gnu.o _BIOS.o arm_IntrinsicsSupport.o arm_TaskSupport.o knl_Clock.o knl_Idle.o knl_Intrinsics.o knl_Event.o knl_Mailbox.o knl_Queue.o knl_Semaphore.o knl_Swi.o knl_Task.o hal_Cache.o hal_Core.o hal_CoreNull.o hal_Hwi.o hal_Hwi_stack.o hal_Hwi_startup.o hal_Seconds.o hal_SecondsClock.o gnu_ReentSupport.o gnu_SemiHostSupport.o gic_Hwi.o exc_Exception.o a9_Cache.o a9_Timer.o a8_Mmu.o gates_GateHwi.o gates_GateMutex.o heaps_HeapMem.o a15_TimestampProvider.o tirtos_clock.o tirtos_mqueue.o tirtos_pthread.o tirtos_pthread_barrier.o tirtos_pthread_cond.o tirtos_pthread_key.o tirtos_pthread_mutex.o tirtos_pthread_rwlock.o tirtos_pthread_util.o tirtos_sched.o tirtos_semaphore.o tirtos_sleep.o tirtos_timer.o ...
    gmake[1]: Leaving directory `C:/Users/20033229/workspace_v9/rtos_template_app_am437x_a9/src/sysbios'
    Build of libraries done.
    cla9fg package/cfg/main_pa9fg.c ...
    In file included from C:/ti/ndk_3_40_01_01/packages/ti/ndk/inc/socket.h:43:0,
    from C:/ti/ndk_3_40_01_01/packages/ti/ndk/inc/stacksys.h:86,
    from C:/ti/ndk_3_40_01_01/packages/ti/ndk/inc/netmain.h:39,
    from package/cfg/main_pa9fg.c:2593:
    C:/ti/ndk_3_40_01_01/packages/ti/ndk/inc/socketndk.h:94:0: warning: "_SYS_SELECT_H" redefined
    #define _SYS_SELECT_H 1 // TODO: still needed for struct timeval conflict

    In file included from c:\ti\bios_6_73_00_12\packages\gnu\targets\arm\libs\install-native\arm-none-eabi\include\sys\types.h:68:0,
    from c:\ti\bios_6_73_00_12\packages\gnu\targets\arm\libs\install-native\arm-none-eabi\include\time.h:28,
    from package/cfg/main_pa9fg.c:2553:
    c:\ti\bios_6_73_00_12\packages\gnu\targets\arm\libs\install-native\arm-none-eabi\include\sys\select.h:13:0: note: this is the location of the previous definition
    #define _SYS_SELECT_H

    Finished building: "../main.cfg"

    Building file: "../GPIO_evmAM437x_board.c"
    Invoking: GNU Compiler
    "C:/ti/ccs930/ccs/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32/bin/arm-none-eabi-gcc-7.2.1.exe" -c -mcpu=cortex-a9 -march=armv7-a -mtune=cortex-a9 -marm -mfloat-abi=hard -Dam4372 -DSOC_AM437x -DEVM_AM437X -DevmAM437x -I"C:/ti/ndk_3_40_01_01/packages/ti/ndk/inc" -I"C:/Users/20033229/workspace_v9/rtos_template_app_am437x_a9" -I"C:/ti/ccs930/ccs/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32/arm-none-eabi/include" -Og -g -gdwarf-3 -gstrict-dwarf -Wall -MMD -MP -MF"GPIO_evmAM437x_board.d" -MT"GPIO_evmAM437x_board.o" @"configPkg/compiler.opt" -o"GPIO_evmAM437x_board.o" "../GPIO_evmAM437x_board.c"
    Finished building: "../GPIO_evmAM437x_board.c"

    Building file: "../daemon.c"
    Invoking: GNU Compiler
    "C:/ti/ccs930/ccs/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32/bin/arm-none-eabi-gcc-7.2.1.exe" -c -mcpu=cortex-a9 -march=armv7-a -mtune=cortex-a9 -marm -mfloat-abi=hard -Dam4372 -DSOC_AM437x -DEVM_AM437X -DevmAM437x -I"C:/ti/ndk_3_40_01_01/packages/ti/ndk/inc" -I"C:/Users/20033229/workspace_v9/rtos_template_app_am437x_a9" -I"C:/ti/ccs930/ccs/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32/arm-none-eabi/include" -Og -g -gdwarf-3 -gstrict-dwarf -Wall -MMD -MP -MF"daemon.d" -MT"daemon.o" @"configPkg/compiler.opt" -o"daemon.o" "../daemon.c"
    In file included from C:/ti/ndk_3_40_01_01/packages/ti/ndk/inc/socket.h:43:0,
    from C:/ti/ndk_3_40_01_01/packages/ti/ndk/inc/stacksys.h:86,
    from C:/ti/ndk_3_40_01_01/packages/ti/ndk/inc/netmain.h:39,
    from ../daemon.c:42:
    C:/ti/ndk_3_40_01_01/packages/ti/ndk/inc/socketndk.h:94:0: warning: "_SYS_SELECT_H" redefined
    #define _SYS_SELECT_H 1 // TODO: still needed for struct timeval conflict

    In file included from c:\ti\bios_6_73_00_12\packages\gnu\targets\arm\libs\install-native\arm-none-eabi\include\sys\types.h:68:0,
    from c:\ti\bios_6_73_00_12\packages\gnu\targets\arm\libs\install-native\arm-none-eabi\include\sys\time.h:43,
    from C:/ti/ndk_3_40_01_01/packages/ti/ndk/inc/socketndk.h:48,
    from C:/ti/ndk_3_40_01_01/packages/ti/ndk/inc/socket.h:43,
    from C:/ti/ndk_3_40_01_01/packages/ti/ndk/inc/stacksys.h:86,
    from C:/ti/ndk_3_40_01_01/packages/ti/ndk/inc/netmain.h:39,
    from ../daemon.c:42:
    c:\ti\bios_6_73_00_12\packages\gnu\targets\arm\libs\install-native\arm-none-eabi\include\sys\select.h:13:0: note: this is the location of the previous definition
    #define _SYS_SELECT_H

    Finished building: "../daemon.c"

    Building file: "../app.c"
    Invoking: GNU Compiler
    "C:/ti/ccs930/ccs/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32/bin/arm-none-eabi-gcc-7.2.1.exe" -c -mcpu=cortex-a9 -march=armv7-a -mtune=cortex-a9 -marm -mfloat-abi=hard -Dam4372 -DSOC_AM437x -DEVM_AM437X -DevmAM437x -I"C:/ti/ndk_3_40_01_01/packages/ti/ndk/inc" -I"C:/Users/20033229/workspace_v9/rtos_template_app_am437x_a9" -I"C:/ti/ccs930/ccs/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32/arm-none-eabi/include" -Og -g -gdwarf-3 -gstrict-dwarf -Wall -MMD -MP -MF"app.d" -MT"app.o" @"configPkg/compiler.opt" -o"app.o" "../app.c"
    Finished building: "../app.c"

    Building file: "../main.c"
    Invoking: GNU Compiler
    "C:/ti/ccs930/ccs/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32/bin/arm-none-eabi-gcc-7.2.1.exe" -c -mcpu=cortex-a9 -march=armv7-a -mtune=cortex-a9 -marm -mfloat-abi=hard -Dam4372 -DSOC_AM437x -DEVM_AM437X -DevmAM437x -I"C:/ti/ndk_3_40_01_01/packages/ti/ndk/inc" -I"C:/Users/20033229/workspace_v9/rtos_template_app_am437x_a9" -I"C:/ti/ccs930/ccs/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32/arm-none-eabi/include" -Og -g -gdwarf-3 -gstrict-dwarf -Wall -MMD -MP -MF"main.d" -MT"main.o" @"configPkg/compiler.opt" -o"main.o" "../main.c"
    Finished building: "../main.c"

    Building target: "rtos_template_app_am437x_a9.out"
    Invoking: GNU Linker
    "C:/ti/ccs930/ccs/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32/bin/arm-none-eabi-gcc-7.2.1.exe" -mtune=cortex-a9 -marm -Dam4372 -DSOC_AM437x -DEVM_AM437X -DevmAM437x -Og -g -gdwarf-3 -gstrict-dwarf -Wall -mfloat-abi=hard -Wl,-Map,"rtos_template_app_am437x_a9.map" -nostartfiles -static -Wl,--gc-sections -L"C:/ti/pdk_am437x_1_0_12/packages/ti/board/lib/evmAM437x/a9/release/" -L"C:/ti/bios_6_73_00_12/packages/gnu/targets/arm/libs/install-native/arm-none-eabi/lib/hard" -Wl,--defsym,STACKSIZE=0x18000 -Wl,--defsym,HEAPSIZE=0x400 --specs=nano.specs -o"rtos_template_app_am437x_a9.out" "./GPIO_evmAM437x_board.o" "./app.o" "./daemon.o" "./main.o" -Wl,-T"configPkg/linker.cmd" -Wl,--start-group -l:ti.board.aa9fg -lgcc -lm -lrdimon -lc -Wl,--end-group
    makefile:149: recipe for target 'rtos_template_app_am437x_a9.out' failed
    C:\ti\ndk_3_40_01_01\packages\ti\ndk\stack\lib\stk6.aa9fg(nimu.oa9fg): In function `NIMUInit':
    /db/vtree/library/trees/ndk/ndk-p19/src/ti/ndk/stack/nimu/nimu.c:1197: undefined reference to `NIMUDeviceTable'
    /db/vtree/library/trees/ndk/ndk-p19/src/ti/ndk/stack/nimu/nimu.c:1197: undefined reference to `NIMUDeviceTable'
    collect2.exe: error: ld returned 1 exit status
    gmake[1]: *** [rtos_template_app_am437x_a9.out] Error 1
    gmake: *** [all] Error 2
    makefile:145: recipe for target 'all' failed

    **** Build Finished ****

  • Refer to 

    Regards,

    Garrett

  • Hello,

    I have gone through the details and able to build the project.

    Regards,

    Vrund