ARM Technical Support Knowledge Articles


Applies to: General Topics


Information in this article applies to:


How do I locate pointers in ROM? When I apply const to the pointer it is still located in RAM space.


When you declare a pointer, there are two memory areas that you must consider: the memory space where the pointer resides and the memory space where the object pointed to resides.

To locate the pointer in ROM, you must declare is to be const. For example:

const char cc=1;            // place a constant variable in const ROM
const char *p = &cc; // pointer in RAM that addresses const char
const char *const cp = &cc; // pointer in const ROM that addresses const

struct s {
const char *p; // a struct with a pointer to const ROM

struct s vs = {&cc}; // place a struct in RAM
const struct s cs = {&cc}; // place a struct in const ROM

Article last edited on: 2005-07-20 15:57:39

Rate this article

Disagree? Move your mouse over the bar and click

Did you find this article helpful? Yes No

How can we improve this article?

Link to this article
Copyright © 2011 ARM Limited. All rights reserved. External (Open), Non-Confidential