Skip to content

Commit

Permalink
Update miniz to 2.1.0
Browse files Browse the repository at this point in the history
Update miniz to the latest version, 2.1.0. This is the stock, amalgated
miniz, with a few modifications, forward-ported from the existing diff
against 1.5:
 * Configuration options (the definitions at the top of miniz.h)
 * Disabling assert(), i.e. defining MZ_ASSERT to nothing
 * Defining TDEFL_LESS_MEMORY to 1
 * Setting TDEFL_LZ_DICT_SIZE = 8*1024 and TDEFL_LZ_CODE_BUF_SIZE = 8 * 1024

An additional complication is that the new miniz performs a long long to
integer division, which requires code from libgcc (__ashldi3), which we
didn't link to by default (due to -nostdlib). Add -lgcc to LDLIBS.

Even with the additional libgcc dependency, it seems like this is a
.text reduction: from 7990 to 7947 (both compiled with gcc 9.2.1 and
picolibc 1.3).

Tested on real hardware (D1 Mini Pro).

See #499 for some additional context.
  • Loading branch information
paravoid committed Jan 6, 2020
1 parent e28e839 commit 989b147
Show file tree
Hide file tree
Showing 4 changed files with 8,064 additions and 4,801 deletions.
7 changes: 4 additions & 3 deletions flasher_stub/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -65,18 +65,19 @@ $(BUILD_DIR):
CFLAGS = -std=c99 -Wall -Werror -Os \
-mtext-section-literals -mlongcalls -nostdlib -fno-builtin -flto \
-Wl,-static -g -ffunction-sections -Wl,--gc-sections -Iinclude -Lld
LDLIBS = -lgcc

$(STUB_ELF_8266): $(SRCS) $(SRCS_8266) $(BUILD_DIR) ld/stub_8266.ld | Makefile
@echo " CC(8266) $^ -> $@"
$(Q) $(CROSS_8266)gcc $(CFLAGS) -DESP8266 -Tstub_8266.ld -Wl,-Map=$(@:.elf=.map) -o $@ $(filter %.c, $^)
$(Q) $(CROSS_8266)gcc $(CFLAGS) -DESP8266 -Tstub_8266.ld -Wl,-Map=$(@:.elf=.map) -o $@ $(filter %.c, $^) $(LDLIBS)

$(STUB_ELF_32): $(SRCS) $(BUILD_DIR) ld/stub_32.ld | Makefile
@echo " CC(32) $^ -> $@"
$(Q) $(CROSS_32)gcc $(CFLAGS) -DESP32 -Tstub_32.ld -Wl,-Map=$(@:.elf=.map) -o $@ $(filter %.c, $^)
$(Q) $(CROSS_32)gcc $(CFLAGS) -DESP32 -Tstub_32.ld -Wl,-Map=$(@:.elf=.map) -o $@ $(filter %.c, $^) $(LDLIBS)

$(STUB_ELF_32S2): $(SRCS) $(BUILD_DIR) ld/stub_32s2.ld
@echo " CC(32S2) $^ -> $@"
$(Q) $(CROSS_32S2)gcc $(CFLAGS) -DESP32S2 -Tstub_32s2.ld -Wl,-Map=$(@:.elf=.map) -o $@ $(filter %.c, $^)
$(Q) $(CROSS_32S2)gcc $(CFLAGS) -DESP32S2 -Tstub_32s2.ld -Wl,-Map=$(@:.elf=.map) -o $@ $(filter %.c, $^) $(LDLIBS)

$(STUB_PY): $(STUB_ELF_8266) $(STUB_ELF_32) $(STUB_ELF_32S2) wrap_stub.py
@echo " WRAP $^ -> $@"
Expand Down
Loading

0 comments on commit 989b147

Please sign in to comment.