Create irom version of libc

This patch adds the voodoo required to make an irom-only
version on newlib. In case some goodies doesn't fit in SRAM.

Link with -lcirom instead of -lc

Signed-off-by: Andrew Andrianov <andrew@ncrmnt.org>
This commit is contained in:
Andrew Andrianov 2014-11-20 23:48:53 +03:00 committed by Paul Sokolovsky
parent c98642a964
commit 85d0f81b51
2 changed files with 13 additions and 3 deletions

View file

@ -2,9 +2,9 @@ TOP=$(PWD)
TOOLCHAIN=$(TOP)/xtensa-lx106-elf
STANDALONE=y
.PHONY: crosstool-NG toolchain libhal
.PHONY: crosstool-NG toolchain libhal libcirom
all: esptool .sdk_patch $(TOOLCHAIN)/xtensa-lx106-elf/sysroot/usr/lib/libhal.a $(TOOLCHAIN)/bin/xtensa-lx106-elf-gcc
all: esptool libcirom .sdk_patch $(TOOLCHAIN)/xtensa-lx106-elf/sysroot/usr/lib/libhal.a $(TOOLCHAIN)/bin/xtensa-lx106-elf-gcc
@echo
@echo "Xtensa toolchain is built, to use it:"
@echo
@ -24,6 +24,13 @@ endif
esptool: toolchain
cp esptool/esptool.py $(TOOLCHAIN)/bin/
$(TOOLCHAIN)/xtensa-lx106-elf/sysroot/lib/libcirom.a: $(TOOLCHAIN)/xtensa-lx106-elf/sysroot/lib/libc.a toolchain
@echo "Creating irom version of libc..."
$(TOOLCHAIN)/bin/xtensa-lx106-elf-objcopy --rename-section .text=.irom0.text \
--rename-section .literal=.irom0.literal $(<) $(@);
libcirom: $(TOOLCHAIN)/xtensa-lx106-elf/sysroot/lib/libcirom.a
.sdk_patch: sdk/lib/libpp.a $(TOOLCHAIN)/bin/xtensa-lx106-elf-gcc
ifeq ($(STANDALONE),y)
@echo "Installing vendor SDK headers into toolchain sysroot"
@ -72,7 +79,7 @@ _toolchain:
./ct-ng xtensa-lx106-elf
sed -r -i.org s%CT_PREFIX_DIR=.*%CT_PREFIX_DIR="$(TOOLCHAIN)"% .config
sed -r -i s%CT_INSTALL_DIR_RO=y%"#"CT_INSTALL_DIR_RO=y% .config
echo CT_STATIC_TOOLCHAIN=y >> .config
cat ../crosstool-config-overrides >> .config
./ct-ng build

View file

@ -0,0 +1,3 @@
CT_STATIC_TOOLCHAIN=y
CT_LIBC_NEWLIB_ENABLE_TARGET_OPTSPACE=y