Detailed memory usage by module on a PIC18

Hello,

I have a legacy project for PIC18F452 that compiles with HI-TECH Software C Compiler, using MPLAB IDE. The device's flash program memory is nearly full and I'm curious to see what occupies most of this space. How can I see memory footprint of compiled program, by modules?

The project consists of 19 'C' files; if the compiler told me how much memory each one uses, that would be great. Currently when I compile it only shows footprint by segments, as follows:

Memory Usage Map: > > Program ROM $000000 - $000005 $000006 ( 6) bytes > Program ROM $000008 - $000015 $00000E ( 14) bytes > Program ROM $000018 - $00006F $000058 ( 88) bytes > Program ROM $000110 - $0005FF $0004F0 ( 1264) bytes > Program ROM $0006B0 - $006CF7 $006648 ( 26184) bytes > $006BA4 ( 27556) bytes total Program ROM > > RAM data $000047 - $0001DB $000195 ( 405) bytes > RAM data $000504 - $0005FF $0000FC ( 252) bytes > $000291 ( 657) bytes total RAM data > > Near RAM $000000 - $00000F $000010 ( 16) bytes total Near RAM > Near bits $000080 - $0000B6 $000037 ( 55) bits total Near bits > ROM data $000070 - $00010F $0000A0 ( 160) bytes > ROM data $000600 - $0006AF $0000B0 ( 176) bytes > $000150 ( 336) bytes total ROM data > > EEPROM Data $F00000 - $F0002F $000030 ( 48) bytes total EEPROM Data > > > Program statistics: > > Total ROM used 27892 bytes (85.1%) > Total RAM used 680 bytes (44.3%) > Near RAM used 23 bytes (18.0%)

which is spectacular (wow, so much information), but not that useful. I.e as far as I understand, most program code just goes into the largest segment and little else can be said.

Best regards, Nickolai Leschov

Reply to
Nickolai Leschov
Loading thread data ...

I use Hi-Tech C and ASM for Intel 8096 work; the tools work well and link maps and assembler listings provide detailed size and address information. The manuals for the PIC tools are freely available online.

You can use my Hi-Tech tools interactively (to see the various output formats) within my on-line ICE pages at:

formatting link

The ICE is currently powered-off for energy and component conservation, so you won't be able to _run_ any of the demos or programs you write, but you can assemble, compile and debug. The manuals are accessible online for reference within the pages. There are also menus of demonstration program C code, precompiled code, etc. to save you some time.

Regards,

Michael

Reply to
msg

Have you looked at the .map file?

Reply to
Neil

There isn't any .map file.

Reply to
Nickolai Leschov

Where should I look for this detailed size information? Which file names?

Regards, Nickolai Leschov

Reply to
Nickolai Leschov

There is a linker option for generating a map file that contains the details you are looking for. I don't have access to the information at home, but you should be able to get a map file by either selecting a project option through MPLAB or specifically adding in the link control option (see the HiTech manual for that option).

--
Thad
Reply to
Thad Smith

If the O.P. had availed himself of my suggestion to visit my site (url in previous posts), he could have seen the command line switches in various places, including the online reference manuals and also the online compile and link feature which displays the command line.

Michael

Reply to
msg

Thank you, now I enabled the map file and looked into it. I seek for an easy way to estimate memory usage (flash ROM, mainly). There goes linker command line, machine type and call graph (I will leave it for later). After that there goes section that I might need:

Do the numbers in column named 'Length' constitute memory usage? (in hexadecimal, apparently) What do the names (text, bigbss etc. mean?)

Is there a way to see these numbers in a more convenient manner? I would like to see just length and I don't seem to need to see the size of segments - I care about what goes to RAM and ROM, basically.

Best regards, Nickolai Leschov

Reply to
Nickolai Leschov

There are multiple segments that go into RAM and ROM. bigbss, bss, rbit, ibigdata, bigdata, temp, data are RAM text and end_init, intcode are ROM.

--
Thad
Reply to
Thad Smith

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.