|
|||||||||||
|
Technical Support Support Resources
Product Information |
C51: Static Pointers vs Explicitly Placed VariablesInformation in this article applies to:
SYMPTOMMy project includes several peripherals mapped into XDATA space. I want to access the registers of these peripherals, and I've declared a series of static pointers to address them. For example:
I also assigned these values to other pointers, like this:
The optimizer can alter these pointers so that I cannot access these registers. CAUSEThe optimizer recognizes the locations you specified as arbitrary and not necessary to be reserved. It re-assigns your "registers" to other locations to streamline program flow. RESOLUTIONInstead of using static pointers you should declare a variable for each XDATA register location and force it to the proper address using the _at_ keyword. You can then use this address to create pointers. The following is an example of how this can be done.
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.