Hi,
We are using FreeRTOS on a TMS570CL435. This processor is arm R5-based. As there is no FreeRTOS port for this we are writing our own based on the R4 port and the provided HalCoGen code. As HalCoGen only supports older FreeRTOS versions we had to adapt it ourselves.
Currently, we are upgrading from version 10.4.5. to the latest version in steps. There we have recognized a significant performance loss by measuring the idle time.
Version | IDLE % |
---|---|
10.4.5 | 44% |
10.4.6 | 40% |
10.5.0 | 33% |
By tracking down this Problem, we noticed one change in the portasm.asm and portmacro.h files.
FreeRTOS v10.4.5. portasm.asm:
; start: required for Cortex-R5 MPU port - generated by TI HALCoGen - see src/os/freertos/README.ti-halcogen.md for details
;-------------------------------------------------------------------------------
.def ulPortCountLeadingZeros
.asmfunc
ulPortCountLeadingZeros
CLZ R0, R0
BX LR
.endasmfunc
FreeRTOS v10.4.5. portmacro.h:
/* Generic helper function. */
unsigned long ulPortCountLeadingZeros( unsigned long ulBitmap );
#define portGET_HIGHEST_PRIORITY( uxTopPriority, uxReadyPriorities ) uxTopPriority = ( 31 - ulPortCountLeadingZeros( ( uxReadyPriorities ) ) )
FreeRTOS v10.4.6. portasm.asm:
; Function removed
FreeRTOS v10.4.6. portmacro.h:
#define portGET_HIGHEST_PRIORITY( uxTopPriority, uxReadyPriorities ) uxTopPriority = ( 31 - __clz( ( uxReadyPriorities ) ) )
When we just put back the assembler code without calling it, the performance is back at the value of V10.4.5. However, when integrating this also in V10.5.0 the performance worsens. We are using the TI-CGT 20.2.7 compiler and default with -o3 optimization. With no compiler optimizations to -o0, the difference between V10.4.5 and V10.4.6 disappears, but the problem with V10.5.0 remains.
In version V10.5.0, FreeRTOS introduces an if statement in mpu_wrappers.c to check whether the we are in the privileged mode or not.
Before this query was inside the assembler code of swiRaisePrivilege which made it more efficient. Has someone else encountered the same problems, or does anyone know the reason for the change in mpu_wrappers?
Kind regards and thank you,
Sven