(MPLAB question in this section, now?)
Can someone check my sanity?
I'm working on a bootloader for Xtiny and Mega0, and I wanted to have a "default" application included, that would cause "reasonable behavior" if only the bootloader had been programmed. So I did something like:
int main() { VPORTA.DIR = 0xFF; VPORTA.OUT = 0x55; } void __attribute__((section( "postapp"))) __attribute__((naked)) __attribute__((used)) app(); void app() { VPORTA.DIR = 0xFF; VPORTA.OUT = 0xFF; }
Where the "postapp" part is moved at link time beyond the bootloader segment, using:
avr-gcc -mmcu=attiny412 -nostdlib -nostartfiles -Wl,--section-start=postapp=0x200 main.o -o main.elf
This works OK, at least using avr-gcc. I get a .o file, .elf file, and .hex file, all with the sections where I expect them to be.
But the MPLAB tools (mplab itself, or the ipecmd CLI tool) will only actually program the first section (using PICKit4 and/or SNAP.)
The tiny is of particular interest, but I have the same problem if I change the target to a ATmega4809.
I've attached a zipped MPLAB project, and a much simpler CLI/Makefile that I think reproduces the problem.
I am using a Mac; I haven't checked whether that matters...