dthif1980 wrote on Thursday, March 12, 2009:
Hi,
I’m quite new to the FreeRTOS world and I’m trying to build a application using it.
Platform: AVR32 (using AVR32 Studio)
Framework: AT32UC3A-1.4.0
Language: GNUC++
At the moment, I’m just trying to make the tasks work. I double checked eveything with the Atmel EVK1100 ControlPanel application that uses FreeRTOS and everything seems fine, but I always end up having the same problem…
My application is quite simple. Here is a code sample:
Note that:
configCPU_CLOCK_HZ == CP_CPU_SPEED == 48000000
and
configPBA_CLOCK_HZ == CP_PBA_SPEED == 12000000
--------------------------------- Main.cpp File ----------------------------------------
//=======================================================================================
// Main
// Main function. Starts the different tasks and wait forever.
//=======================================================================================
int main(void)
{
int bRet = FALSE;
CBDR29010 obj;
/* Primary Initialization.
-------------------------- */
// Switch the main clock to OSC0.
pm_switch_to_osc0(&AVR32_PM, FOSC0, OSC0_STARTUP);
// Initialize the delay driver.
delay_init(CP_CPU_SPEED);
// Init Clocks.
LocalStartPLL66MHZ();
// Start the tasks.
obj.Activate();
// Start the OS. It should never return from there.
vTaskStartScheduler();
return 0;
}
--------------------------------- BDR29010.cpp File ----------------------------------------
// Constants
//////////////////////////////////////////////////////////////////////////////
#define TASK_COMM_MANAGER_PRIORITY (tskIDLE_PRIORITY + 1)
#define TASK_COMM_MANAGER_STACK_SIZE 1024
#define TASK_COMM_MANAGER_DELAY 10
// Prototypes
//////////////////////////////////////////////////////////////////////////////
portTASK_FUNCTION_PROTO(CommManagerTask, pParams);
//=======================================================================================
// CBDR29010::Activate
//=======================================================================================
bool CBDR29010::Activate()
{
bool bRet = false;
int taskCreateRet = pdFAIL;
xTaskHandle createdTaskHdl = NULL;
taskCreateRet = xTaskCreate(CommManagerTask, (const signed portCHAR*) "COMM_MGR",
TASK_COMM_MANAGER_STACK_SIZE, (void*)this,
TASK_COMM_MANAGER_PRIORITY, &createdTaskHdl);
if(taskCreateRet == pdPASS)
{
bRet = true;
}
else
{
bRet = false;
}
return bRet;
}
//=======================================================================================
// TASK: ManagerCommTask
//=======================================================================================
portTASK_FUNCTION_PROTO(CommManagerTask, pParams)
{
do
{
vTaskDelay(TASK_COMM_MANAGER_DELAY);
int allo = 1;
} while (1);
}
I trace the execution of the task. It enters correctly, calls the vTaskDelay(…) function but never returns from there. If I pause the execution, I get this
"No source available for "_handle_Supervisor_Call() " "
Checking the stack, it looks like it hangs just after the "portEXIT_CRITICAL();" call of the xTaskResumeAll() function in task.c.
Here is a copy of my FreeRTOSConfig.h file:
#define configUSE_MUTEXES 1
#define configUSE_PREEMPTION 1
#define configUSE_IDLE_HOOK 0
#define configUSE_TICK_HOOK 0
#define configCPU_CLOCK_HZ ( CP_CPU_SPEED ) /* Hz clk gen */
#define configPBA_CLOCK_HZ ( CP_PBA_SPEED )
#define configTICK_RATE_HZ ( ( portTickType ) 1000 )
#define configMAX_PRIORITIES ( ( unsigned portBASE_TYPE ) 8 )
#define configMINIMAL_STACK_SIZE ( ( unsigned portSHORT ) 256 )
/* configTOTAL_HEAP_SIZE is not used when heap_3.c is used. */
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 1024*25 ) )
#define configMAX_TASK_NAME_LEN ( 20 )
#define configUSE_TRACE_FACILITY 0
#define configUSE_16_BIT_TICKS 0
#define configIDLE_SHOULD_YIELD 1
#define configUSE_CO_ROUTINES 0
#define configMAX_CO_ROUTINE_PRIORITIES ( 0 )
#define INCLUDE_vTaskPrioritySet 1
#define INCLUDE_uxTaskPriorityGet 1
#define INCLUDE_vTaskDelete 1
#define INCLUDE_vTaskCleanUpResources 0
#define INCLUDE_vTaskSuspend 1
#define INCLUDE_vTaskDelayUntil 1
#define INCLUDE_vTaskDelay 1
#define INCLUDE_xTaskGetCurrentTaskHandle 1
#define INCLUDE_xTaskGetSchedulerState 0
#define configTICK_USE_TC 0
#define configTICK_TC_CHANNEL 2
#define configHEAP_INIT 1
I have no idea if those settings are ok, but I presume they are since I based myself on a working application of the Atmel framework. But I suspect that I am missing some configuration to make this work…
Please, if you have any insight or suggestions, let me know.
Best regards,
Downy