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: 19496
Posted: Wed Jul 19, 2023 1:23 am
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.
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