Skip to content

Commit

Permalink
Add flash for vtable destination, make it default
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
earlephilhower committed Mar 27, 2018
1 parent a3a3654 commit cc58871
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
7 changes: 6 additions & 1 deletion tools/sdk/ld/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ WARN = "\/\* warning: AUTOGENERATED from $(COMMON)\*.h \*\/"

all:
@echo "available rules:"
@echo " iram: move c++ vtables to iram (= default in git master repository)"
@echo " flash: move c++ vtables to flash (= default in git master repository)"
@echo " iram: move c++ vtables to iram"
@echo " heap: move c++ vtables to heap"

heap:
Expand All @@ -15,3 +16,7 @@ heap:
iram:
@(echo "$(WARN)"; $(CPP) -CC -E -DVTABLES_IN_IRAM $(COMMON).h | grep -v '^#') > $(COMMON)
@echo "c++ vtables moved to iram"

flash:
@(echo "$(WARN)"; $(CPP) -CC -E -DVTABLES_IN_FLASH $(COMMON).h | grep -v '^#') > $(COMMON)
@echo "c++ vtables moved to flash"
5 changes: 4 additions & 1 deletion tools/sdk/ld/eagle.app.v6.common.ld
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ SECTIONS
*(.ver_number)
*.c.o( EXCLUDE_FILE (umm_malloc.c.o) .literal*, EXCLUDE_FILE (umm_malloc.c.o) .text* )
*.cpp.o(.literal*, .text*)

*(.rodata._ZTV*) /* C++ vtables */

*libc.a:(.literal .text .literal.* .text.*)
*libm.a:(.literal .text .literal.* .text.*)
*libgcc.a:_umoddi3.o(.literal .text)
Expand Down Expand Up @@ -159,7 +162,7 @@ SECTIONS
*.cpp.o(.iram.text)
*.c.o(.iram.text)

*(.rodata._ZTV*) /* C++ vtables */


*(.fini.literal)
*(.fini)
Expand Down
5 changes: 4 additions & 1 deletion tools/sdk/ld/eagle.app.v6.common.ld.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ SECTIONS
*(.ver_number)
*.c.o( EXCLUDE_FILE (umm_malloc.c.o) .literal*, EXCLUDE_FILE (umm_malloc.c.o) .text* )
*.cpp.o(.literal*, .text*)
#ifdef VTABLES_IN_FLASH
*(.rodata._ZTV*) /* C++ vtables */
#endif
*libc.a:(.literal .text .literal.* .text.*)
*libm.a:(.literal .text .literal.* .text.*)
*libgcc.a:_umoddi3.o(.literal .text)
Expand Down Expand Up @@ -167,7 +170,7 @@ SECTIONS
_etext = .;
} >iram1_0_seg :iram1_0_phdr

#ifdef VTABLES_IN_IRAM
#if defined(VTABLES_IN_IRAM) || defined(VTABLES_IN_FLASH)
#include "eagle.app.v6.common.ld.vtables.h"
#endif

Expand Down

0 comments on commit cc58871

Please sign in to comment.