mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-11 13:00:19 +00:00
freertos: Fix various build errors
This commit fixes various build errors in IDF (and tests) when compiling with SMP FreeRTOS: - Updated usage of xTaskGetIdleTaskHandle() - Disable sysview tracing macros - Update some task snapshot functions - Disabled test_freertos_hooks.c test as vApplicationIdleHook() and vApplicationTickHook() are used.
This commit is contained in:
@@ -211,6 +211,56 @@ Notes:
|
||||
#define apiID_VEVENTGROUPDELETE (72u)
|
||||
#define apiID_UXEVENTGROUPGETNUMBER (73u)
|
||||
|
||||
#ifdef CONFIG_FREERTOS_SMP
|
||||
/*
|
||||
FreeRTOS SMP has diverged from ESP-IDF FreeRTOS source quite a bit, thus Sysview is out of sync. For now, we just
|
||||
define away all of the tracing macros.
|
||||
*/
|
||||
#define traceTASK_NOTIFY_TAKE( uxIndexToWait )
|
||||
#define traceTASK_DELAY()
|
||||
#define traceTASK_DELAY_UNTIL( xTimeToWake )
|
||||
#define traceTASK_DELETE( pxTCB )
|
||||
#define traceTASK_NOTIFY_GIVE_FROM_ISR( uxIndexToNotify )
|
||||
#define traceTASK_PRIORITY_INHERIT( pxTCB, uxPriority )
|
||||
#define traceTASK_RESUME( pxTCB )
|
||||
#define traceINCREASE_TICK_COUNT( xTicksToJump )
|
||||
#define traceTASK_SUSPEND( pxTCB )
|
||||
#define traceTASK_PRIORITY_DISINHERIT( pxTCB, uxBasePriority )
|
||||
#define traceTASK_RESUME_FROM_ISR( pxTCB )
|
||||
#define traceTASK_NOTIFY( uxIndexToNotify )
|
||||
#define traceTASK_NOTIFY_FROM_ISR( uxIndexToNotify )
|
||||
#define traceTASK_NOTIFY_WAIT( uxIndexToWait )
|
||||
#define traceQUEUE_CREATE( pxNewQueue )
|
||||
#define traceQUEUE_DELETE( pxQueue )
|
||||
#define traceQUEUE_PEEK( pxQueue )
|
||||
#define traceQUEUE_PEEK_FROM_ISR( pxQueue )
|
||||
#define traceQUEUE_PEEK_FROM_ISR_FAILED( pxQueue )
|
||||
#define traceQUEUE_RECEIVE( pxQueue )
|
||||
#define traceQUEUE_RECEIVE_FAILED( pxQueue )
|
||||
#define traceQUEUE_SEMAPHORE_RECEIVE( pxQueue )
|
||||
#define traceQUEUE_RECEIVE_FROM_ISR( pxQueue )
|
||||
#define traceQUEUE_RECEIVE_FROM_ISR_FAILED( pxQueue )
|
||||
#define traceQUEUE_REGISTRY_ADD( xQueue, pcQueueName )
|
||||
#define traceQUEUE_SEND( pxQueue )
|
||||
#define traceQUEUE_SEND_FAILED( pxQueue )
|
||||
#define traceQUEUE_SEND_FROM_ISR( pxQueue )
|
||||
#define traceQUEUE_SEND_FROM_ISR_FAILED( pxQueue )
|
||||
#define traceQUEUE_GIVE_FROM_ISR( pxQueue )
|
||||
#define traceQUEUE_GIVE_FROM_ISR_FAILED( pxQueue )
|
||||
#define traceTASK_CREATE(pxNewTCB)
|
||||
#define traceTASK_PRIORITY_SET(pxTask, uxNewPriority)
|
||||
#define traceTASK_SWITCHED_IN()
|
||||
#define traceMOVED_TASK_TO_READY_STATE(pxTCB)
|
||||
#define traceREADDED_TASK_TO_READY_STATE(pxTCB)
|
||||
#define traceMOVED_TASK_TO_DELAYED_LIST()
|
||||
#define traceMOVED_TASK_TO_OVERFLOW_DELAYED_LIST()
|
||||
#define traceMOVED_TASK_TO_SUSPENDED_LIST(pxTCB)
|
||||
#define traceISR_EXIT_TO_SCHEDULER()
|
||||
#define traceISR_EXIT()
|
||||
#define traceISR_ENTER(_n_)
|
||||
|
||||
#else // CONFIG_FREERTOS_SMP
|
||||
|
||||
#define traceTASK_NOTIFY_TAKE( uxIndexToWait ) SEGGER_SYSVIEW_RecordU32x2(apiFastID_OFFSET + apiID_ULTASKNOTIFYTAKE, xClearCountOnExit, xTicksToWait)
|
||||
#define traceTASK_DELAY() SEGGER_SYSVIEW_RecordU32(apiFastID_OFFSET + apiID_VTASKDELAY, xTicksToDelay)
|
||||
#define traceTASK_DELAY_UNTIL() SEGGER_SYSVIEW_RecordVoid(apiFastID_OFFSET + apiID_VTASKDELAYUNTIL)
|
||||
@@ -315,6 +365,7 @@ Notes:
|
||||
#define traceISR_EXIT() SEGGER_SYSVIEW_RecordExitISR()
|
||||
#define traceISR_ENTER(_n_) SEGGER_SYSVIEW_RecordEnterISR(_n_)
|
||||
|
||||
#endif // CONFIG_FREERTOS_SMP
|
||||
|
||||
/*********************************************************************
|
||||
*
|
||||
|
@@ -50,7 +50,11 @@
|
||||
|
||||
List_t* pxListGetReadyPendingTask ( UBaseType_t idx )
|
||||
{
|
||||
#ifdef CONFIG_FREERTOS_SMP
|
||||
return &( xPendingReadyList );
|
||||
#else
|
||||
return &( xPendingReadyList[idx] );
|
||||
#endif
|
||||
}
|
||||
|
||||
List_t* pxGetDelayedTaskList ( void ) {
|
||||
|
@@ -1,3 +1,9 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
#include "sdkconfig.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "freertos/FreeRTOS.h"
|
||||
@@ -17,7 +23,12 @@ void test_task_get_state(void* arg)
|
||||
//Current task should return eRunning
|
||||
TEST_ASSERT(eTaskGetState(xTaskGetCurrentTaskHandle()) == eRunning);
|
||||
//Idle task of current core should return eReady
|
||||
#ifdef CONFIG_FREERTOS_SMP
|
||||
TaskHandle_t *idle_handle_list = xTaskGetIdleTaskHandle();
|
||||
TEST_ASSERT_EQUAL(eReady, eTaskGetState(idle_handle_list[xPortGetCoreID()]));
|
||||
#else
|
||||
TEST_ASSERT(eTaskGetState(xTaskGetIdleTaskHandle()) == eReady);
|
||||
#endif
|
||||
//Blocked Task should return eBlocked
|
||||
TEST_ASSERT(eTaskGetState(blocked_task_handle) == eBlocked);
|
||||
//Suspended Task should return eSuspended
|
||||
|
@@ -4,6 +4,13 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include "sdkconfig.h"
|
||||
|
||||
#ifndef CONFIG_FREERTOS_SMP
|
||||
/*
|
||||
Note: We disable this test when using the FreeRTOS SMP kernel as the port will already provide
|
||||
a definition for vApplicationTickHook(). Thus this test cannot be run.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "freertos/FreeRTOS.h"
|
||||
@@ -84,3 +91,4 @@ TEST_CASE("static task cleanup hook is called based on config", "[freertos]")
|
||||
}
|
||||
|
||||
#endif // CONFIG_FREERTOS_ENABLE_STATIC_TASK_CLEAN_UP
|
||||
#endif // CONFIG_FREERTOS_SMP
|
||||
|
Reference in New Issue
Block a user