Microprocessor and Development Tools - Embedded Control - Communications - Connectivity
   
Low-Cost Dev Kits
Application Kits
RabbitCores
Latest Downloads
Single-Board Computers
Rabbit Support Forums
Training/Events



Support > Ask Larry > May 24th, 2007

I was looking back into my archives and noticed that I have been receiving numerous requests asking help with RAM utilization. So in this edition of Ask Larry I am going to cover this interesting topic.

The RAM space that is available to store your variables with both the Rabbit 2000 and 3000 processors is called “Root Data”. With Separate Instruction & Data Space disabled, the amount of Root Data memory is about 28k bytes. With Separate Instruction & Data Space enabled the amount of Root Data memory is about 54k bytes. These values can be modified somewhat by editing the bios and redefining the macro DATAORG. In versions of Dynamic C® preceding 9.3 this macro can be found in the file Bios\RabbitBios.c. In 9.3 and later it is in Lib\BiosLib\StdBios.c.

If you want to change the value please be sure to read the comments in the file carefully. There is always a tradeoff – you do not ever get something for nothing!

You will need several functions in order to use all of RAM for data. First, you need to realize that you can only manipulate data that is in Root Data space. All other data must be saved in XMEM RAM. This is RAM outside of Root. If you are collecting data that exceeds the size of Root then you need to create a Root buffer, fill it, copy it to XMEM and re-use the Root buffer. This means that you will need to keep track of how much xmem RAM you are using and where you saving your data in XMEM. If you need to manipulate some data that has been stored in XMEM you will need to copy it to your Root buffer, modify it, and then copy it back to XMEM.

I suggest that you read Chapter 10 in the Dynamic C User’s Manual for a quick tour of Memory Management.

This limitation does not exist with the Rabbit 4000 and Dynamic C 10.xx since it implements far pointers. This feature allows you to utilize essentially the entire RAM for variable declaration and storage. You may dimension very large arrays – almost up to the size of RAM.

Keep in mind that Dynamic C uses at least 16K bytes of RAM for its own purposes, such as: stack, flash buffer, communications buffer, etc. The program Memory_Usage.c can be used to see exactly what Dynamic C uses for a small program. Your program may also use RAM based on what libraries and features you are using: TCP/IP, uc/OS-II, etc.

Tech Note TN238, Rabbit Memory Usage Tips, has lots of helpful tips for efficient usage of RAM. It is available on our web site: http://www.rabbitsemiconductor.com/documentation/docs/refs/TN238/TN238.zip as well as in the Dynamic C distribution in the Docs\refs\TN238 folder. There are also some sample programs in the Samples/XMEM folder.

- Larry C.

Larry Cicchinelli is Rabbit Semiconductor’s Technical Support Manager. He has 30 years of embedded experience, and is considered one of the foremost authorities on Rabbit products. Larry and his staff offer comprehensive technical support to Rabbit customers.

Submit your questions for Larry via email at AskLarry@rabbit.com

Read more Ask Larry Answers



   Site Map | Privacy Policy | Contact Us | Feedback Copyright © Rabbit All Rights Reserved    A Digi International® Brand  
View Cart | Contact Us
View Cart
Products Solutions Support Company Channel partners Careers Ordering Information