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:
parent
c98642a964
commit
85d0f81b51
2 changed files with 13 additions and 3 deletions
13
Makefile
13
Makefile
|
@ -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
|
||||
|
||||
|
||||
|
|
3
crosstool-config-overrides
Normal file
3
crosstool-config-overrides
Normal file
|
@ -0,0 +1,3 @@
|
|||
CT_STATIC_TOOLCHAIN=y
|
||||
CT_LIBC_NEWLIB_ENABLE_TARGET_OPTSPACE=y
|
||||
|
Loading…
Add table
Reference in a new issue