We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
in the variable defination ,if there are too many variables defined as following unsigned char code *Iterm[]= { " 1. realstate ", " 2. chang time ", " 3. system configue", " 4. event record ", " 5. version ", " 6. search record" }; there will be an error:'data' segment too large. while if the varibles are defined as unsigned char code Iterm[][20]= { " 1. realstate ", " 2. chang time ", " 3. system configue", " 4. event record ", " 5. version ", " 6. search record" }; there won't be such error. why? thank you !
The first declaration defines Iterm as an array of pointers in data memory (data, because you did not specify otherwise) with each pointer holding the address of an unsigned char in code memory (code, because you explicitly specified that memory space). The second declaration defines Iterm as an array of 20-byte arrays of unsigned char in code memory. The distinction is that the first defining declaration is really defining more than just one object; initialized strings in code memory, and an array of pointers to those strings with the array being in data memory. I presume that in the first case, you want everything to be allocated to code memory, in which case the you would do it thusly:
const unsigned char code * const code Iterm[]= { " 1. realstate ", " 2. chang time ", " 3. system configue", " 4. event record ", " 5. version ", " 6. search record" };