freertos-smp: Fix build test errors for esp32c3

This commit fixes build test failures for esp32c3.
This commit is contained in:
Sudeep Mohanty
2022-06-17 09:18:46 +02:00
parent 7726f343e8
commit 55f1eca248
3 changed files with 26 additions and 22 deletions

View File

@@ -259,15 +259,6 @@ Default values for trace macros added by ESP-IDF and are not part of Vanilla Fre
#define configTASKLIST_INCLUDE_COREID 1
#endif
#ifndef __ASSEMBLER__
#if CONFIG_APPTRACE_SV_ENABLE
extern uint32_t port_switch_flag[];
#define os_task_switch_is_pended(_cpu_) (port_switch_flag[_cpu_])
#else
#define os_task_switch_is_pended(_cpu_) (false)
#endif
#endif
// ---------------------- Features -------------------------
/* These currently aren't required, but could be useful additions in the future */

View File

@@ -238,6 +238,9 @@ static inline BaseType_t xPortInIsrContext(void)
return xPortCheckIfInISR();
}
// Added for backward compatibility with IDF
#define xPortInterruptedFromISRContext() xPortInIsrContext()
// ---------------------- Spinlocks ------------------------
/**
@@ -279,21 +282,25 @@ static inline void uxPortCompareSetExtram(volatile uint32_t *addr, uint32_t comp
/*
IDF style critical sections which are orthogonal to FreeRTOS critical sections. However, on single core, the IDF style
critical sections simply disable interrupts, thus we discard the lock and timeout arguments.
Note: The IDF Style critical sections are named differently to their counterparts present in the xtensa port as few IDF
examples such as esp_zigbee_gateway, when compiled for RISC-V targets, have a reference to vPortEnterCritical()
and vPortExitCritical() from precompiled libraries (.a) thereby failing linking.
*/
void vPortEnterCriticalIDF(void);
void vPortExitCriticalIDF(void);
void vPortEnterCritical(void);
void vPortExitCritical(void);
//IDF task critical sections
#define portTRY_ENTER_CRITICAL(lock, timeout) {((void) lock; (void) timeout; vPortEnterCriticalIDF(); pdPASS;)}
#define portENTER_CRITICAL_IDF(lock) ({(void) lock; vPortEnterCriticalIDF();})
#define portEXIT_CRITICAL_IDF(lock) ({(void) lock; vPortExitCriticalIDF();})
#define portTRY_ENTER_CRITICAL(lock, timeout) {((void) lock; (void) timeout; vPortEnterCritical(); pdPASS;)}
#define portENTER_CRITICAL_IDF(lock) ({(void) lock; vPortEnterCritical();})
#define portEXIT_CRITICAL_IDF(lock) ({(void) lock; vPortExitCritical();})
//IDF ISR critical sections
#define portTRY_ENTER_CRITICAL_ISR(lock, timeout) {((void) lock; (void) timeout; vPortEnterCriticalIDF(); pdPASS;)}
#define portENTER_CRITICAL_ISR(lock) ({(void) lock; vPortEnterCriticalIDF();})
#define portEXIT_CRITICAL_ISR(lock) ({(void) lock; vPortExitCriticalIDF();})
#define portTRY_ENTER_CRITICAL_ISR(lock, timeout) {((void) lock; (void) timeout; vPortEnterCritical(); pdPASS;)}
#define portENTER_CRITICAL_ISR(lock) ({(void) lock; vPortEnterCritical();})
#define portEXIT_CRITICAL_ISR(lock) ({(void) lock; vPortExitCritical();})
//IDF safe critical sections (they're the same)
#define portENTER_CRITICAL_SAFE(lock) ({(void) lock; vPortEnterCriticalIDF();})
#define portEXIT_CRITICAL_SAFE(lock) ({(void) lock; vPortExitCriticalIDF();})
#define portENTER_CRITICAL_SAFE(lock) ({(void) lock; vPortEnterCritical();})
#define portEXIT_CRITICAL_SAFE(lock) ({(void) lock; vPortExitCritical();})
// ---------------------- Yielding -------------------------
@@ -307,6 +314,9 @@ static inline bool IRAM_ATTR xPortCanYield(void)
return (threshold <= 1);
}
// Added for backward compatibility with IDF
#define portYIELD_WITHIN_API() vTaskYieldWithinAPI()
// ----------------------- System --------------------------
void vPortSetStackWatchpoint(void *pxStackStart);
@@ -329,7 +339,7 @@ void vPortSetStackWatchpoint(void *pxStackStart);
// --------------------- App-Trace -------------------------
#if CONFIG_APPTRACE_SV_ENABLE
extern int xPortSwitchFlag;
extern volatile BaseType_t xPortSwitchFlag;
#define os_task_switch_is_pended(_cpu_) (xPortSwitchFlag)
#else
#define os_task_switch_is_pended(_cpu_) (false)

View File

@@ -38,6 +38,9 @@
#include "esp_private/pm_trace.h"
#endif //CONFIG_PM_TRACE
#ifdef CONFIG_ESP_SYSTEM_GDBSTUB_RUNTIME
#include "esp_gdbstub.h"
#endif // CONFIG_ESP_SYSTEM_GDBSTUB_RUNTIME
/* ---------------------------------------------------- Variables ------------------------------------------------------
*
@@ -63,7 +66,7 @@ static UBaseType_t port_uxCriticalOldInterruptStateIDF = 0;
// ------------------ Critical Sections --------------------
void vPortEnterCriticalIDF(void)
void vPortEnterCritical(void)
{
// Save current interrupt threshold and disable interrupts
UBaseType_t old_thresh = ulPortSetInterruptMask();
@@ -75,7 +78,7 @@ void vPortEnterCriticalIDF(void)
}
}
void vPortExitCriticalIDF(void)
void vPortExitCritical(void)
{
if (port_uxCriticalNestingIDF > 0) {
port_uxCriticalNestingIDF--;