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

Compiler Options

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







Compiler Options
PostPosted: Mon Sep 08, 2008 2:48 pm     Reply with quote

I am having problems with the compiler including all functions, even if they are not in use. For example, I have included a FAT32 driver, but I'm not using all the functions. The PCH compiler is including everything. This is for a bootloader so I want to occupy minimal code space. For larger programs, I notice that the compiler knows not to include unused functions.

Is there a compiler option I can turn on to not include unused functions?

Thanks.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Sep 08, 2008 2:55 pm     Reply with quote

Post a link to the FAT32 code that you're using. If it's from the CCS
code library, then post a link to it.

Post a list of the routines that you believe are improperly being
included in the compiled program (and in the HEX file).

Post your PIC and your compiler version.
zhzhou
Guest







PostPosted: Mon Sep 08, 2008 3:15 pm     Reply with quote

I'm using PCH v4.069 with MPLAB and compiling for PIC18F65J90.

It doesn't actually matter if it's FAT32 or LCD or whatever driver. I have a program that can compile. Then when I add one line: #include "fat32.c", the compiler says ROM usage is 28% (it was 2% before the include). I don't even call any functions within fat32.c in the mainline code. The hexfile also increases from 6kB to 28kB.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Sep 08, 2008 3:41 pm     Reply with quote

I installed vs. 4.069 and I compiled two test files. The first one does not
have any #include'd driver file. The 2nd test has the LCD.c file included.
The .LST file for both tests shows the same thing: 30 bytes of ROM.
This is compiled under MPLAB.

This is the first test, without the LCD.c file:
Code:
#include <18F65J90.h>
#fuses HS, NOWDT
#use delay(clock=20000000)

//================================
void main()
{

while(1);
}

CCS PCH C Compiler, Version 4.069, xxxxx       08-Sep-08 14:29

               Filename: 18F65J10.lst

               ROM used: 30 bytes (0%)
                         Largest free fragment is 32730
               RAM used: 5 (0%) at main() level
                         5 (0%) worst case
               Stack:    0 location


This is the 2nd test, with LCD.c included:
Code:

#include <18F65J90.h>
#fuses HS, NOWDT
#use delay(clock=20000000)

#include <lcd.c>
//================================
void main()
{

while(1);
}

CCS PCH C Compiler, Version 4.069, xxxxx     08-Sep-08 14:30

               Filename: 18F65J10.lst

               ROM used: 30 bytes (0%)
                         Largest free fragment is 32730
               RAM used: 5 (0%) at main() level
                         5 (0%) worst case
               Stack:    0 locations
zhzhou
Guest







PostPosted: Tue Sep 09, 2008 2:53 pm     Reply with quote

I've discovered that it is the "#org" directive that causes it. Is there a way around this?

Code:
#org LOADER_REAL_START, LOADER_END auto=0 default

#use delay(clock=32000000)


#include "fat32.c"


void main ()
{
}
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