| |||||
Technical Support On-Line Manuals C166 User's Guide | Variable LocationFrequently accessed data objects should be located in the on-chip memory of the C16x/ST10. Accessing the on-chip memory is much more efficient than accessing external data memory. The on-chip data RAM is shared among register banks, the bit data area, the stack, and other user-defined variables with the idata or bdata memory type. Because of the limited amount of on-chip RAM, all your program variables may not fit into this memory area and some must be located in other memory areas. There are several ways to do this. One way is to change the memory model and let the compiler to all the work. This is the simplest method, but it is also the most costly in terms of the amount os generated code and system performance. Refer to Memory Model for more information. Another way to locate variables in other memory areas is to manually select the variables that are not required to be in on-chip memory and to declare them using the far, huge, or xhuge memory specifiers. Usually, string buffers and other large arrays can be located off-chip without a significant degradation in performance or increase in code size. The HOLD directive may be used in combination with an appropriate memory model to specify thresholds for variable size and certain memory areas. This allows you to automatically locate large buffers and variables in memory areas based entirely on size. In general, near variables are the most efficient followed by far, huge, and xhuge in that order. Bit variables are always located in on-chip RAM. So, you should use a bit whenever yes/no information is adequate. | ||||
| |||||