Implementing C file streams (FILE *, fopen, fread, etc.) On the embedded platform

I was tasked with adding threading support (C89 / C90) to the libraries for my company’s embedded C compiler. Our target hardware typically has 1 MB or less code space and does not have an operating system.

We have many stream implementations of the entire code base that I can use as a starting point. For example, a console that works via TCP sockets or a serial port, a web server that reads from FAT on an SD card or in memory, and even firmware for firmware that can be read from many sources.

Before I go and reinvent the wheel, I wonder if there are existing implementations that I could use or use as a starting point for my work. Although we provide the full source code to our customers, the GPL license code is not an option, as our customers do not want to release the source code for their products.

Can anyone recommend a book (Unix annotated source, CompSci text) or a public domain / BSD based source? I would rather look at an older single-device OS, as current operating systems contain confusion of macros and typedefs layers that make it difficult to define even a simple structure definition.

+5
source share
5 answers

Take a look at PJ Plauger's Standard C Library , which details one possible implementation of the full C89 library.

+8
source

You should remove most of what you need from the source code for the GNU C standard library . It is licensed using the Lesser GPL , which means you can link to the library without affecting your software license (or forcing your customers to release them the code). Porting this to your platform (thus storing the LGPL-ed code in its own library) may be easier than implementing your own from scratch.

GNU GLIBC . :

, EGLIBC uLIBC , MMU.

BSD- libc

STLSoft, ( lib C) BSD. , , , , , LGPL-ed .

+5

* BSD (Net | Open | Free) libc ? , .

+2

. .

I took the source for the compiler printfand adapted for the debug port in the embedded system. There is less work when you have a foundation to create.

0
source

All Articles