feat(esp8266): Link some functions from IRAM to flash

This commit is contained in:
Dong Heng
2018-09-13 17:47:28 +08:00
parent 1a6460b19a
commit bc239c0ed3
6 changed files with 21 additions and 17 deletions

View File

@ -2873,7 +2873,7 @@ BaseType_t xSwitchRequired = pdFALSE;
#endif /* configUSE_APPLICATION_TASK_TAG */ #endif /* configUSE_APPLICATION_TASK_TAG */
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
void IRAM_ATTR vTaskSwitchContext( void ) void vTaskSwitchContext( void )
{ {
if( uxSchedulerSuspended != ( UBaseType_t ) pdFALSE ) if( uxSchedulerSuspended != ( UBaseType_t ) pdFALSE )
{ {

View File

@ -38,7 +38,7 @@ static portMUX_TYPE hooks_spinlock = portMUX_INITIALIZER_UNLOCKED;
static esp_freertos_idle_cb_t idle_cb[portNUM_PROCESSORS][MAX_HOOKS]; static esp_freertos_idle_cb_t idle_cb[portNUM_PROCESSORS][MAX_HOOKS];
static esp_freertos_tick_cb_t tick_cb[portNUM_PROCESSORS][MAX_HOOKS]; static esp_freertos_tick_cb_t tick_cb[portNUM_PROCESSORS][MAX_HOOKS];
void IRAM_ATTR esp_vApplicationTickHook() void esp_vApplicationTickHook()
{ {
int n; int n;
int core = xPortGetCoreID(); int core = xPortGetCoreID();

View File

@ -59,7 +59,8 @@ vPortYield:
call0 _xt_int_enter call0 _xt_int_enter
call0 vPortEnterCritical call0 vPortEnterCritical
call0 vTaskSwitchContext movi a0, vTaskSwitchContext
callx0 a0
call0 vPortExitCritical call0 vPortExitCritical
call0 _xt_int_exit call0 _xt_int_exit
@ -238,7 +239,8 @@ _xt_timer_int:
/* Call the uCOS-II tick handler. */ /* Call the uCOS-II tick handler. */
#ifdef __XTENSA_CALL0_ABI__ /* OSTimeTick() */ #ifdef __XTENSA_CALL0_ABI__ /* OSTimeTick() */
call0 xPortSysTickHandle movi a0, xPortSysTickHandle
callx0 a0
#else #else
call4 xTaskIncrementTick call4 xTaskIncrementTick
#endif #endif
@ -279,7 +281,8 @@ _xt_timer_int1:
#endif #endif
/* Call the uCOS-II tick handler. */ /* Call the uCOS-II tick handler. */
call0 vTaskSwitchContext movi a0, vTaskSwitchContext
callx0 a0
#ifdef __XTENSA_CALL0_ABI__ #ifdef __XTENSA_CALL0_ABI__
/* Restore a2 and a3. */ /* Restore a2 and a3. */

View File

@ -158,7 +158,7 @@ void IRAM_ATTR HDL_MAC_SIG_IN_LV1_ISR(void)
extern portBASE_TYPE MacIsrSigPostDefHdl(void); extern portBASE_TYPE MacIsrSigPostDefHdl(void);
void IRAM_ATTR SoftIsrHdl(void* arg) void SoftIsrHdl(void* arg)
{ {
ETS_NMI_LOCK(); ETS_NMI_LOCK();
@ -177,7 +177,7 @@ void IRAM_ATTR SoftIsrHdl(void* arg)
ETS_NMI_UNLOCK(); ETS_NMI_UNLOCK();
} }
void IRAM_ATTR xPortSysTickHandle(void) void xPortSysTickHandle(void)
{ {
if (xTaskIncrementTick() != pdFALSE) { if (xTaskIncrementTick() != pdFALSE) {
vTaskSwitchContext(); vTaskSwitchContext();
@ -275,7 +275,7 @@ void IRAM_ATTR vPortETSIntrUnlock(void)
ETS_INTR_UNLOCK(); ETS_INTR_UNLOCK();
} }
void IRAM_ATTR PortDisableInt_NoNest(void) void PortDisableInt_NoNest(void)
{ {
if (NMIIrqIsOn == 0) { if (NMIIrqIsOn == 0) {
if (ClosedLv1Isr != 1) { if (ClosedLv1Isr != 1) {
@ -285,7 +285,7 @@ void IRAM_ATTR PortDisableInt_NoNest(void)
} }
} }
void IRAM_ATTR PortEnableInt_NoNest(void) void PortEnableInt_NoNest(void)
{ {
if (NMIIrqIsOn == 0) { if (NMIIrqIsOn == 0) {
if (ClosedLv1Isr == 1) { if (ClosedLv1Isr == 1) {
@ -324,7 +324,7 @@ void _xt_isr_attach(uint8_t i, _xt_isr func, void* arg)
isr[i].arg = arg; isr[i].arg = arg;
} }
uint16_t IRAM_ATTR _xt_isr_handler(uint16_t i) uint16_t _xt_isr_handler(uint16_t i)
{ {
uint8_t index; uint8_t index;
@ -350,7 +350,7 @@ uint16_t IRAM_ATTR _xt_isr_handler(uint16_t i)
return i & ~(1 << index); return i & ~(1 << index);
} }
int IRAM_ATTR xPortInIsrContext(void) int xPortInIsrContext(void)
{ {
return _xt_isr_status != 0; return _xt_isr_status != 0;
} }

View File

@ -925,7 +925,8 @@ _xt_user_entry1:
s32i a1, a0, 0 s32i a1, a0, 0
mov a1, a0 mov a1, a0
call0 _xt_isr_handler movi a0, _xt_isr_handler
callx0 a0
movi a0, _chip_interrupt_tmp movi a0, _chip_interrupt_tmp
l32i a1, a0, 0 l32i a1, a0, 0

View File

@ -85,7 +85,7 @@ static SLIST_HEAD(esp_thread_list_head, esp_pthread_entry) s_threads_list
static pthread_key_t s_pthread_cfg_key; static pthread_key_t s_pthread_cfg_key;
static int IRAM_ATTR pthread_mutex_lock_internal(esp_pthread_mutex_t *mux, TickType_t tmo); static int pthread_mutex_lock_internal(esp_pthread_mutex_t *mux, TickType_t tmo);
static inline void uxPortCompareSet(volatile uint32_t *addr, uint32_t compare, uint32_t *set) static inline void uxPortCompareSet(volatile uint32_t *addr, uint32_t compare, uint32_t *set)
{ {
@ -503,7 +503,7 @@ int pthread_mutex_destroy(pthread_mutex_t *mutex)
return 0; return 0;
} }
static int IRAM_ATTR pthread_mutex_lock_internal(esp_pthread_mutex_t *mux, TickType_t tmo) static int pthread_mutex_lock_internal(esp_pthread_mutex_t *mux, TickType_t tmo)
{ {
if (mux->type == PTHREAD_MUTEX_RECURSIVE) { if (mux->type == PTHREAD_MUTEX_RECURSIVE) {
if (xSemaphoreTakeRecursive(mux->sem, tmo) != pdTRUE) { if (xSemaphoreTakeRecursive(mux->sem, tmo) != pdTRUE) {
@ -530,7 +530,7 @@ static int pthread_mutex_init_if_static(pthread_mutex_t *mutex) {
return res; return res;
} }
int IRAM_ATTR pthread_mutex_lock(pthread_mutex_t *mutex) int pthread_mutex_lock(pthread_mutex_t *mutex)
{ {
if (!mutex) { if (!mutex) {
return EINVAL; return EINVAL;
@ -542,7 +542,7 @@ int IRAM_ATTR pthread_mutex_lock(pthread_mutex_t *mutex)
return pthread_mutex_lock_internal((esp_pthread_mutex_t *)*mutex, portMAX_DELAY); return pthread_mutex_lock_internal((esp_pthread_mutex_t *)*mutex, portMAX_DELAY);
} }
int IRAM_ATTR pthread_mutex_trylock(pthread_mutex_t *mutex) int pthread_mutex_trylock(pthread_mutex_t *mutex)
{ {
if (!mutex) { if (!mutex) {
return EINVAL; return EINVAL;
@ -554,7 +554,7 @@ int IRAM_ATTR pthread_mutex_trylock(pthread_mutex_t *mutex)
return pthread_mutex_lock_internal((esp_pthread_mutex_t *)*mutex, 0); return pthread_mutex_lock_internal((esp_pthread_mutex_t *)*mutex, 0);
} }
int IRAM_ATTR pthread_mutex_unlock(pthread_mutex_t *mutex) int pthread_mutex_unlock(pthread_mutex_t *mutex)
{ {
esp_pthread_mutex_t *mux; esp_pthread_mutex_t *mux;