CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

SIZE OF A FUNCTION ?

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
YUM



Joined: 27 May 2004
Posts: 12
Location: Austria

View user's profile Send private message Send e-mail

SIZE OF A FUNCTION ?
PostPosted: Fri Jul 23, 2004 1:04 am     Reply with quote

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 ?
Question
Haplo



Joined: 06 Sep 2003
Posts: 659
Location: Sydney, Australia

View user's profile Send private message

PostPosted: Fri Jul 23, 2004 1:13 am     Reply with quote

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

View user's profile Send private message

PostPosted: Fri Jul 23, 2004 7:08 am     Reply with quote

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

View user's profile Send private message Send e-mail

PostPosted: Fri Jul 23, 2004 8:10 am     Reply with quote

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
Code:
(RETURN)
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!
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group