I am using 5.20 if it matters I have a function that is indirectly called from an array of functions. This function is contained in its own module. When I link, I get the following warning:
WARNING 16: Uncalled Segment, ignored for overlay process segment: ?CO?FACT_CON
static float code ideal_values[LAST_POINT] ={
I have a function that is indirectly called from an array of functions. This function is contained in its own module. When I link, I get the following warning: WARNING 16: Uncalled Segment, ignored for overlay process segment: ?CO?FACT_CON You know this will happen. Okay. static float code ideal_values[LAST_POINT]if I change the "code" to "const" (or remove it entirely), it will link with no warnings, but now the variable is taking up XDATA, and with only 2K of it, XDATA is VERY precious... Remember, C says nothing about const meaning "in PROM", it just means read-only at compile time (undefined at run-time if you try to write to it). So, C51 could place const data in XDATA and not violate C rules. With C51 code tables are constant implicitly so you should make any code table const as well for safety. To ensure vars. are placed in code memory you must define them with the code memory space qualifier. Your definition should absolutely be written as:
static float code ideal_values[LAST_POINT]
static const float code ideal_values[LAST_POINT];
To ensure vars. are placed in code memory you must define them with the code memory space qualifier. Your definition should absolutely be written as: static const float code ideal_values[LAST_POINT]; This was one of the several incantations I tried, and I still get the warning. It was also suggested to make sure that variable was used in the function call, and it is. Another suggestion was to place this directly in the function that uses it (since the file only has one function in it, it is ONLY used by one function, and can go inside that function), but I haven't tried this yet. Anyone else have an idea?