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

DSPIC33EP512GP502 -- PCD v5.115 compiler ram issue

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



Joined: 09 May 2020
Posts: 110

View user's profile Send private message

DSPIC33EP512GP502 -- PCD v5.115 compiler ram issue
PostPosted: Tue Jul 18, 2023 10:17 am     Reply with quote

Hi,

I'm using a DSPIC33EP512GP502 (48K RAM) with PCD v5.115 compiler.

If I define :

char arr[28000]={};

I get:

Memory usage: ROM=0% RAM=57% - 57%

Else if I define:

char arr[30000]={};

I get:

Error#74 Not enough RAM for all variables

How is it possible?
If I define two distinct array (size first 28000, size second 10000) all is fine...

What is the problem?

Regards
Ttelmah



Joined: 11 Mar 2010
Posts: 19231

View user's profile Send private message

PostPosted: Wed Jul 19, 2023 1:23 am     Reply with quote

Problem is that the RAM is not just a large unused lump of continuous
memory. There are other things that sit 'in' it. One is the stack. This sits
just below 0x7FFF (so with the default stack 0x7F80 - 7FFF.).
Your array when it goes over 0x7f7F-0x1000 (the user RAM starts here)
can't fit without being broken into two. So about 28500 bytes. If your
stack is bigger, earlier than this.

You can explicitly locate the stack closer to the end of memory, using
the #BUILD command. So:

#build (stack=0xB000:0xB1FF)

Will put the stack up at 0xB000, and you will then find your array will
work. This gives a 512byte stack.
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