https://sourceware.org/newlib/html
1.Download source code (2 ways)linux
1.git cloneandroid
2.ftp(Recommended)git
ftp://sourceware.org/pub/newlib/index.htmlbash
version : android-7.0/prebuilts/gcc/linux-x86/arm/gcc-none-eabi-4.8q3/arm_none_eabi/include/newlib.h字體
eg: newlib-2.1.0.tar.gz;ui
2.buildspa
1.untarcode
1 $tar –xf newlib-2.1.0.tar.gz 2 $cd newlib-2.1.0/
2.create newlib-2.1.0/build to buildhtm
create newlib-2.1.0/out to install
1 $mkdir build 2 $mkdir out
3 $cd build/
3.generate Makefile
1 $../configure --prefix=/home/user_name/xxx/…/newlib-2.1.0/out --target=arm-none-eabi
4.compile(errors need to be fixed)
1 $make
5.copy libc.a to out/
1 $make install
[compile errors]
(紅色字體爲添加,中劃線爲刪除)
1.set PATH (use android bins: arm-none-eabi-gcc…)
~/.bashrc
PATH=${PATH}:…/android/prebuilts/gcc/linux-x86/arm/gcc-arm-none-eabi-4_8-2014q3/bin
CC=arm-none-eabi-gcc
LD=arm-none-eabi-ld
2.armv6-m need lo register
newlib-2.1.0/newlib/libc/sys/arm/trap.S
#if !(defined(__thumb2__)||(defined(__ARM_ARCH_6M__)
3.No rule to make target libgloss/arm/config/default.mh
newlib-2.1.0/libgloss/arm/cpu-init/Makefile.in
objtype = @objtype@
host_makefile_frag = $(srcdir)/../../config/default.mh
…
Makefile: Makefile.in ../config.status @host_makefile_frag_path@
Makefile: Makefile.in ../config.status ${host_makefile_frag_path}
$(SHELL) ../config.status–file cpu-init/Makefile
4.disable variable size enums
after../configure …
newlib-2.1.0/build/Makefile
CFLAGS_FOR_TARGET = –g –02 –fno-short-enums
CXXFLAGS_FOR_TARGET = –g –02 –fno-short-enums