Skip to content

Commit cc58871

Browse files
Add flash for vtable destination, make it default
Add an option for placing vtables in flash to complement the existing iram and heap options. "make flash" Now that there is a way to change it, move to vtables in flash as default as only users with interrupts which use vtables require the vtable to be in RAM. For those users, if the tables are small enough they can put them in IRAM and save heap space for their app. If not, then the vtables can be placed in HEAP which supports much larger tables.
1 parent a3a3654 commit cc58871

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

tools/sdk/ld/Makefile

+6-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ WARN = "\/\* warning: AUTOGENERATED from $(COMMON)\*.h \*\/"
55

66
all:
77
@echo "available rules:"
8-
@echo " iram: move c++ vtables to iram (= default in git master repository)"
8+
@echo " flash: move c++ vtables to flash (= default in git master repository)"
9+
@echo " iram: move c++ vtables to iram"
910
@echo " heap: move c++ vtables to heap"
1011

1112
heap:
@@ -15,3 +16,7 @@ heap:
1516
iram:
1617
@(echo "$(WARN)"; $(CPP) -CC -E -DVTABLES_IN_IRAM $(COMMON).h | grep -v '^#') > $(COMMON)
1718
@echo "c++ vtables moved to iram"
19+
20+
flash:
21+
@(echo "$(WARN)"; $(CPP) -CC -E -DVTABLES_IN_FLASH $(COMMON).h | grep -v '^#') > $(COMMON)
22+
@echo "c++ vtables moved to flash"

tools/sdk/ld/eagle.app.v6.common.ld

+4-1
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,9 @@ SECTIONS
9595
*(.ver_number)
9696
*.c.o( EXCLUDE_FILE (umm_malloc.c.o) .literal*, EXCLUDE_FILE (umm_malloc.c.o) .text* )
9797
*.cpp.o(.literal*, .text*)
98+
99+
*(.rodata._ZTV*) /* C++ vtables */
100+
98101
*libc.a:(.literal .text .literal.* .text.*)
99102
*libm.a:(.literal .text .literal.* .text.*)
100103
*libgcc.a:_umoddi3.o(.literal .text)
@@ -159,7 +162,7 @@ SECTIONS
159162
*.cpp.o(.iram.text)
160163
*.c.o(.iram.text)
161164

162-
*(.rodata._ZTV*) /* C++ vtables */
165+
163166

164167
*(.fini.literal)
165168
*(.fini)

tools/sdk/ld/eagle.app.v6.common.ld.h

+4-1
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,9 @@ SECTIONS
9494
*(.ver_number)
9595
*.c.o( EXCLUDE_FILE (umm_malloc.c.o) .literal*, EXCLUDE_FILE (umm_malloc.c.o) .text* )
9696
*.cpp.o(.literal*, .text*)
97+
#ifdef VTABLES_IN_FLASH
98+
*(.rodata._ZTV*) /* C++ vtables */
99+
#endif
97100
*libc.a:(.literal .text .literal.* .text.*)
98101
*libm.a:(.literal .text .literal.* .text.*)
99102
*libgcc.a:_umoddi3.o(.literal .text)
@@ -167,7 +170,7 @@ SECTIONS
167170
_etext = .;
168171
} >iram1_0_seg :iram1_0_phdr
169172

170-
#ifdef VTABLES_IN_IRAM
173+
#if defined(VTABLES_IN_IRAM) || defined(VTABLES_IN_FLASH)
171174
#include "eagle.app.v6.common.ld.vtables.h"
172175
#endif
173176

0 commit comments

Comments
 (0)