Services and Modeling for Embedded Software Development
Embecosm divider strip
Prev  Next

7.1.  Putting Newlib in a Custom Location

Normally newlib will be installed in a standard place with the rest of the tool chain. Its headers will go in the include directory within the target specific installation directory. The C runtime start up file, the newlib libraries themselves and BSP libraries will go in the lib directory within the target specific installation directory.

This arrangement ensures that GCC will pick up the headers and libraries automatically and in the correct sequence.

However if newlib is not the only C library, then this may be inconvenient. For example the OpenRISC 1000  usually uses uClibc, and only uses newlib when regression testing the GNU tool chain.

The solution is to move the newlib headers and libraries to a custom location and modify GCC to search there when newlib is being used (see Section 7.2).

This is achieved with a simple script at the end of build and install. For example with the OpenRISC 1000  the following command will suffice, where the prefix used for the entire tool chain build is in ${install_dir}.

mkdir -p ${install_dir}/or32-elf/newlib
rm -rf ${install_dir}/or32-elf/newlib-include
mv ${install_dir}/or32-elf/include ${install_dir}/or32-elf/newlib-include
mv ${install_dir}/or32-elf/lib/*.a ${install_dir}/or32-elf/newlib
mv ${install_dir}/or32-elf/lib/crt0.o ${install_dir}/or32-elf/newlib
	
Embecosm divider strip