I am trying to write a script to find out the RAM-ROM usage (RAM = bss + data,
ROM = rodata + text) of and object file. I tried with a GreenHills compiler tool that generates a report, but for some cases it doesn't work. Is there a way to find the memory sections to calculate the usage ?
@B. Vlad  You should count alignments when allocations in memory are done too. As suggested above, the only reliable way is to use linker output, as it will provide "memory" map of the objects with addresses they are loaded to( before loaded in memory though).
How to find the ram rom usage (.bss .text .rodata .data) of an object file *.o?