I have used the ‘classic’ CodeWarrior IDE for years, before I moved over to Eclipse some years ago. And as with any IDE or tool switch, things are different in the ‘new world’. In summary, I don’t want to go back anyway, and Eclipse is my development tool of choice now. But from time to time I get challenged about something like “hey, this was possible in the previous tool, so how can I do the same in Eclipse?”. As a fan of Eclipse, this then gets my attention as I feel that Eclipse can do it, and it can do it better. 😉
So what about this one: In CodeWarrior the project view lists code and data size for each source file:
CodeWarrior can easily do this, as it maintains an internal data base of the code and details of each compilation unit/file. To me, that feature is nice, but had not much relevance for me, as this does not tell me what will be the code and data size in the application (.elf) file. Because the linker will be smart enough to strip unused functions and data.
Anyway, how to do this in Eclipse and GNU tools? Actually, I have not found a way to show it in a nice view :-(. But I know from my post “Printing Code Size Information in Eclipse” that the ‘size’ utility prints code and data size. But by default only for the application after linking. Which is what I need anyway. But what about listing code and date size for the source files?
My solution is to list the object files as ‘other flags’ the ‘print size’ settings in the project:
💡 With the GNU GCC ARM Embedded (launchpad) 4.8.x it is possible to use wildcards like Sources\*.o. This is not supported in the GNU tools in KDS, as they are using older or different tools, but you can swap the tools chain, see “Switching ARM GNU Tool Chain and Libraries in Kinetis Design Studio“.
I can use relative paths, as at least with the GNU ARM Eclipse plugins the GNU tools have the ‘output’ folder as current directory:
This then lists the size information at the end of the link phase:
'Invoking: Cross ARM GNU Print Size' arm-none-eabi-size --format=berkeley Sources\Events.o Sources\main.o Generated_Code\Cpu.o Generated_Code\WAIT1.o Generated_Code\IO1.o Generated_Code\CsIO1.o "K64_PEx_Printf.elf" text data bss dec hex filename 12 0 0 12 c Sources\Events.o 140 0 0 140 8c Sources\main.o 108 0 0 108 6c Generated_Code\Cpu.o 188 0 0 188 bc Generated_Code\WAIT1.o 824 0 24 848 350 Generated_Code\IO1.o 276 0 0 276 114 Generated_Code\CsIO1.o 10572 712 8496 19780 4d44 K64_PEx_Printf.elf 'Finished building: K64_PEx_Printf.siz'
It is possible to list the code and data size for each source (well, object) file in Eclipse. I admit it is not in the project view or in a graphical view, and I need to list the object files individually. So I do not say that Eclipse can do the *same*, but I think it is very close 😉
Happy Sizing 🙂