Quantcast
Channel: Forums - Recent Threads
Viewing all articles
Browse latest Browse all 262198

RTOS/PROCESSOR-SDK-AM335X: NDK BSD CONFLICTING TYPE errors

$
0
0

Part Number:PROCESSOR-SDK-AM335X

Tool/software:TI-RTOS

Hello,

I am having a problem when trying to use the BSD sockets.     Attached is a small test program  (test.c) that demonstrates what I am seeing.    The problem is that I get CONFLICTING TYPE errors for IP6N and for select.     

I have set an include path in my project to the NDK BSD directory.     The INCLUDE PATHS FOR THE PROJECT:

The COMPILER OUTPUT:

and the test.c program:

 

/*
 * test.c
 *
 *  Created on: Feb 21, 2018
 *      Author: MSTEINMETZ_LA
 */


#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#include <stdbool.h>
#include <xdc/std.h>
#include <xdc/runtime/Error.h>
#include <xdc/runtime/System.h>
#include <ti/sysbios/BIOS.h>
#include <ti/sysbios/knl/Task.h>
#include <ti/sysbios/knl/Semaphore.h>
#include <ti/sysbios/knl/Mailbox.h>
#include <xdc/cfg/global.h>

#include <ti/ndk/inc/usertype.h>   // need this for osif.h ????   HANDLE,


#include <sys/socket.h>         // include for BSD sockets

#include <ti/ndk/inc/os/osif.h>
#include "assert.h"


int BSD_test(void)  {

    int SocketHandle;

    int rslt;
    int rtn_addrlen;
    struct sockaddr_in addr;
    int sockAddrSize;
    int msglen;
    struct sockaddr from;
    unsigned char buf[1024];


    /* create the socket -- for UDP messaging */
    SocketHandle = socket(AF_INET,SOCK_DGRAM,0);

    if (-1 == SocketHandle)
    {
         /* could not create socket...report problem and then kill task */

        xdc_runtime_System_printf("SOCKET CREATE FAIL\n");
        xdc_runtime_System_flush();

    }
        /* next bind the socket to an IP address and Port */

    sockAddrSize = sizeof(struct sockaddr_in);
    memset( (char *) &addr, 0, sockAddrSize);
    addr.sin_family=AF_INET;
    addr.sin_port = htons(123);
    addr.sin_addr.s_addr = htonl(INADDR_ANY);   /* should this be any or the local IP???*/

    rslt = bind (SocketHandle, (struct sockaddr *) &addr, sockAddrSize);

    if (-1 == rslt)
    {
        /* could not bind port...report problem and then kill task */
        //Fatal_error("UDP ADDR Binding ERROR");
        //taskDelete(taskIdSelf());
        xdc_runtime_System_printf("SOCKET BIND FAIL\n");
        xdc_runtime_System_flush();

    }


    /* next, park on the socket waiting for a PEER PRIM UDP */


    rtn_addrlen = sizeof(struct sockaddr_in);

    msglen = recvfrom(SocketHandle, buf, 1024, 0,  &from, &rtn_addrlen);

    return msglen;

}

If I remove the usertype.h include,  then the missing typedef's generate errors in the osif.h file.

I am unsure what includes I need to resolve the CONFLICTING TYPE errors and also satisfies the necessary typedef's for the osif.h.

Any help you can provide would be greatly appreciated.     Note that I did search the forum and found another thread about CONFLICTING TYPES,  but it seemed that there was no clear answer and the person just hacked things to make it work.   I am hoping there is a cleaner answer.

thanks,

Mark


Viewing all articles
Browse latest Browse all 262198

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>