On Thu, May 15, 2014 at 10:09 PM, Pablo Vasquez <pvasq...@das.uchile.cl> wrote: > Hi, > > I want to implement KATCP protocol on a PIC32 micro controller. I'm trying > to compile the KATCP C library over a TCP/IP stack freeware provided by > Microchip (the manufacturer of the starter kit I'm working with). > > I included all the .h files listed in the KATCP wiki but the compiler asks > for a "unistd.h" header. I found many "unistd.h" files in my system (ubuntu > 12.04 lts), which one should I use?
As John mentioned, you can not just copy the unistd.h file across platforms. unistd.h just declares, but doesn't implement the core unix system api (read, write, etc). The implementation happens in the operating system/runtime. If your development platform has support for a unix/posix/xopen API you should be able to port it across, but with some changes - I have had reports that katcp has been ported to smaller platforms, so this is possible. Further notes: - I tried not to use too many exotic system calls, but there are some things which might have to be adapted: * send() system calls takes some special flags * signal handling via sigaction, might not be needed on small systems * you may want to inhibit the fork related stuff in job.c, if you don't have processes - For very small systems, you might be able to just use the _katcl api, not the full _katcp one (the former just handles the formatting of messages, the latter provides a full mainloop with callbacks) - katcp was also intended to run across serial connections, so instead of using a network stack on a small system, you could run it over a serial port and save the resources for something else All the best marc