Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Split IRAM into 2 linker sections to move std::fcn
Callbacks need to be placed in IRAM when being called from an IRQ (like
the SPISlave callbacks).

This can be done by hacking the std::functional header and making every
single specialization of the template into an IRAM section, which would
take a lot of space for no benefit in the majority of cases.

The alternate is to specify the single instantiation types/operators
required, but the problem is the flash segment matcher would match them
before the IRAM section was begun, and rules for them would just not be
applied.

Get around this by splitting the IRAM section definition into .text and
.text1.  This is linker syntactic sugar and does not actually change the
on-chip layout.  But it does allow us to put the exception vectors at
the required absolute addresses and add single functions to IRAM.
  • Loading branch information
earlephilhower committed Mar 27, 2019
commit a001f5e85f46fcb2826bdac3a8c0e7e136b5ca1d
71 changes: 41 additions & 30 deletions tools/sdk/ld/eagle.app.v6.common.ld.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,44 @@ SECTIONS
#include "eagle.app.v6.common.ld.vtables.h"
#endif

/* IRAM is split into .text and .text1 to allow for moving specific */
/* functions into IRAM that would be matched by the irom0.text matcher */
.text : ALIGN(4)
{
_stext = .;
_text_start = ABSOLUTE(.);
*(.UserEnter.text)
. = ALIGN(16);
*(.DebugExceptionVector.text)
. = ALIGN(16);
*(.NMIExceptionVector.text)
. = ALIGN(16);
*(.KernelExceptionVector.text)
LONG(0)
LONG(0)
LONG(0)
LONG(0)
. = ALIGN(16);
*(.UserExceptionVector.text)
LONG(0)
LONG(0)
LONG(0)
LONG(0)
. = ALIGN(16);
*(.DoubleExceptionVector.text)
LONG(0)
LONG(0)
LONG(0)
LONG(0)
. = ALIGN (16);
*(.entry.text)
*(.init.literal)
*(.init)

/* Special functions/templates that need to be in IRAM (SPI/IRQ callbacks/etc. here */
*(.text._ZNKSt8functionIFvvEEclEv) /* std::function<void ()>::operator()() const */
} >iram1_0_seg :iram1_0_phdr

.irom0.text : ALIGN(4)
{
_irom0_text_start = ABSOLUTE(.);
Expand Down Expand Up @@ -163,37 +201,10 @@ SECTIONS
_flash_code_end = ABSOLUTE(.);
} >irom0_0_seg :irom0_0_phdr

.text : ALIGN(4)


.text1 : ALIGN(4)
{
_stext = .;
_text_start = ABSOLUTE(.);
*(.UserEnter.text)
. = ALIGN(16);
*(.DebugExceptionVector.text)
. = ALIGN(16);
*(.NMIExceptionVector.text)
. = ALIGN(16);
*(.KernelExceptionVector.text)
LONG(0)
LONG(0)
LONG(0)
LONG(0)
. = ALIGN(16);
*(.UserExceptionVector.text)
LONG(0)
LONG(0)
LONG(0)
LONG(0)
. = ALIGN(16);
*(.DoubleExceptionVector.text)
LONG(0)
LONG(0)
LONG(0)
LONG(0)
. = ALIGN (16);
*(.entry.text)
*(.init.literal)
*(.init)
*(.literal .text .iram.literal .iram.text .iram.text.* .literal.* .text.* .stub .gnu.warning .gnu.linkonce.literal.* .gnu.linkonce.t.*.literal .gnu.linkonce.t.*)
#ifdef VTABLES_IN_IRAM
*(.rodata._ZTV*) /* C++ vtables */
Expand Down