Hi,
I am using FreeRtos v10.5.1 from “git clone --depth 1 --branch v10.5.1 GitHub - ARM-software/CMSIS-FreeRTOS: FreeRTOS adaptation for CMSIS-RTOS Version 2”, but i tried with other versions and same problem.
The FreerRtos is still not running correctly.
Simple test program:
I created two tasks to toggle a led.
Task1 should toggle led1 each 500 ms.
Task2 should toggle led2 each 500 ms.
When the priority of the two tasks is set to 1, a exception occur, calling the function “void attribute((noreturn)) _simple_tlb_refill_exception_handler(void)”, _excep_code = 0x00000002, _excep_addr = 0x00000000 ( null pointer probably ).
_excep_code = 0x02 doesn’t even exist.
When the priority of the two tasks is set to 2 and 3 respectively, a exception not occur, the led1 and led2 lights up and stays lit, meaning that the tasks are being executed only once.
I put a third led to see if the tick is working, and in this case is ok, the led toggle every 500ms ( configTICK_RATE_HZ = 1000 ).
Code:
void vApplicationTickHook( void )
{
static TickType_t c = 0;
c++;
if( c == configTICK_RATE_HZ/2 )
{
c = 0;
my_led_toggle_3();
}
}
void _APP_Tasks( void *pvParameters )
{
(void) pvParameters;
while(1)
{
my_led_toggle_1();
vTaskDelay( pdMS_TO_TICKS(500) );
}
}
void teste( void *pvParameters )
{
(void) pvParameters;
while(1)
{
my_led_toggle_2();
vTaskDelay( pdMS_TO_TICKS(500) );
}
}
BaseType_t SYS_Tasks( void )
{
BaseType_t ret = 0;
ret = xTaskCreate( _APP_Tasks,
"APP_Tasks",
4096, // 4096 * 4 = 16384 bytes.
NULL,
3,
(TaskHandle_t*)NULL
);
if( ret != pdPASS )
return -6;
ret = xTaskCreate( teste,
"teste",
1024, // 1024 * 4 = 4096 bytes.
NULL,
2,
(TaskHandle_t*)NULL
);
if( ret != pdPASS )
return -7;
vTaskStartScheduler();
return ret; // Must never get here..
}
The strange thing is that FreeRtos worked before, i don’t know if the microchip MCC( Mplab Code Configurator ) tool did some wrong code generation or not now.
I had already opened a support ticket on the microchip website with a very similar problem and microchip could not find the problem.
So i needed to get a backup of mine that was running, and i made the necessary changes and it worked, at the time i abandoned the support ticket .
In annex is that “old” bug project that the microchip support didn’t find the problem, i still haven’t had time to clean up this current project to post it here, if you need it, i can do that.
I’m not able to find the problem, maybe something related with interrupt, but what ?
NOTES:
The functions are all enabled and none is called, with the exception of vApplicationTickHook.
The function “void vApplicationIdleHook( void )” are not enabled.
“void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName )”
“void vApplicationMallocFailedHook( void )”, “void vApplicationTickHook( void )”
“void vApplicationTickHook( void )”
“void vAssertCalled( const char * pcFile, unsigned long ulLine )”
I am using the dev board DM320007-C.
FrreRtos-Bugado-Again.7z (407.2 KB)