stanislaus123 wrote on Friday, January 05, 2018:
I am using ZYNQ on a MicroZed
My application is defined as a C++ application !
Below is the absolute minimum program
void vApplicationIdleHook( void );
void MyTask(void* param)
{
for(;;){
print(“blah blah\n”);
vTaskDelay(100);
}
}
void vApplicationIdleHook( void )
{
int i=0;
for(;;){
i++; //In my application will never be called
}
int main()
{
xTaskCreate( MyTask, “MyTask”, 1024, NULL, 2, NULL);
vTaskStartScheduler();
for(;
return 0;
}
FreeRTOS provides an idle task function called
void vApplicationIdleHook( void ) attribute((weak)); //in portZynq7000.c
To enable the idle function you must
define configUSE_IDLE_HOOK 1 //in FreeRTOSConfig.h
Since the idle hook function is declared as “weak”, I should be able to override
it inside my own application simply by declaring and defining it again like usual
This works just fine in C and the linker will give me NO error, but it does not work when the main application was created as a C++ application like main.cc The overridden function will not be called, but instead the weak function in portZynq7000.c will be called.
Does anybody know a simple trick to make this work in a simple manner?
Thanks
Kurt