Build Newlib for SPARC and ARM Architecture
Clone Newlib from its Repository and Build it using RTEMS Toolchain
Prerequisites
- You must have build RTEMS Toolchain for SPARC and ARM Architecture using RSB.
- A Project Sand-boxing is preferred.
What is Newlib?
Newlib is a C standard library implementation intended for use on embedded systems. It is a conglomeration of several library parts, all under free software licenses that make them easily usable on embedded products.
It was created by Cygnus Support as part of building the first GNU cross-development tool-chains. It is now maintained by Red Hat developers and is used in most commercial and non-commercial GCC ports for non-Linux embedded systems.
Wikipedia contributors. (2019, April 12). Newlib. In Wikipedia, The Free Encyclopedia. Retrieved 13:02, July 4, 2019, from https://en.wikipedia.org/w/index.php?title=Newlib&oldid=892195321
Clone
I have mentioned my Project Sand-boxing above, I will be using the same directory structure. You can set it according to you.
$ cd ~/
$ mkdir -p development/newlib
$ cd development/newlib
$ git clone git://sourceware.org/git/newlib-cygwin.git
Conflict in Autoconf versions
Inside the project folder newlib-cygwin
, different sub directories are using different versions of autoconf
tools.
Refer My another blog to solve this issue: How To Handle Two Versions of autoconf?
Run `autoreconf -fvi`
I need autoconf
version 2.64.
$ cd ~/development/newlib/newlib-cygwin
$ export PATH=/opt/autoconf-2.64/bin:$PATH
$ autoreconf -fvi
Task 1 : Build for SPARC
$ cd ~/development/newlib
$ mkdir b-sparc-rterms5-newlib
$ cd b-sparc-rtems5-newlib
Now, I need autoconf
version 2.69 and RTEMS Tool Chain
$ export PATH=$HOME/development/rtems/5/bin:$PATH$ ../newlib-cygwin/configure --target=sparc-rtems5 --disable-shared --disable-nls --enable-werror --enable-newlib-supplied-syscalls --enable-interwork --enable-multilib --with-gnu-as --with-gnu-ld
I you are in contributing to Newlib, you must only build to check if your code is correct, and then install it.
$ make all
$ sudo make install
Task 2: Build for ARM
$ cd ~/development/newlib
$ mkdir b-arm-rterms5-newlib
$ cd b-arm-rtems5-newlib
Now, I need autoconf
version 2.69 and RTEMS Tool Chain
$ export PATH=$HOME/development/rtems/5/bin:$PATH$ ../newlib-cygwin/configure --target=arm-rtems5 --disable-shared --disable-nls --enable-werror --enable-newlib-supplied-syscalls --enable-interwork --enable-multilib --with-gnu-as --with-gnu-ld
I you are in contributing to Newlib, you must only build to check if your code is correct, and then install it.
$ make all
$ sudo make install
Handling build fail after contributing to Newlib Project
Once you clone and build Newlib for say SPARC. The as you are a developer, you made some changes in newlib source tree. (inside ~/development/newlib/newlib-cygwin
)
Then you try to build it again for SPARC.
$ cd ~/development/newlib/b-sparc-rtems5-newlib
$ make all
While re-building it may show error:
Running make distclean
didn’t worked for me. So, inside the same directory, I used this command:
$ rm $(find ./ -name \config.cache)
After this, make all
worked.
Let’s get connected
Follow/ Connect with me anytime.
- LinkedIn- https://www.linkedin.com/in/varodek/
- GitHub- https://www.github.com/VARoDeK
- Facebook- https://www.facebook.com/vaibhav.gupta.1004837
- Twitter- https://twitter.com/varodek
Follow this Publication for more stories on this subject. If you find this blog helpful, please click the 👏 button and share to help others find it! Feel free to leave a comment 💬 below :).