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

PCM 3.205, 16F877A and bank 1

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



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Jul 16, 2004 6:29 pm     Reply with quote

You may have to do as Neutone suggests, and help the compiler
to allocate ram properly by using the #locate directive for your
large arrays. This appears to work. (ie., it now compiles without
an "out of ram" error). Example:

node nodes1[24];
#locate nodes1 = 0x110
node nodes2[24];
#locate nodes2 = 0x190
Darren Rook



Joined: 06 Sep 2003
Posts: 287
Location: Milwaukee, WI

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

PostPosted: Fri Jul 16, 2004 6:34 pm     Reply with quote

Maybe I didn't understand your problem, but why do you care where stuff is in RAM? That is why you buy a compiler, to handle placing things in RAM and for you to not worry about it.
Royce



Joined: 16 Jul 2004
Posts: 4

View user's profile Send private message

PostPosted: Fri Jul 16, 2004 7:21 pm     Reply with quote

Darren: the compiler was failing to compile this code. Its not that I care where the variables are, but they do have to be somewhere. Before I made the change that PCM Programmer made the compiler simply wasn't allocateing the space. Plus it was putting a bunch of variables ontop of one another at location zero.. which is a bad place for them to be.

PCM Programmer: Thanks a bunch for the work around! My symbol table looks sane now. I guess I'm kind of dissapointed that the compiler could not figure it out by itself. And it strikes me a strange that telling the compiler to put those arrays in the same place it was automatically selecting without the #locates would somehow allow it to find homes for all the other variables.

Would you not count that a compiler bug? Should I turn in a bug report?

All in all though this still looks to be a good upgrade from CC5X. Those expressions were killing me,

Thanks again,
Royce
Alex
Guest







PostPosted: Mon Oct 04, 2004 8:45 am     Reply with quote

Don't you have to switch between banks when you use the #locate in different banks ?
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Oct 04, 2004 1:34 pm     Reply with quote

Quote:
Don't you have to switch between banks when you use the
#locate in different banks ?

No. The compiler knows which banks the variables are in, because
the upper bits of the address are specified in the address that you
use with the #locate statement.

One of the features of the CCS compiler is that you don't have to
manually put in bank switching code. It knows what bank everything
is in, and automatically puts in code to switch to the correct bank
before accessing a variable.

------------
Edited to add:
I just noticed you asked this question (and got an answer) in another
thread, here:
http://www.ccsinfo.com/forum/viewtopic.php?t=20605
You should only ask a question in one thread. Don't tack the same
question onto several threads.
C-H Wu
Guest







don't push it to the limit
PostPosted: Mon Oct 04, 2004 7:43 pm     Reply with quote

Royce wrote:
Darren: the compiler was failing to compile this code. Its not that I care where the variables are, but they do have to be somewhere. Before I made the change that PCM Programmer made the compiler simply wasn't allocateing the space. Plus it was putting a bunch of variables ontop of one another at location zero.. which is a bad place for them to be.

PCM Programmer: Thanks a bunch for the work around! My symbol table looks sane now. I guess I'm kind of dissapointed that the compiler could not figure it out by itself. And it strikes me a strange that telling the compiler to put those arrays in the same place it was automatically selecting without the #locates would somehow allow it to find homes for all the other variables.

Would you not count that a compiler bug? Should I turn in a bug report?

All in all though this still looks to be a good upgrade from CC5X. Those expressions were killing me,

Thanks again,
Royce


I compiled your code, happy with nodes1[20], cried out with nodes1[24].

You should file a bug report, although I would call it a compiler 'defect' instead of 'bug'.

The problem is CCS always put 'local' variables at the 'end' of available RAM.

In your case, you need two 96-byte array, which have to filled up bank 2 and 3, then, there is no more RAM after bank 3, as a result, CCS cried out.

The easiest way to get around, is to reduce you array size. say, instead of 96-bytes array, 80-bytes array will be much more easier for CCS to handle, since all 4 banks has at least 80 byte space.

node nodes1[20]; // instead of 24, thus, 80 bytes instead of 96
node nodes2[20];

can you live with 20 ? Confused

last words, don't push it to the limit Cool

Best wishes
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