mirror of
https://github.com/espressif/ESP8266_RTOS_SDK.git
synced 2025-06-17 03:38:49 +08:00
feat(freertos): Add configuration to speed up task switch
The global heap is 74332 bytes when connect to AP and get IP by DHCP.
This commit is contained in:
@ -45,5 +45,14 @@ config FREERTOS_TIMER_STACKSIZE
|
||||
default 2048
|
||||
help
|
||||
The size of the stack used by the timer in FreeRTOS.
|
||||
|
||||
|
||||
config TASK_SWITCH_FASTER
|
||||
bool "Task switch faster"
|
||||
default y
|
||||
help
|
||||
Enable this option, linking task switch function and its father functions to IRAM
|
||||
to speed up task switch. It is specific for faster I/O application and so on.
|
||||
|
||||
But it may cost more 1KB IRAM, so user global heap may decrease 1KB.
|
||||
|
||||
endmenu
|
||||
|
@ -71,7 +71,7 @@ void vListInitialiseItem( ListItem_t * const pxItem )
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vListInsertEnd( List_t * const pxList, ListItem_t * const pxNewListItem )
|
||||
void TASK_SW_ATTR vListInsertEnd( List_t * const pxList, ListItem_t * const pxNewListItem )
|
||||
{
|
||||
ListItem_t * const pxIndex = pxList->pxIndex;
|
||||
|
||||
@ -167,7 +167,7 @@ const TickType_t xValueOfInsertion = pxNewListItem->xItemValue;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
UBaseType_t uxListRemove( ListItem_t * const pxItemToRemove )
|
||||
UBaseType_t TASK_SW_ATTR uxListRemove( ListItem_t * const pxItemToRemove )
|
||||
{
|
||||
/* The list item knows which list it is in. Obtain the list from the list
|
||||
item. */
|
||||
|
@ -2611,7 +2611,7 @@ implementations require configUSE_TICKLESS_IDLE to be set to a value other than
|
||||
#endif /* INCLUDE_xTaskAbortDelay */
|
||||
/*----------------------------------------------------------*/
|
||||
|
||||
BaseType_t xTaskIncrementTick( void )
|
||||
BaseType_t TASK_SW_ATTR xTaskIncrementTick( void )
|
||||
{
|
||||
TCB_t * pxTCB;
|
||||
TickType_t xItemValue;
|
||||
@ -2873,7 +2873,7 @@ BaseType_t xSwitchRequired = pdFALSE;
|
||||
#endif /* configUSE_APPLICATION_TASK_TAG */
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vTaskSwitchContext( void )
|
||||
void TASK_SW_ATTR vTaskSwitchContext( void )
|
||||
{
|
||||
if( uxSchedulerSuspended != ( UBaseType_t ) pdFALSE )
|
||||
{
|
||||
|
@ -127,5 +127,11 @@ NVIC value of 255. */
|
||||
/* add this to dump task stack information */
|
||||
#define configRECORD_STACK_HIGH_ADDRESS 1
|
||||
|
||||
#ifdef CONFIG_TASK_SWITCH_FASTER
|
||||
#define TASK_SW_ATTR IRAM_ATTR
|
||||
#else
|
||||
#define TASK_SW_ATTR
|
||||
#endif
|
||||
|
||||
#endif /* FREERTOS_CONFIG_H */
|
||||
|
||||
|
@ -59,8 +59,12 @@ vPortYield:
|
||||
|
||||
call0 _xt_int_enter
|
||||
call0 vPortEnterCritical
|
||||
#ifndef CONFIG_TASK_SWITCH_FASTER
|
||||
movi a0, vTaskSwitchContext
|
||||
callx0 a0
|
||||
callx0 a0
|
||||
#else
|
||||
call0 vTaskSwitchContext
|
||||
#endif
|
||||
call0 vPortExitCritical
|
||||
call0 _xt_int_exit
|
||||
|
||||
@ -239,8 +243,12 @@ _xt_timer_int:
|
||||
|
||||
/* Call the uCOS-II tick handler. */
|
||||
#ifdef __XTENSA_CALL0_ABI__ /* OSTimeTick() */
|
||||
#ifndef CONFIG_TASK_SWITCH_FASTER
|
||||
movi a0, xPortSysTickHandle
|
||||
callx0 a0
|
||||
#else
|
||||
call0 xPortSysTickHandle
|
||||
#endif
|
||||
#else
|
||||
call4 xTaskIncrementTick
|
||||
#endif
|
||||
@ -281,8 +289,12 @@ _xt_timer_int1:
|
||||
#endif
|
||||
|
||||
/* Call the uCOS-II tick handler. */
|
||||
#ifndef CONFIG_TASK_SWITCH_FASTER
|
||||
movi a0, vTaskSwitchContext
|
||||
callx0 a0
|
||||
#else
|
||||
call0 vTaskSwitchContext
|
||||
#endif
|
||||
|
||||
#ifdef __XTENSA_CALL0_ABI__
|
||||
/* Restore a2 and a3. */
|
||||
|
@ -118,7 +118,7 @@ void IRAM_ATTR HDL_MAC_SIG_IN_LV1_ISR(void)
|
||||
|
||||
extern portBASE_TYPE MacIsrSigPostDefHdl(void);
|
||||
|
||||
void SoftIsrHdl(void* arg)
|
||||
void TASK_SW_ATTR SoftIsrHdl(void* arg)
|
||||
{
|
||||
ETS_NMI_LOCK();
|
||||
|
||||
@ -137,7 +137,7 @@ void SoftIsrHdl(void* arg)
|
||||
ETS_NMI_UNLOCK();
|
||||
}
|
||||
|
||||
void xPortSysTickHandle(void)
|
||||
void TASK_SW_ATTR xPortSysTickHandle(void)
|
||||
{
|
||||
if (xTaskIncrementTick() != pdFALSE) {
|
||||
vTaskSwitchContext();
|
||||
@ -284,7 +284,7 @@ void _xt_isr_attach(uint8_t i, _xt_isr func, void* arg)
|
||||
isr[i].arg = arg;
|
||||
}
|
||||
|
||||
uint16_t _xt_isr_handler(uint16_t i)
|
||||
uint16_t TASK_SW_ATTR _xt_isr_handler(uint16_t i)
|
||||
{
|
||||
uint8_t index;
|
||||
|
||||
|
@ -927,8 +927,12 @@ _xt_user_entry1:
|
||||
s32i a1, a0, 0
|
||||
mov a1, a0
|
||||
|
||||
#ifndef CONFIG_TASK_SWITCH_FASTER
|
||||
movi a0, _xt_isr_handler
|
||||
callx0 a0
|
||||
#else
|
||||
call0 _xt_isr_handler
|
||||
#endif
|
||||
|
||||
movi a0, _chip_interrupt_tmp
|
||||
l32i a1, a0, 0
|
||||
|
Reference in New Issue
Block a user