View previous topic :: View next topic |
Author |
Message |
YUM
Joined: 27 May 2004 Posts: 12 Location: Austria
|
SIZE OF A FUNCTION ? |
Posted: Fri Jul 23, 2004 1:04 am |
|
|
Does anyone know, how i can determine the size of a function (subroutine) ?
for example:
unsigned char dummy_function (unsigned char uhu)
{
}
In the list file i can only see the starting address, but not the end address.
And what, if the function is splitted into blocks by the compiler ?
|
|
|
Haplo
Joined: 06 Sep 2003 Posts: 659 Location: Sydney, Australia
|
|
Posted: Fri Jul 23, 2004 1:13 am |
|
|
You can see the size of the functions in the statistics file (.sta) if you are using PCW(H). Otherwise you'll need to look into the .LST file. |
|
|
SherpaDoug
Joined: 07 Sep 2003 Posts: 1640 Location: Cape Cod Mass USA
|
|
Posted: Fri Jul 23, 2004 7:08 am |
|
|
You could comment it out and see how much ROM usage shrinks.
Note that a function that is never called is usually optimized out of existence. _________________ The search for better is endless. Instead simply find very good and get the job done. |
|
|
rwyoung
Joined: 12 Nov 2003 Posts: 563 Location: Lawrence, KS USA
|
|
Posted: Fri Jul 23, 2004 8:10 am |
|
|
The end address of a function in the LST file (unless it is for an ISR) will typically end like this:
Code: | 0182: GOTO 29B (RETURN) |
The tip-off is the but the actuall argument to GOTO may vary.
You can then just count words and executions cycles between the start and end of the function.
The statistics file summarizes each function in a table, for example
code]
Page ROM % RAM Functions:
---- --- --- --- ----------
0 16 2 1 @I2C_WRITEU_1_59_60
0 17 3 1 @I2C_READU_1_59_60
0 130 19 0 main
0 90 13 0 Initialize
[/code] _________________ Rob Young
The Screw-Up Fairy may just visit you but he has crashed on my couch for the last month! |
|
|
|