I am trying to calculate a simple checksum on my code. I am doing something like this:
unsigned short Index, Checksum = 0; unsigned char code * data pCode = 0; for( Index = 0; Index < end_of_code; Index++ ) { Checksum += *pCode++; }
How can I get the linker to fill in the 'end_of_code' address or the size of the code segment?
Thanks, Dan
At least the LX51 linker has a directive to put a given segment to the very end of the code. Use it on a dedicated (assembly) file holding only the end_of_code symbol.
Try this...
http://www.keil.com/support/docs/2681.htm
--Cpt. Vince Foster
Some Linkers do provide symbols which allow the software to gain information like this.
It is a frequently asked question on this forum, and Keil have gone to the trouble of writing an article about it.
So why not just build it into the linker, then?! Clearly the demand exists...
View all questions in Keil forum