This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

C51, Linker, list of variables as pile up in memory

Hi

I found a bug in my code, a for was out of range and overwriting the variables after the wanted one.

i.e.
uint8_t xdata globalMyVar[4];

for ( ii = 0; ii < 20; ii++ )
{ globalMyVar[ii] = 0;
}

So I wanted to look which were these overwritten variables.
For that I checked the file generated by the linker (.M51) with the symbols information
My application has several modules.
The symbol(s) table(s) produced is not well adapted for a quick look on how variables are piled up in memory.

What I did was to cut and paste all the modules symbols information in excel, with fixed columns for the address value, type and name then sort by address value.

I couldn't find a switch for the linker to obtain this kind of sorted list.
Btw I noted that the memory pile-up is not as declared in the source code, nor alphabetic (some internal hash used for optimization?).

Is there a better way to get the sorted list of variables as they are defined in memory? (than sorting via excel)

Regards
Daniel

0