Hello, my application is utilizing almost all RAM.
Now i need to add a feature and for that i declare a 2D
static const char * states =
I am using a chip with 32KB Ram. Without this new array memory
consumption is as follows:
Program Size: Code=95100 RO-data=6428 RW-data=396
once i add 17-th element in the array I get:
Error: L6220E: Execution region RW_IRAM1 size (32776 bytes)
exceeds limit (32768 bytes)
Why do i get this error? Aren't static const arrays are stored
only in flash memory?
The const applies to your strings. However your array contains a
list of pointers which can be updated at runtime.
You also must tell the compiler that your pointers are
static const char * const states = ...
Yes, that was it. Thanks.
So now my array is stored on flash and at run time it is fetched
from flash any time i access a cell from the array?
it is fetched from flash any time i access a cell from the
That's an odd way of phrasing it. It works the same way as it
would if it were in RAM. When an element of the array is accessed, it
is read from flash.
I know I have to improve my English.
The language of international business is bad English. Don't
worry, you're in good company.
Const and pointers can be confusing. A deep understanding of what
the compiler does with these things can be very helpful. As long as
you keep on following up on the things that confuse you, this
understanding will with your experience.
I'm not familiar with any of the ARM architectures, yet your issue
was obvious to me, simply because I have the experience. I don't
think I'd have seen it on the spot 2 years ago.
I'm sorry, that sentence in the 2nd paragraph was supposed to say
"... , this understanding will grow with your