When writing a bootloader, I end up specifying in the linker command line "--section-start=.text=0x7E00" to locate the code in the bootloader section.
But the 0x7E00 part is chip dependent, and what I REALLY want to do is have .text start at (FLASHEND-512), where FLASHEND comes from the the io.h chain of source-code include files.
Is there some way to do that? Perhaps with a custom linker script? I can't see a way for C source to define the values of the linker variables that the linker scripts use, and I can't see a way for the linker scripts to access values defined in C source files... (I mean, __TEXT_REGION_LENGTH__ in the avr linker scripts is given a generic value for each "family", rather than an accurate value for the particular chip, which is something I would have expected.)
The best I can think of is to dynamically create a custom linker script, based on some sort of dummy program with the same -mmcu option, but that would require some sort of native programming language that understands C #include files. and it's gross.
This doesn't seem like it should be impossible :-(