|
|||||||||||
|
Technical Support Support Resources
Product Information |
C51: Memory Classes for Strings and String PointersInformation in this article applies to:
QUESTIONI am using the Cx51 Compiler with code banking and variable banking and am having a problem with string allocation. When I declare a constant char string:
the compiler locates the pointer in HDATA memory. However, I want all my constants to be located in HCONST. How can I solve this problem? ANSWERYour example defines a pointer in far that points to const char that may be located in any memory space. This is probably not what you want. The following code example does what you describe:
The STRING directive specifies that the const far memory space is the default location for implicit text strings. And,
defines a pointer in const far that points to const char. Now, all your variables will be located in the HCONST memory class. MORE INFORMATION
SEE ALSOLast 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.