I try to write some codes to rest space of MCU's flash ROM (behind my program), so I should know the lastest byte of my program. How to do all of these?
In principle, this should be possible by adding a segment of assembly code to your program that contains only a single label, and telling the linker to place that segment as the very last one of the whole project. We've had problems with that approach here, though. The linker didn't respect the "last" directive if there was a gap in the memory map into which this segment would fit.