GCC -O2 optimization ~3% lower performance than Keil for motor control application
Subject: Performance difference between GCC (-O2) and Keil ARM Compiler in motor control application
Description:
I am currently developing a motor control application using STM32F303 and comparing the performance of two development environments: STM32CubeIDE (GCC ARM toolchain) and Keil µVision (ARM Compiler).
Hardware & Software Environment:
MCU: STM32F303
STM32CubeIDE Version:2.1.1
Keil MDK Version: v5
Motor Control SDK Version: X-CUBE-MCSDK v6.4.2
Optimization Level: -O2 for both compilers
FOC Algorithm: [hall FOC]
PWM Frequency: [16 kHz]
Test Methodology:
I have ported the exact same motor control source code to both environments. Performance is measured by:
- I noticed that the .hex file generated by Keil (100 KB) is smaller than the one generated by STM32CubeIDE (103 KB). Does this come from the compiler difference?
- Has anyone performed similar benchmarks between GCC and ARM Compiler for motor control and found strategies to close the gap?
