2006-05-31 03:23 AM
constant pointer to constant character string?
2006-05-30 04:27 AM
Hi All,
I'm using the GCC compiler tools for an STR730 CPU and I want to define an array of strings that will be stored in the Flash memory. I am using const char *HelpStrings[] = { ''a string of text\r\n'' ... }; which puts the strings of text in ROM but builds the table of pointers in RAM. Does anyone know how I can tell the compiler to build the pointer table in ROM space as well? I just don't want to waste RAM space on something that will never be changed!! Thanks for any suggestions PhilipJ2006-05-30 08:08 PM
try doing
const char *const HelpStrings[] = {2006-05-31 02:54 AM
thanks for the suggestion, sadly it generates errors:
error: conflicting types for 'HelpStrings' error: previous declartion of 'HelpStrings' was here warning: array 'HelpStrings' assumed to have one element !!! Don't quite know what they mean (particularly the middle one) but they only come in when the 2nd const is added. Maybe I'll just resign myself to having the pointer table in RAM PhilipJ2006-05-31 03:23 AM
that is strange I am using gcc v3.4 and have no such problems.
e.g. const char *const data[] = { ''data'', '''' }; Is the variable decleration inside a header file ? edit: I have also seen examples where char const * const is used, perhaps you could try that. [ This message was edited by: ben_fnr on 31-05-2006 16:37 ]