I would like to place a version string right after the vectors in my ATmega16. I'm using AVRStudio and WinAVR to build my project, and the version string is defined in version.c.
Defining my own section at that address gives a linker error that says that my section overlaps the .text section so that does not work.
If I put my version string in PROGMEM then it is placed in the beginning of the Flash, but other PROGMEM constants are placed before it. If I remove all c-files from the AVRStudio project and then add them again, starting with the version.c so that it will be built first, then the version string is palced where I want it. But I don't like this because it is dependent on the order the files are added, and if someone creates a new project based on this then they will likely not add version.c first... And using a custom Makefile is unfortunately not an option.
.text 0x00000000 0x2ce6 *(.vectors) .vectors 0x00000000 0x54 c:/devtools/winavr-20070525/avr/lib/avr5/crtm16.o 0x00000000 __vectors *(.vectors) *(.progmem.gcc*) *(.progmem*) .progmem.data 0x00000054 0x200 CRC.o 0x00000154 mCrcTable_L 0x00000054 mCrcTable_H .progmem.data 0x00000254 0x24 Image.o .progmem.data 0x00000278 0x2 version.o 0x00000278 VersionArray <-WRONG!!!
If I put the string in the .vectors section then it is placed where I want it. But I don't feel comfortable doing that. Can I guarantee that the vectors always are placed before my version string?
.text 0x00000000 0x2ce6 *(.vectors) .vectors 0x00000000 0x54 c:/devtools/winavr-20070525/avr/lib/avr5/crtm16.o 0x00000000 __vectors .vectors 0x00000054 0x2 version.o 0x00000054 VersionArray <-CORRECT! *(.vectors) *(.progmem.gcc*) *(.progmem*) .progmem.data 0x00000056 0x200 CRC.o 0x00000156 mCrcTable_L 0x00000056 mCrcTable_H .progmem.data 0x00000256 0x24 Image.o
Comments and suggestions? Any ideas how to proper solve this?