title: Porting newlib to a custom ARM setup
body: <p>this is my first post, and it covers something which I've been trying to get working on and off for about a year now.</p>
  
  <p>Essentially it boils down to the following: I have a copy of newlib which I'm trying to get working on an LPC2388 (an ARM7TDMI from NXP).  This is on a linux box using arm-elf-gcc</p>
  
  <p>The question I have is that I've been looking at a lot of the tutorials talking about porting newlib, and they all talk about the stubs (like exit, open, read/write, sbrk), and I have a pretty good idea of how to implement all of these functions.  But <em>where</em> should I put them?</p>
  
  <p>I have the newlib distribution from sources.redhat.com/pub/newlib/newlib-1.18.0.tar.gz and after poking around I found "syscalls.c" (in newlib-1.18.0/newlib/libc/sys/arm) which contains all of the stubs which I have to update, but they're all filled in with rather finished looking code (which does <em>NOT</em> seem to work without the crt0.S, which itself does not work with my chip).</p>
  
  <p>Should I just be wiping out those functions myself, and re-writing them?  Or should I write them somewhere else.  Should I make a whole new folder in newlib/libc/sys with the name of my "architecture" and change the target to match?</p>
  
  <p>I'm also curious if there's proper etiquette on distribution of something like this after releasing it as an open source project.  I currently have a script which downloads binutils, arm-elf-gcc, newlib, and gdb, and compiles them.  If I am modifying files which are in the newlib directory, should I hand a patch which my script auto-applies?  Or should I add the modified newlib to the repository?</p>
  
  <p>Thanks for bothering to read! Following this is a more detailed breakdown of what I'm doing.</p>
  
  <hr>
  
  <h2>For those who want/need more info about my setup:</h2>
  
  <p>I'm building a ARM videogame console based loosely on the Uzebox project ( <a href="http://belogic.com/uzebox/" rel="nofollow">http://belogic.com/uzebox/</a> ).  </p>
  
  <p>I've been doing all sorts of things pulling from a lot of different resources as I try and figure it out.  You can read about the start of my adventures here (sparkfun forums, no one responds as I figure it out on my own): forum.sparkfun.com/viewtopic.php?f=11&amp;t=22072</p>
  
  <p>I followed all of this by reading through the Stackoverflow questions about porting newlib and saw a few of the different tutorials (like wiki.osdev.org/Porting_Newlib ) but they also suffer from telling me to implements stubs without mentioning where, who, what, when, or how!</p>