Tagged with picoos

BSD sockets for uIP / picoos-net

When I wrote the “native” picoos-net socket API I focused mostly on simplicity and efficiency to avoid adding too much weight to uIP. Although this layer has worked well for me, it is incompatible with BSD socket API available on many platforms. Incompatibility makes re-using code from other environments like lwIP or unix/linux (or even Texas Instruments CC3000 chip) difficult. Because I wanted to use some of my Pico]OS stuff with lwIP or CC3000 also, I decided to add a simple BSD socket layer to picoos-net library.

It contains currently following functions:


int net_accept(int s, struct sockaddr *addr, socklen_t *addrlen);
int net_bind(int s, const struct sockaddr *name, socklen_t namelen);
int net_getsockopt (int s, int level, int optname, void *optval, socklen_t *optlen);
int net_setsockopt (int s, int level, int optname, const void *optval, socklen_t optlen);
int net_close(int s);
int net_connect(int s, const struct sockaddr *name, socklen_t namelen);
int net_listen(int s, int backlog);
int net_recv(int s, void *mem, size_t len, int flags);
int net_send(int s, const void *dataptr, size_t size, int flags);
int net_socket(int domain, int type, int protocol);
int net_read(int s, void *mem, size_t len);
int net_write(int s, const void *dataptr, size_t size);

Library includes similar compatibility system like lwIP has for standard BSD socket api:

  • if NETCFG_COMPAT_SOCKETS is defined as 1 then defines for standard BSD socket functions are added to translate calls to net_* -functions, ie. accept() is defined as net_accept.
  • If NETCFG_POSIX_SOCKETS_IO_NAMES is defined as 1 then defines for read, write and close functions are also added.

setsockopt options are mostly ignored, however SO_RCVTIMEO can be used to set read timeout.

Tiva C Launchpad

launchpad-tivac-01I added an example about how to run Pico]OS on Texas Instruments Tiva C Launchpad, which is a very affordable Cortex-M4 evaluation board. It costs currently less than $13 and has 256 Kb of flash and 32 Kb of ram.

Supporting it wasn’t quite as easy as I thought. Texas Instruments provides a C-language library called ‘Tivaware’ which contains functions to access all peripherals provided by the chip. However, tivaware does not include CMSIS headers currently (I was using version 2.x), which makes porting software that uses CMSIS (like Pico]OS) more difficult than it would otherwise be. (more…)

Pico]OS & NXP DIP Arms

lpc800_dip8In the past, ARM microcontrollers have been available only in packages which are rather unfriendly for hobbyist use. However, NXP is now producing two Cortex-M0 microcontrollers in DIP packages, which are very handy for breadboard use and trough-hole soldering. The chips are LPC1114 in DIP28 package and LPC810 in DIP8 package. LPC1114FN28/102 has 32 kB flash and 8 kB ram, which is actually quite nice and allows running even a small RTOS. LPC810M021FN8 has only 4 kB flash and 1 kB ram, which is not much but still suitable for small bare metal applications. (more…)

Object-oriented approach to embedded programming (with C++)

In my real, daytime job I have been working with object-oriented languages like Java, C++, C# and python for several years. On the contrary, hobby stuff with microcontrollers has always been pure C or assembly. Although I understand perfectly resource constraints of the embedded world, the limits are not totally as strict as they used to be: modern microcontrollers tend to have more and more memory and processing power. Because I also very firmly believe that object-oriented design really rules when creating complex systems, I decided to do a little expermenting what it would mean in Pico]OS embedded world. (more…)

Manuals uploaded to github

I recently uploaded doxygen-generated manuals of some pico]OS -related libraries into github pages:

  • pico]OS: Standard documentation with latest updates
  • picoos-micro: Micro-layer documentation (misc stuff + fat)
  • picoos-ow: Maxim/Dallas support for pico]OS
  • picoos-net: IPv4 & IPv6, socket layer and ethernet drivers for pico]OS