hi,
(lpc1317-64P) during execution of my code const data changes. I don't know how. I have used const uint8_t *p[] = { "", "abcd", };
I have checked by adding the array in watch. At one point randomly data in null type gets changed to some long garbage data..
I need null character at 0 th places because I have made logic in that way. Also I don't think how const data can get changed randomly.I have also monitired VCC during program its 3.3V. No glitch.
is this due to because I am using 36KB of 64K byte flash & 6KB ram out of 8KB available or due to optimization as compiler stores null character in RAM for faster exceution or something
As in smaller module this code works fine without any problem. Problem come when I club the module.
However const data shouldn't be changed.
I have checked by adding the array in watch
There is a difference in the behaviour of the 'abstract machine' and the 'real machine' that you see in the watch window. One major reason is compiler optimizations that limit lifetime of variables. Also, the compiler may generate incomplete or incorrect debugging information. Besides, the debugger may interpret debugging information incorrectly. Of course, those would be bugs in the compiler or the debugger. Such bugs are considered non-critical since they don't affect the correctness of generated machine code.
However const data shouldn't be changed
I have a surprise for you: if you declare a const variable at function scope with no static keyword (that is, the variable is automatic) then the variable will be allocated on the stack. It is easy to change the contents of such variable through a pointer.
Various other things could also cause the change:
Being accessed by a pointer (deliberately or otherwise) that doesn't have a 'const' qualifier;
Stack overflow;
Buffer over/under-run;
DMA;
probably others...