Hi,
When compiling my code in Keil5, I get different code sizes when using compiler V5.03 and V5.06.
Using V5.03 - default compiler used in Keil4- my code size is: Total RW Size (RW Data + ZI Data) 30240 ( 29.53kB)
Using V5.06 - default compiler used in Keil5- my code size is: Total RW Size (RW Data + ZI Data) 49096 ( 47.95kB)
A difference of 18.42KB. My target device is TM4C123FH6PM, and is has only 32KB of RAM, so this difference is huge!
With both compilers no optimization was used (level 0).
Why is the code size that different with the different compilers?
TIA,
In general, it always is to be expected that the code size differs with a different version of Arm Compiler in use.
Why in this case the code size increases to this value requires accessing your project and its settings.
If you possess a valid license key:
- open a new Support case and attach your project: https://www2.keil.com/support/silver?P=&V=&S=
That does seem a bit large but I have noticed that as the C language goes through recent changes the code size definitely increases.
Desktop developers I guess seem to want more C features or protections so that affects us embedded developers in adverse ways! C was very stable for quite a long while, now it seems to be changing (too) often.
Use the "nm" tool or check out the linker map to see which objects are particularly large.
arm-none-eabi-nm -SC --size-sort /tmp/Arduino1.8.13Build/*.elf | grep " [bBdD] " :20000000 000000b2 D desc_ms_os_2020000fd4 000000c0 B _usbd_qdef_buf20000a0c 00000100 b sram_registers20000840 0000012c b _vendord_itf2000012c 00000184 B TinyUSBDevice20000e1c 000001b8 B _midid_itf20000600 00000200 b _mscd_buf200002bc 000002b8 b _cdcd_itf
arm-none-eabi-nm -SC --size-sort /tmp/Arduino1.8.13Build/*.elf | grep " [bBdD] "
:
20000000 000000b2 D desc_ms_os_20
20000fd4 000000c0 B _usbd_qdef_buf
20000a0c 00000100 b sram_registers
20000840 0000012c b _vendord_itf
2000012c 00000184 B TinyUSBDevice
20000e1c 000001b8 B _midid_itf
20000600 00000200 b _mscd_buf
200002bc 000002b8 b _cdcd_itf
> With both compilers no optimization was used (level 0).
You should really turn on some optimization!