Remove code from libgcc and libc that is provided by the ROM.
This saves about 2.5k of iram.
This commit is contained in:
parent
497b4e607b
commit
9e302c59ed
5 changed files with 60 additions and 3 deletions
24
common.mk
24
common.mk
|
@ -160,6 +160,26 @@ endif
|
|||
-include $$($(1)_OBJ_FILES:.o=.d)
|
||||
endef
|
||||
|
||||
# Remove comment lines from libgcc.remove file
|
||||
$(BUILD_DIR)libgcc.remove: $(ROOT)lib/libgcc.remove | $(BUILD_DIR)
|
||||
$(Q) grep -v "^#" $< | cat > $@
|
||||
|
||||
# Remove unwanted object files listed in libgcc.remove
|
||||
$(BUILD_DIR)libgcc.a: $(ROOT)lib/libgcc.a $(BUILD_DIR)libgcc.remove | $(BUILD_DIR)
|
||||
@echo "Removing unwanted objects from $<"
|
||||
$(Q) cat $< > $@
|
||||
$(Q) $(AR) d $@ @$(word 2,$^)
|
||||
|
||||
# Remove comment lines from libc.remove file
|
||||
$(BUILD_DIR)libc.remove: $(ROOT)libc/libc.remove | $(BUILD_DIR)
|
||||
$(Q) grep -v "^#" $< | cat > $@
|
||||
|
||||
# Remove unwanted object files listed in libgcc.remove
|
||||
$(BUILD_DIR)libc.a: $(ROOT)libc/xtensa-lx106-elf/lib/libc.a $(BUILD_DIR)libc.remove | $(BUILD_DIR)
|
||||
@echo "Removing unwanted objects from $<"
|
||||
$(Q) cat $< > $@
|
||||
$(Q) $(AR) d $@ @$(word 2,$^)
|
||||
|
||||
## Linking rules for SDK libraries
|
||||
## SDK libraries are preprocessed to:
|
||||
# - remove object files named in <libname>.remove
|
||||
|
@ -208,9 +228,9 @@ $(foreach component,$(COMPONENTS), \
|
|||
)
|
||||
|
||||
# final linking step to produce .elf
|
||||
$(PROGRAM_OUT): $(WHOLE_ARCHIVES) $(COMPONENT_ARS) $(SDK_PROCESSED_LIBS) $(LINKER_SCRIPTS)
|
||||
$(PROGRAM_OUT): $(WHOLE_ARCHIVES) $(COMPONENT_ARS) $(BUILD_DIR)libgcc.a $(BUILD_DIR)libc.a $(SDK_PROCESSED_LIBS) $(LINKER_SCRIPTS)
|
||||
$(vecho) "LD $@"
|
||||
$(Q) $(LD) $(LDFLAGS) -Wl,--whole-archive $(WHOLE_ARCHIVES) -Wl,--no-whole-archive -Wl,--start-group $(COMPONENT_ARS) $(LIB_ARGS) $(SDK_LIB_ARGS) -Wl,--end-group -o $@
|
||||
$(Q) $(LD) $(LDFLAGS) -Wl,--whole-archive $(WHOLE_ARCHIVES) -Wl,--no-whole-archive -Wl,--start-group $(COMPONENT_ARS) $(BUILD_DIR)libgcc.a $(BUILD_DIR)libc.a $(LIB_ARGS) $(SDK_LIB_ARGS) -Wl,--end-group -o $@
|
||||
|
||||
$(BUILD_DIR) $(FIRMWARE_DIR) $(BUILD_DIR)sdklib:
|
||||
$(Q) mkdir -p $@
|
||||
|
|
BIN
lib/libgcc.a
Normal file
BIN
lib/libgcc.a
Normal file
Binary file not shown.
24
lib/libgcc.remove
Normal file
24
lib/libgcc.remove
Normal file
|
@ -0,0 +1,24 @@
|
|||
# Object files to be removed from libgcc
|
||||
# These are provided by the ROM.
|
||||
_addsubdf3.o
|
||||
_addsubsf3.o
|
||||
_divdf3.o
|
||||
_divdi3.o
|
||||
_divsi3.o
|
||||
_extendsfdf2.o
|
||||
_fixdfsi.o
|
||||
_fixunssfsi.o
|
||||
_floatsidf.o
|
||||
_floatsisf.o
|
||||
_floatunsidf.o
|
||||
_floatunsisf.o
|
||||
_muldf3.o
|
||||
_muldi3.o
|
||||
_mulsf3.o
|
||||
_subdf3.o
|
||||
_subsf3.o
|
||||
_truncdfsf2.o
|
||||
_udivdi3.o
|
||||
_umoddi3.o
|
||||
_umodsi3.o
|
||||
_umulsidi3.o
|
13
libc/libc.remove
Normal file
13
libc/libc.remove
Normal file
|
@ -0,0 +1,13 @@
|
|||
# Object files to remove from libc.a
|
||||
# These are provided by the ROM.
|
||||
lib_a-bzero.o
|
||||
lib_a-memcmp.o
|
||||
lib_a-memcpy.o
|
||||
lib_a-memmove.o
|
||||
lib_a-memset.o
|
||||
lib_a-strcmp.o
|
||||
lib_a-strcpy.o
|
||||
lib_a-strlen.o
|
||||
lib_a-strncmp.o
|
||||
lib_a-strncpy.o
|
||||
lib_a-strstr.o
|
|
@ -66,7 +66,7 @@ COMPONENTS ?= $(EXTRA_COMPONENTS) FreeRTOS lwip core open_esplibs
|
|||
SDK_LIBS ?= main net80211 phy pp wpa
|
||||
|
||||
# open source libraries linked in
|
||||
LIBS ?= hal gcc c
|
||||
LIBS ?= hal
|
||||
|
||||
# set to 0 if you want to use the toolchain libc instead of esp-open-rtos newlib
|
||||
OWN_LIBC ?= 1
|
||||
|
|
Loading…
Reference in a new issue