Newlib, gcc, adding a file system

The arm-none-eabi GCC port and it's accompanying newlib (I got mine from Codesourcery but I suspect this applies to all) clearly has hooks in it to add a filesystem into an application.

I've Googled around and haven't found anything that seems to really be definitive -- Is there any really good documentation on how to do this, preferably from the point of view of the newlib developers?

TIA.

--
Tim Wescott 
Wescott Design Services 
 Click to see the full signature
Reply to
Tim Wescott
Loading thread data ...

In the source tree, look in libgloss/ (sibling to newlib/). There are various implementations of the I/O layer, from "nosys" which does nothing, to simulator syscalls, to various os-specific layers. The libgloss library lets you provide low-level open/read/write/close/exit/etc functions. Newlib's I/O functions (like stdio) are built on top of these.

Most ports just have a write() equivalent that's used for debug printfs, and exit().

Reply to
DJ Delorie

I referred to this when I did it:

formatting link

(It is rather old now)

In general it is probably a useful approach for larger projects. But it does bring in all of stdio, malloc and so forth. So it can severely bloat the code if you don't really need it.

--

John Devereux
Reply to
John Devereux

What I'm doing qualifies as a "larger project" in that regard. I'm using some off-the-shelf software that's going to be happier with stdio and malloc -- I'm probably saving work by at least a factor of 3:1, while using more memory at a factor of 5:1 or so. At the anticipated sales volume for the product, it's worth it.

--
Tim Wescott 
Wescott Design Services 
 Click to see the full signature
Reply to
Tim Wescott

formatting link
page 7

Said so: for an application I used FatFS:

formatting link
you just have to implement the low level calls, it's quite straightforward.

Hope this helps

Bye Jack

Reply to
Jack

I've used that too, a really nice little system, very easy to incorporate into a project.

--

John Devereux
Reply to
John Devereux

tto:

om

t

,

ard.

Yup, I've also used the above pair; only a tiny bit of work to integrate.

Reply to
Dave Nadler

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.