|
|
View previous topic :: View next topic |
Author |
Message |
jopoulin Guest
|
ram allocation |
Posted: Tue Jan 23, 2007 4:05 pm |
|
|
Hi everybody,
I would like to know how the CCS compliler allocate ram data.
Does it allocate it in sequential way?
When data are put in the accesse area, the bank0 or bank1?
It is a way to have a control on it?
The goal of it is to put the variable mostly used in the bank 0 or in the accesse area the optimise bank switching.
thanks! |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
|
treitmey
Joined: 23 Jan 2004 Posts: 1094 Location: Appleton,WI USA
|
|
Posted: Tue Jan 23, 2007 4:50 pm |
|
|
The one link says to put large array at end of variable definitions.
This is to reduce bank swaping.
I seem to put them in the begining. my thinking is that the compiler finds space for these first. then put the little variable in the open holes.
Do I understand both issues corectly? |
|
|
Ttelmah Guest
|
|
Posted: Wed Jan 24, 2007 3:16 am |
|
|
You need to be a bit careful about the beginning of RAM. The compiler puts quite a few important things of it's own here. If you have PCW, then in device editor, look under the 'memory' tag, at the entry 'C scratch RAM'. This is the location, where the compiler puts it's own temporary variables (normally five used), and if you overwrite this, you'll be in problems.
It is worth also realising, that the compiler uses 'temporary' memory allocation if it can. So a variable in a subroutine, that is not 'static', uses a memory area, that another subroutine (provided it is not called from 'inside' the first), can re-use. If you physically fix too many variables in the low bank, it prevents subroutines from being able to use these areas, and can actually make things worse...
Generally variables use memory in the order they are declared. If you do a search back through the forum, there were also a number of threads in the past about how best to organise variables, to reduce bank switching on the 16 chips (I think PCM programmer posted a very informative section about this?).
Best Wishes |
|
|
|
|
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
|