About GCC ARM 4.6 compiler code size optimization
Premise: this is my first experience with GCC toolchains.
I downloaded the GCC ARM 4.6.2 EABI toolchain and used it to build a project (26 files, target MCU STM32F103CB) on a WinXP PC with the following results:
No optimization (-O0): program size 142216 bytes (greater than the 128K MCU internal flash)
Full code size optimization (-Os): program size 62980 bytes
These results show a poorer code optimization level if compared with a previous release (4.5.2 lite edition that I downloaded from CodeSourcery):
No optimization (-O0): program size 110524 bytes.
Full code size optimization (-Os): program size 60232 bytes.
I used the same compiler options for the two releases:
-mcpu=cortex-m3 -mthumb -Wall -D STM32F10X_MD -D STM32F103CB -ffunction-sections –O(0/s) -g –c
and the same linker options:
-O(0/s) -nostartfiles -Wl,-Map=test.map -mcpu=cortex-m3 -mthumb -Wl,--gc-
(no library)
I used objdump to disassembly some sample functions and I found that in all the cases the code generated with the 4.5.2 compiler is more optimized in size than the 4.6 release.
Is the reduction of code size optimization observed with the 4.6 version to be considered tolerable or I did something wrong?
Thanks
Danilo
Question information
- Language:
- English Edit question
- Status:
- Solved
- Assignee:
- No assignee Edit question
- Solved by:
- Joey Ye
- Solved:
- Last query:
- Last reply: