speedup freertos

mastupristi wrote on Wednesday, March 01, 2017:

I have an STM32F410 cortex M4 clocked @100MHz. I notify an high priority task from another, with lower priority, using xTaskNotifyGive()/ulTaskNotifyTake().
The firmware is compiled with arm-gcc:

~$ arm-none-eabi-gcc --version
arm-none-eabi-gcc (GNU Tools for ARM Embedded Processors) 5.4.1 20160609 (release) [ARM/embedded-5-branch revision 237715]

and I already use -O3 optimization.
Moving a pin I can measure time between notification and task wakeup. It is about 4us.
Is it possible to speed up notification (I think also context switch)?

best regards

heinbali01 wrote on Wednesday, March 01, 2017:

Hi Max

There are many factors influencing this delay between vTaskNotifyGiveFromISR() and ulTaskNotifyTake().
Compiler optimisation, for GCC, use -Os or -O3. I tend to like -Os ( optimise for size )
Once you’re ready debugging, stop using configASSERT() and stop checking the for stack overflows.
Make sure that the task that you are waking-up has the highest priority of all tasks that are runnable at that moment.
Please let us hear

hs2sf wrote on Wednesday, March 01, 2017:

I also tend to use -Os instead of -O3 with GCC. In addition I get pretty good results using link time optimization (LTO) ie. using -flto. At least it saves even more code space which usually also improves runtime performance.

rtel wrote on Wednesday, March 01, 2017:

Stack overflow detection is the feature that takes the most time to execute.

As has already been said, turning off run time stats, asserts, tick
hooks, etc. all help. The context switch itself is not the limiting factor.