1 2 3TARGET_DIR=$(PWD)/.build 4ROM_ELF_FILE ?= /tmp/eagle.pro.rom.out 5 6all: newlib check_common_syms 7 8newlib_xtensa-2.2.0: 9 git submodule update --init 10 11newlib: newlib_xtensa-2.2.0 12 13newlib: 14 cd newlib_xtensa-2.2.0 && \ 15 ./configure \ 16 --with-newlib \ 17 --enable-multilib \ 18 --disable-newlib-io-c99-formats \ 19 --disable-newlib-supplied-syscalls \ 20 --enable-newlib-nano-formatted-io \ 21 --enable-newlib-reent-small \ 22 --enable-target-optspace \ 23 --program-transform-name="s&^&xtensa-esp108-elf-&" \ 24 --disable-option-checking \ 25 --with-target-subdir=xtensa-esp108-elf \ 26 --target=xtensa-esp108-elf \ 27 --prefix=$(TARGET_DIR) \ 28 && CROSS_CFLAGS="-DSIGNAL_PROVIDED -DABORT_PROVIDED -DMALLOC_PROVIDED" make all install || true 29 cp -r $(TARGET_DIR)/xtensa-esp108-elf/{include,lib} ./ 30 cp lib/libc.a lib/libc_rom.a 31 xtensa-esp108-elf-ar d lib/libc_rom.a lib_a-nano-vfprintf_float.o 32 xtensa-esp108-elf-ar d lib/libc_rom.a lib_a-nano-vfscanf_float.o 33 while read obj; do xtensa-esp108-elf-ar d lib/libc.a $$obj; done <libc_discard.list 34 35 36clean: 37 rm -rf newlib_xtensa-2.2.0 .build include lib 38 39check_common_syms: 40 @# get symbols in libc.a, except for _printf_float and _scanf_float 41 @xtensa-esp108-elf-nm lib/libc.a | grep -v -E "\W+U\W+" | awk '{print $$3}' | grep -v -E '^$$' | grep -v '_printf_float' | grep -v '_scanf_float' | sort >libc.syms 42 @# get symbols in ROM 43 @xtensa-esp108-elf-nm $(ROM_ELF_FILE) | grep -v -E '\W+U\W+' | awk '{print $$3}' | sort >rom.syms 44 @# check that there are no common symbols 45 @test $$(comm -12 rom.syms libc.syms | tee common.syms | wc -l) -eq 0 46 47.PHONY: all clean newlib 48