From 17bf98c01cd6ffc0cd1a1c48ade28ed0a01ffad0 Mon Sep 17 00:00:00 2001 From: "Earle F. Philhower, III" Date: Fri, 23 Mar 2018 07:25:52 -0700 Subject: [PATCH] g_cont to unused space in SYS, gives extra 4K free Use a linker option to hardcode the address of the g_cont context variable to in a region of RAM allocated for SYS use but which is not presently used. Gives an additional 4K+ of heap to all apps. --- cores/esp8266/core_esp8266_main.cpp | 2 +- tools/sdk/ld/eagle.app.v6.common.ld | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/cores/esp8266/core_esp8266_main.cpp b/cores/esp8266/core_esp8266_main.cpp index cb7401366e..40e96c8ea5 100644 --- a/cores/esp8266/core_esp8266_main.cpp +++ b/cores/esp8266/core_esp8266_main.cpp @@ -76,7 +76,7 @@ void preloop_update_frequency() { extern void (*__init_array_start)(void); extern void (*__init_array_end)(void); -cont_t g_cont __attribute__ ((aligned (16))); +cont_t __attribute__ ((section(".sys_unused"))) g_cont __attribute__ ((aligned (16))); static os_event_t g_loop_queue[LOOP_QUEUE_SIZE]; static uint32_t g_micros_at_task_start; diff --git a/tools/sdk/ld/eagle.app.v6.common.ld b/tools/sdk/ld/eagle.app.v6.common.ld index cbc1ebf871..8da9e19b9b 100644 --- a/tools/sdk/ld/eagle.app.v6.common.ld +++ b/tools/sdk/ld/eagle.app.v6.common.ld @@ -162,6 +162,11 @@ SECTIONS _etext = .; } >iram1_0_seg :iram1_0_phdr + .sys_unused_data 0x3fffe000 : + { + *(.sys_unused) + } + .rodata : ALIGN(4) { _rodata_start = ABSOLUTE(.);