Other Parts Discussed in Thread: SYSBIOS
os: Linux Centos
sdk version: psdk 6.00.00.07, this includes all relevant packages, ndk , pdk, bios and ipc ,etc.
ccs: 8.3
I'm trying to migrate our software to use the latest processor sdk from MCSDK2.1. I've successfully compile our software using all packages from PSDK. I've encounter some problems along the way, but i have resolved all compiling errors. One complaint that i have is that I've seen a lot of meaningless API changes in the CSL that basically just add or remove "underscores" in the API.
Now the real problem is that i see socket creation errors when i use the bsd socket call in the posix pthread. Most threads in our software are posix pthreads created using posix APIs, not ti task or ndk tasks. In our software, we create a task in the main function that creates all the pthreads that run all of our production software. In some of those threads, I create sockets by calling BSD style socket API. This has worked with the old tool chain , aka MCSDK2.x. Our software is fairly complicated, so I modified the NIMU_emacExample_EVMC6678C66BiosExampleProject, aka the ndk hellworld example to track down whats causing the socket call error.
In the main function of the code, i created a task to create a pthread which runs a function that simply creates a socket using the BSD socket API in the Network Service BSD header file. I got the same error, socket call always return -1 in the following code.
extern "C" int dtask_udp_hello2( void ) { while(!networkStackStarted) { Task_sleep(1000); } fdOpenSession((void *)pthread_self()); int skt; skt = (int) socket(AF_INET,SOCK_DGRAM,0); if(skt==-1) { printf("socket create failed.\n"); } fdCloseSession(pthread_self()); return 0; }
I've also tried setting the autoOpenCloseFd to true in the sysbios configuration file and removed the fdOpenSession and fdCloseSession function calls. That didn't work either. I need some help at this point.
i'm attaching the example project. To build the project, change the variable "NS_INSTALL_PATH" to point to where your Network Service module(ns_2_60_00_07) is install. This variable is defined in "Project" -> "Properties"->"CCS Build" -> tab "Variables".