EmbeddedRelated.com
Forums
The 2026 Embedded Online Conference

Newlib, gcc, adding a file system

Started by Tim Wescott November 5, 2015
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
http://www.wescottdesign.com
Tim Wescott <seemywebsite@myfooter.really> writes:
> 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?
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().
Tim Wescott <seemywebsite@myfooter.really> writes:

> 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?
I referred to this when I did it: http://www.cs.ccu.edu.tw/~pahsiung/courses/ese/resources/newlib.pdf (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
On Fri, 06 Nov 2015 11:32:53 +0000, John Devereux wrote:

> Tim Wescott <seemywebsite@myfooter.really> writes: > >> 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? > > I referred to this when I did it: > > http://www.cs.ccu.edu.tw/~pahsiung/courses/ese/resources/newlib.pdf > > (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.
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 http://www.wescottdesign.com
Il giorno gioved&#4294967295; 5 novembre 2015 19:39:09 UTC+1, Tim Wescott ha scritto:
> 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.
http://www.cs.ccu.edu.tw/~pahsiung/courses/ese/resources/newlib.pdf page 7 Said so: for an application I used FatFS: http://elm-chan.org/fsw/ff/00index_e.html you just have to implement the low level calls, it's quite straightforward. Hope this helps Bye Jack
Jack <jack4747@gmail.com> writes:

> Il giorno gioved&igrave; 5 novembre 2015 19:39:09 UTC+1, Tim Wescott ha scritto: >> 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. > > http://www.cs.ccu.edu.tw/~pahsiung/courses/ese/resources/newlib.pdf > page 7 > > Said so: > for an application I used FatFS: > http://elm-chan.org/fsw/ff/00index_e.html > you just have to implement the low level calls, it's quite straightforward.
I've used that too, a really nice little system, very easy to incorporate into a project. -- John Devereux
On Wednesday, November 11, 2015 at 11:59:07 AM UTC-5, John Devereux wrote:
> Jack <jack4747@gmail.com> writes: > > > Il giorno gioved&#4294967295; 5 novembre 2015 19:39:09 UTC+1, Tim Wescott ha scritto: > >> 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. > > > > http://www.cs.ccu.edu.tw/~pahsiung/courses/ese/resources/newlib.pdf > > page 7 > > > > Said so: > > for an application I used FatFS: > > http://elm-chan.org/fsw/ff/00index_e.html > > you just have to implement the low level calls, it's quite straightforward. > > I've used that too, a really nice little system, very easy to > incorporate into a project. > > -- > > John Devereux
Yup, I've also used the above pair; only a tiny bit of work to integrate.
The 2026 Embedded Online Conference