mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Merge branch 'bugfix/spurious_uninitialized_mux_notice' into 'master'
Add static initializers for muxes, add mutex init to vPortCPUAcquireMutex We still have some ERROR: vPortCPUAcquireMutex: mux 0x3ffc01cc is uninitialized (0x0)! errors. I'd like to fix those by giving muxes as used in critical regions an initializer, so they can get initialized at program load. This is FreeRTOS core code, I'd like someone to review it before I commit it. See merge request !10
This commit is contained in:
commit
ab21d1d9f2
@ -123,7 +123,7 @@ typedef struct xEventGroupDefinition
|
||||
|
||||
|
||||
/* Again: one mux for all events. Maybe this can be made more granular. ToDo: look into that. -JD */
|
||||
static portMUX_TYPE xEventGroupMux;
|
||||
static portMUX_TYPE xEventGroupMux = portMUX_INITIALIZER_UNLOCKED;
|
||||
static BaseType_t xMuxInitialized = pdFALSE;
|
||||
|
||||
|
||||
|
@ -155,7 +155,7 @@ typedef struct A_BLOCK_LINK
|
||||
} BlockLink_t;
|
||||
|
||||
//Mux to protect the memory status data
|
||||
static portMUX_TYPE xMallocMutex;
|
||||
static portMUX_TYPE xMallocMutex = portMUX_INITIALIZER_UNLOCKED;
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
|
@ -147,6 +147,19 @@ typedef struct {
|
||||
#define portMUX_VAL_MASK 0x000000FF
|
||||
#define portMUX_VAL_SHIFT 0
|
||||
|
||||
//Keep this in sync with the portMUX_TYPE struct definition please.
|
||||
#ifdef portMUX_DEBUG
|
||||
#define portMUX_INITIALIZER_UNLOCKED { \
|
||||
.mux = portMUX_MAGIC_VAL|portMUX_FREE_VAL \
|
||||
}
|
||||
#else
|
||||
#define portMUX_INITIALIZER_UNLOCKED { \
|
||||
.mux = portMUX_MAGIC_VAL|portMUX_FREE_VAL, \
|
||||
.lastLockedFn = "(never locked)", \
|
||||
.lastLockedLine = -1 \
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Critical section management. NW-TODO: replace XTOS_SET_INTLEVEL with more efficient version, if any? */
|
||||
// These cannot be nested. They should be used with a lot of care and cannot be called from interrupt level.
|
||||
#define portDISABLE_INTERRUPTS() do { XTOS_SET_INTLEVEL(XCHAL_EXCM_LEVEL); portbenchmarkINTERRUPT_DISABLE(); } while (0)
|
||||
|
@ -297,7 +297,7 @@ void vPortCPUAcquireMutex(portMUX_TYPE *mux) {
|
||||
#ifdef portMUX_DEBUG
|
||||
uint32_t cnt=(1<<16);
|
||||
if ( (mux->mux & portMUX_MAGIC_MASK) != portMUX_MAGIC_VAL ) {
|
||||
ets_printf("ERROR: vPortCPUAcquireMutex: mux %p is uninitialized (0x%X)!\n", mux, mux->mux);
|
||||
ets_printf("ERROR: vPortCPUAcquireMutex: mux %p is uninitialized (0x%X)! Called from %s line %d.\n", mux, mux->mux, fnName, line);
|
||||
mux->mux=portMUX_FREE_VAL;
|
||||
}
|
||||
#endif
|
||||
|
@ -460,6 +460,8 @@ int8_t *pcAllocatedBuffer;
|
||||
vListInitialise( &( pxNewQueue->xTasksWaitingToSend ) );
|
||||
vListInitialise( &( pxNewQueue->xTasksWaitingToReceive ) );
|
||||
|
||||
vPortCPUInitializeMutex(&pxNewQueue->mux);
|
||||
|
||||
traceCREATE_MUTEX( pxNewQueue );
|
||||
|
||||
/* Start with the semaphore in the expected state. */
|
||||
|
@ -273,8 +273,8 @@ PRIVILEGED_DATA static volatile UBaseType_t uxSchedulerSuspended[ portNUM_PROCES
|
||||
PRIVILEGED_DATA static portBASE_TYPE xMutexesInitialised = pdFALSE;
|
||||
/* For now, we use just one mux for all the critical sections. ToDo: give evrything a bit more granularity;
|
||||
that could improve performance by not needlessly spinning in spinlocks for unrelated resources. */
|
||||
PRIVILEGED_DATA static portMUX_TYPE xTaskQueueMutex;
|
||||
PRIVILEGED_DATA static portMUX_TYPE xTickCountMutex;
|
||||
PRIVILEGED_DATA static portMUX_TYPE xTaskQueueMutex = portMUX_INITIALIZER_UNLOCKED;
|
||||
PRIVILEGED_DATA static portMUX_TYPE xTickCountMutex = portMUX_INITIALIZER_UNLOCKED;
|
||||
|
||||
#if ( configGENERATE_RUN_TIME_STATS == 1 )
|
||||
|
||||
|
@ -170,7 +170,7 @@ PRIVILEGED_DATA static List_t *pxOverflowTimerList;
|
||||
PRIVILEGED_DATA static QueueHandle_t xTimerQueue = NULL;
|
||||
|
||||
/* Mux. We use a single mux for all the timers for now. ToDo: maybe increase granularity here? */
|
||||
PRIVILEGED_DATA portMUX_TYPE xTimerMux;
|
||||
PRIVILEGED_DATA portMUX_TYPE xTimerMux = portMUX_INITIALIZER_UNLOCKED;
|
||||
|
||||
#if ( INCLUDE_xTimerGetTimerDaemonTaskHandle == 1 )
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user