move shaX.c constants to flash, 1072 bytes additional heap

This commit is contained in:
Rhys Williams 2016-04-29 14:10:42 +12:00
parent 022dc63496
commit cae475cad6
2 changed files with 11 additions and 1 deletions

View File

@ -505,7 +505,7 @@ BOARD=ESP8266_BOARD
# Enable link-time optimisations (inlining across files), use -Os 'cause else we end up with
# too large a firmware (-Os is -O2 without optimizations that increase code size)
ifndef DISABLE_LTO
OPTIMIZEFLAGS+=-Os -std=gnu11 -fgnu89-inline -flto -fno-fat-lto-objects -Wl,--allow-multiple-definition
OPTIMIZEFLAGS+=-Os -std=gnu11 -fgnu89-inline -fno-fat-lto-objects -Wl,--allow-multiple-definition
#OPTIMIZEFLAGS+=-DLINK_TIME_OPTIMISATION # this actually slows things down!
else
# DISABLE_LTO is necessary in order to analyze static string sizes (see: topstring makefile target)
@ -1737,6 +1737,11 @@ combined: $(ESP_COMBINED512)
# generate partially linked .o with all Esprunio source files linked
$(PARTIAL): $(OBJS) $(LINKER_FILE)
@echo LD $@
#ifdef USE_CRYPTO
$(Q)$(OBJCOPY) --rename-section .rodata=.irom0.text libs/crypto/mbedtls/library/sha1.o
$(Q)$(OBJCOPY) --rename-section .rodata=.irom0.text libs/crypto/mbedtls/library/sha256.o
$(Q)$(OBJCOPY) --rename-section .rodata=.irom0.text libs/crypto/mbedtls/library/sha512.o
#endif
$(Q)$(LD) $(OPTIMIZEFLAGS) -nostdlib -Wl,--no-check-sections -Wl,-static -r -o $@ $(OBJS)
$(Q)$(OBJCOPY) --rename-section .text=.irom0.text --rename-section .literal=.irom0.literal $@

View File

@ -118,6 +118,11 @@
#define MBEDTLS_PLATFORM_CALLOC_MACRO(X,Y) jsvMalloc((X)*(Y))
#define MBEDTLS_PLATFORM_FREE_MACRO(X) jsvFree(X)
/* use flash safe version of memcpy so that rodata can be moved to irom */
#ifdef ESP8266
#define memcpy(d,s,n) flash_strncpy((char*)d,(const char *)s,n)
#endif
#include "mbedtls/check_config.h"