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 CCS Technical Support

functions inserted multiple times in code space

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
gil.fonea@sds-tech.com



Joined: 24 Mar 2010
Posts: 24

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

functions inserted multiple times in code space
PostPosted: Thu Dec 27, 2012 5:43 am     Reply with quote

Hi,

Compiling a CCS (ver 4.099) project for 18F85J90 and looking into the MPLAB disassembly listings shows that printf (and other functions) code appears as many times as it's called in the code. This occupies a lot of code space.

Is there anyway to avoid this (just call the function address in the code-space)?

Regards,

Gil
_________________
Gil F.
asmboy



Joined: 20 Nov 2007
Posts: 2128
Location: albany ny

View user's profile Send private message AIM Address

PostPosted: Thu Dec 27, 2012 1:20 pm     Reply with quote

You are most likely seeing CCS automatic #inline optimization based on your program having an overall small amount of object code.
This is normal behavior and makes your program execution be as fast as possible - since remote function/procedure calls take many more machine cycles than this in lining, and WORSE potentially cause excessive stack nesting failure in runtime. ( newer compiler versions I think do profile for this last problem in the call tree - but not dead sure ).

I urge you to read the CCS manual re:
#INLINE and
#SEPARATE

summary: don't worry, be happy Very Happy Very Happy
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Dec 27, 2012 3:05 pm     Reply with quote

Here are some threads on the topic:

Looking for tips for reducing ROM footprint:
http://www.ccsinfo.com/forum/viewtopic.php?t=43389
Using a wrapper function:
http://www.ccsinfo.com/forum/viewtopic.php?t=39784

http://www.ccsinfo.com/forum/viewtopic.php?t=43683
http://www.ccsinfo.com/forum/viewtopic.php?t=48256
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