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

Locating and Reducing RAM Usage

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



Joined: 16 Jan 2005
Posts: 559
Location: Tucson, AZ

View user's profile Send private message

Locating and Reducing RAM Usage
PostPosted: Mon Dec 20, 2010 10:02 am     Reply with quote

I am consolidating several stand-alone test programs into a single on an 18F6627 using 3.249. I am running into problems during compilation due to not enough RAM. When I look at the symbol file, these are the culprits:

Code:

000     @SCRATCH
 na     disk_read.SectorNumber
 na     disk_read.SectorCount
 na     SD_cmd.@SCRATCH
 na     SD_receive_data.@SCRATCH
 na     SD_write_data.@SCRATCH
 na     disk_write.@SCRATCH
 na     disk_read.@SCRATCH
 na     serial_isr.@SCRATCH
 na     serial_isr2.@SCRATCH
001     @SCRATCH
002     @SCRATCH
003     @SCRATCH
...
...
FEF     INDF0
FF0     INTCON3
FF1     INTCON2
FF2     INTCON
FF2     INTCON1

*** na indicates variables that would not fit into memory


My first assumption is, there is a problem with organization and not memory size?

It looks like I'm into some of the deeper, darker recesses where I've never been. Can anyone offer any guidance?

Thanks,

John


EDIT:

I have tried: #device *=16 without success.
Ttelmah



Joined: 11 Mar 2010
Posts: 19535

View user's profile Send private message

PostPosted: Mon Dec 20, 2010 10:29 am     Reply with quote

None of those are the 'culprits'......

The last few are hardware registers on the chip, and the first set are scratch (temporary) locations. Nothing of any size shown here.
You are looking at large arrays, strings, etc., as the thinks that 'drink' memory.
*=16, makes no difference on a PIC18. These chips address all their memory OK without this.

Best Wishes
jecottrell



Joined: 16 Jan 2005
Posts: 559
Location: Tucson, AZ

View user's profile Send private message

PostPosted: Mon Dec 20, 2010 10:42 am     Reply with quote

I have been looking at the symbol file and finding the variables that use large chunks and reducing them. That seemed to work. The major user is the SD file system and what has turned into, several files being declared to the tune of 512B each. So, I guess now it's time to sharpen the pencil and figure out what's necessary and what isn't.

Thanks for the info,

John
Ttelmah



Joined: 11 Mar 2010
Posts: 19535

View user's profile Send private message

PostPosted: Mon Dec 20, 2010 11:02 am     Reply with quote

Given that the sector on a SD card, is 512bytes, and must be written as one 'lump', of course' the buffers are 512bytes in size.....

This is where careful management of your other use of memory, or possible 're-using' the same area for other things when not talking to the card, becomes necessary.

Best Wishes
jecottrell



Joined: 16 Jan 2005
Posts: 559
Location: Tucson, AZ

View user's profile Send private message

PostPosted: Mon Dec 20, 2010 11:13 am     Reply with quote

Ttelmah wrote:
This is where careful management of your other use of memory, or possible 're-using' the same area for other things when not talking to the card, becomes necessary.


I had an extremely competent programmer (much more so than I) write some of the code. However, he was a large embedded system guy, so I think he wasn't quite as 'aware' of the memory that was being used up. I've found three different file structures declared at 512B each. I'm checking now to see if I can manage with just one.

Thanks again,

John
bkamen



Joined: 07 Jan 2004
Posts: 1615
Location: Central Illinois, USA

View user's profile Send private message

PostPosted: Mon Dec 20, 2010 5:14 pm     Reply with quote

jecottrell wrote:

I had an extremely competent programmer (much more so than I) write some of the code. However, he was a large embedded system guy, so I think he wasn't quite as 'aware' of the memory that was being used up. I've found three different file structures declared at 512B each. I'm checking now to see if I can manage with just one.



It's a common thing I find with people who think all "programmers" are the same.

People who work with "linux" or "windows CE" are typically not at the same level as folks who work with these little itty bitty micro's with 1024K of flash and 35 bytes of RAM... hahaha

-Ben
_________________
Dazed and confused? I don't think so. Just "plain lost" will do. :D
newguy



Joined: 24 Jun 2004
Posts: 1908

View user's profile Send private message

PostPosted: Tue Dec 21, 2010 8:22 am     Reply with quote

bkamen wrote:
People who work with "linux" or "windows CE" are typically not at the same level as folks who work with these little itty bitty micro's with 1024K of flash and 35 bytes of RAM... hahaha


Amen. For the last 10 months I've been primarily cleaning up a monumental mess created by a revolving-door's worth of pure "programmers" over the last 5-6 years. None of them had any electronics knowledge and based on the code I've inherited, they obviously had no idea what was going on "under the hood"; ie that floats in an 8 bit micro are generally a bad idea and writing 3 pages to program EEPROM "bricks" the micro for about half a second.
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