The thing is... Bootloader Position in Flash is in relation of Flashsize at all.
So the Bootloader has to be on a specific position in flash to get working.
This is a information got on the first posts i posted.
UPDATE 2:
I found that maybe the problem was "simply" the different LDSECTION value that I have to change for the 1284P.
So, as the datasheet say, for a boot size of 1024 words (2kbytes) the boot reset address is 0xFC00 then the LDSECTION will be LDSECTION = --section-start=.text=0x1F800 (0xFC00 x 2 = 0x1F800)
The value of 1F800 is even confirmed calculating it starting from the flash size (128k = 131072 bytes - 2048 bytes = 129024 bytes = 0x1F800)
Here the poster calculated 1F800.... for a 2048 Bytes Bootloader... i think with -Os parameter we should get 2048 Bytes....
If you don't have any positive results... maybe you think about UsbAspLoader... it's a Bootloader which emulates the Usbasp-Programmer for progranmming Mcu itself.... so you are able to boot, and use the ide to programm your sketches in Flashmemory like you want to.
Disadvantage, cause of use of Digitalpins instead of USART you arne't able to use virtualcomport-Communication....
For simple Programming purposes it should do the job.
UsbAspLoader ist a v-Usb Projekt (ArduinoCompatible) to get rid of FTDI (etc.) Chips... to include softwareusb directly inside of the mcu Bootloader....
Hope it helps a little bit to get further....
Greetings ChrisS
My 1284p aren't arrived yet... *little bit angry*