1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-08-17 06:42:21 +03:00

Memory optimization for static const data. (#30)

This commit is contained in:
slaff
2016-12-11 16:48:15 +01:00
committed by Ivan Grokhotkov
parent 5282123a96
commit d768568ae7
5 changed files with 17 additions and 4 deletions

View File

@@ -4,6 +4,7 @@ AR := $(TOOLCHAIN_PREFIX)ar
LD := $(TOOLCHAIN_PREFIX)gcc
OBJCOPY := $(TOOLCHAIN_PREFIX)objcopy
MFORCE32 := $(shell $(CC) --help=target | grep mforce-l32)
XTENSA_LIBS ?= $(shell $(CC) -print-sysroot)
@@ -43,6 +44,14 @@ LDFLAGS += -L$(XTENSA_LIBS)/lib \
CFLAGS+=-std=c99 -DESP8266
CFLAGS += -Wall -Os -g -O2 -Wpointer-arith -Wno-implicit-function-declaration -Wl,-EL -fno-inline-functions -nostdlib -mlongcalls -mno-text-section-literals -D__ets__ -DICACHE_FLASH
ifneq ($(MFORCE32),)
# Your compiler supports the -mforce-l32 flag which means that
# constants can be stored in flash (program) memory instead of SRAM.
# See: https://www.arduino.cc/en/Reference/PROGMEM
CFLAGS += -DPROGMEM="__attribute__((aligned(4))) __attribute__((section(\".irom.text\")))" -mforce-l32
endif
BIN_DIR := bin
AXTLS_AR := $(BIN_DIR)/libaxtls.a

View File

@@ -75,7 +75,7 @@
/*
* AES S-box
*/
static const uint8_t aes_sbox[256] =
static const uint8_t aes_sbox[256] PROGMEM =
{
0x63,0x7C,0x77,0x7B,0xF2,0x6B,0x6F,0xC5,
0x30,0x01,0x67,0x2B,0xFE,0xD7,0xAB,0x76,
@@ -114,7 +114,7 @@ static const uint8_t aes_sbox[256] =
/*
* AES is-box
*/
static const uint8_t aes_isbox[256] =
static const uint8_t aes_isbox[256] PROGMEM =
{
0x52,0x09,0x6a,0xd5,0x30,0x36,0xa5,0x38,
0xbf,0x40,0xa3,0x9e,0x81,0xf3,0xd7,0xfb,

View File

@@ -309,7 +309,7 @@ EXP_FUNC void STDCALL print_blob(const char *format, const unsigned char *data,
#if defined(CONFIG_SSL_HAS_PEM) || defined(CONFIG_HTTP_HAS_AUTHORIZATION)
/* base64 to binary lookup table */
static const uint8_t map[128] =
static const uint8_t map[128] PROGMEM =
{
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,

View File

@@ -42,7 +42,7 @@
#define SIGMA4(x) (ROR64(x, 19) ^ ROR64(x, 61) ^ SHR64(x, 6))
#define MIN(x, y) ((x) < (y) ? x : y)
static const uint8_t padding[128] =
static const uint8_t padding[128] PROGMEM =
{
0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,

View File

@@ -230,6 +230,10 @@ void exit_now(const char *format, ...);
#define SSL_CTX_UNLOCK(A)
#endif
#ifndef PROGMEM
#define PROGMEM
#endif
#ifdef __cplusplus
}
#endif