Add IRAM attribute for IRAM loaded symbols, add to common FreeRTOS functions

Closes #7.

It'd be nice to change the linker script so .text is always linked to
IROM instead of needing to objcopy each compiled file. The sticking
point for this is libgcc & libhal, which have symbols in .text that need
to be loaded to IRAM.
This commit is contained in:
Angus Gratton 2015-06-08 17:54:46 +10:00
parent a476fb007e
commit 0dbb6d31a5
4 changed files with 12 additions and 10 deletions

View file

@ -120,7 +120,7 @@ static int pending_maclayer_sv;
In the original esp_iot_rtos_sdk implementation, arg was a char. Using an In the original esp_iot_rtos_sdk implementation, arg was a char. Using an
enum is ABI-compatible, though. enum is ABI-compatible, though.
*/ */
void PendSV(enum SVC_ReqType req) void IRAM PendSV(enum SVC_ReqType req)
{ {
vPortEnterCritical(); vPortEnterCritical();
@ -141,7 +141,7 @@ void PendSV(enum SVC_ReqType req)
*/ */
extern portBASE_TYPE sdk_MacIsrSigPostDefHdl(void); extern portBASE_TYPE sdk_MacIsrSigPostDefHdl(void);
void SV_ISR(void) void IRAM SV_ISR(void)
{ {
portBASE_TYPE xHigherPriorityTaskWoken=pdFALSE ; portBASE_TYPE xHigherPriorityTaskWoken=pdFALSE ;
if(pending_maclayer_sv) if(pending_maclayer_sv)
@ -206,14 +206,14 @@ static unsigned portBASE_TYPE uxCriticalNesting = 0;
* with a save/restore of interrupt level, although it's difficult as * with a save/restore of interrupt level, although it's difficult as
* the functions have no return value. * the functions have no return value.
*/ */
void vPortEnterCritical( void ) void IRAM vPortEnterCritical( void )
{ {
portDISABLE_INTERRUPTS(); portDISABLE_INTERRUPTS();
uxCriticalNesting++; uxCriticalNesting++;
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
void vPortExitCritical( void ) void IRAM vPortExitCritical( void )
{ {
uxCriticalNesting--; uxCriticalNesting--;
if( uxCriticalNesting == 0 ) if( uxCriticalNesting == 0 )

View file

@ -84,7 +84,7 @@ endif
GITSHORTREV=\"$(shell cd $(ROOT); git rev-parse --short -q HEAD)\" GITSHORTREV=\"$(shell cd $(ROOT); git rev-parse --short -q HEAD)\"
CFLAGS += -DGITSHORTREV=$(GITSHORTREV) CFLAGS += -DGITSHORTREV=$(GITSHORTREV)
LINKER_SCRIPTS = ld/eagle.app.v6.ld ld/eagle.rom.addr.v6.ld LINKER_SCRIPTS = $(ROOT)ld/eagle.app.v6.ld $(ROOT)ld/eagle.rom.addr.v6.ld
#### ####
#### no user configurable options below here #### no user configurable options below here
@ -101,7 +101,7 @@ TARGET_DIR := $(dir $(firstword $(MAKEFILE_LIST)))
SDK_LIB_ARGS = $(addprefix -l,$(SDK_LIBS)) SDK_LIB_ARGS = $(addprefix -l,$(SDK_LIBS))
LIB_ARGS = $(addprefix -l,$(LIBS)) LIB_ARGS = $(addprefix -l,$(LIBS))
TARGET_OUT = $(BUILD_DIR)$(TARGET).out TARGET_OUT = $(BUILD_DIR)$(TARGET).out
LDFLAGS += $(addprefix -T$(ROOT),$(LINKER_SCRIPTS)) LDFLAGS += $(addprefix -T,$(LINKER_SCRIPTS))
FW_FILE_1 = $(addprefix $(FW_BASE),$(FW_1).bin) FW_FILE_1 = $(addprefix $(FW_BASE),$(FW_1).bin)
FW_FILE_2 = $(addprefix $(FW_BASE),$(FW_2).bin) FW_FILE_2 = $(addprefix $(FW_BASE),$(FW_2).bin)
@ -211,9 +211,9 @@ $(eval $(call component_compile_rules,target))
$(foreach component,$(COMPONENTS), $(eval include $(ROOT)/$(component)/component.mk)) $(foreach component,$(COMPONENTS), $(eval include $(ROOT)/$(component)/component.mk))
# final linking step to produce .elf # final linking step to produce .elf
$(TARGET_OUT): $(COMPONENT_ARS) $(SDK_PROCESSED_LIBS) $(TARGET_OUT): $(COMPONENT_ARS) $(SDK_PROCESSED_LIBS) $(LINKER_SCRIPTS)
$(vecho) "LD $@" $(vecho) "LD $@"
$(Q) $(LD) $(LD_SCRIPT) $(LDFLAGS) -Wl,--start-group $(SDK_LIB_ARGS) $(LIB_ARGS) $(COMPONENT_ARS) -Wl,--end-group -o $@ $(Q) $(LD) $(LDFLAGS) -Wl,--start-group $(SDK_LIB_ARGS) $(LIB_ARGS) $(COMPONENT_ARS) -Wl,--end-group -o $@
$(BUILD_DIR) $(FW_BASE) $(BUILD_DIR)sdklib: $(BUILD_DIR) $(FW_BASE) $(BUILD_DIR)sdklib:
$(Q) mkdir -p $@ $(Q) mkdir -p $@

View file

@ -30,4 +30,6 @@
#define INLINED inline static __attribute__((always_inline)) __attribute__((unused)) #define INLINED inline static __attribute__((always_inline)) __attribute__((unused))
#define IRAM __attribute__((section(".iram1.text")))
#endif #endif

View file

@ -192,7 +192,7 @@ SECTIONS
*(.entry.text) *(.entry.text)
*(.init.literal) *(.init.literal)
*(.init) *(.init)
*(.literal .text .literal.* .text.* .stub .gnu.warning .gnu.linkonce.literal.* .gnu.linkonce.t.*.literal .gnu.linkonce.t.*) *(.literal .text .literal.* .text.* .iram1.text iram1.literal .stub .gnu.warning .gnu.linkonce.literal.* .gnu.linkonce.t.*.literal .gnu.linkonce.t.*)
*(.fini.literal) *(.fini.literal)
*(.fini) *(.fini)
*(.gnu.version) *(.gnu.version)
@ -212,7 +212,7 @@ SECTIONS
.irom0.text : ALIGN(4) .irom0.text : ALIGN(4)
{ {
_irom0_text_start = ABSOLUTE(.); _irom0_text_start = ABSOLUTE(.);
*(.literal .text .literal.* .text.* .irom0.literal .irom.literal .irom.text.literal .irom0.text .irom.text) *(.irom0.literal .irom.literal .irom.text.literal .irom0.text .irom.text)
_irom0_text_end = ABSOLUTE(.); _irom0_text_end = ABSOLUTE(.);
} >irom0_0_seg :irom0_0_phdr } >irom0_0_seg :irom0_0_phdr
} }