|
|||||||||||
Technical Support Support Resources
Product Information |
C51: DATA_GROUP and Stack ProblemsInformation in this article applies to:
QUESTIONWhen using the C51 compiler package, the linker generates a section in the DATA memory called DATA_GROUP. What is this and how can I reduce its size to get more stack space? ANSWERThe C51 compiler does not pass parameters on the STACK. Instead, local variables and function arguments are stored in DATA, IDATA, or XDATA memory and are overlaid where possible. The overlaid memory used for local variables and arguments is grouped into the DATA_GROUP (for DATA variables), the IDATA_GROUP (for IDATA variables), and the XDATA_GROUP (for XDATA variables). These groups are created and managed by the linker. To maximize the available DATA space, you should minimize the use of global variables and use local or automatic variables instead. Global variables are allocated with a unique, non-overlayable memory address. In the DATA area this method can be very wasteful. When linking, the linker performs a program flow analysis to determine which leg of the main program uses the most local memory space. It then allocates the rest of the variables out of this area. Because of the scope of local variables, memory conflicts don't happen and memory is used very efficiently. One of the benefits of this scheme is that STACK requirements are very minimal. If you need more STACK space you should specify the use of external memory for large data types like arrays and communication buffers. This assumes that such space is available. Another good idea is to minimize the use of variables inside interrupt routines. These these variables are allocated their own unique DATA space. For more information, refer to Application Note 101. Last Reviewed: Thursday, February 25, 2021 | ||||||||||
|
Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.