I spent 8 hours trying to figure out how to user Harmony's bootloader, I went through the code and decided to give up.
When I see harmony's code, I believe this project is already dead. I was hoping they would improve from the previous framework (upon which I spent about 5 years fixing bugs), but no, still keep cryptic function names, 200 lines while loops and non-sense... take a look at APP_ProgramHexRecord on nvm.c of the Harmony framework...
Took 5h to write a new bootloader from scratch.
Anyhow I think I found the problem, I forgot the _RESET_ADDR directive from the linker.
_RESET_ADDR = 0x9D000480;
kseg0_program_mem (rx) : ORIGIN = 0x9D000000 + 0x800, LENGTH = 0x100000 - 0x800
kseg0_boot_mem : ORIGIN = 0x9D000000, LENGTH = 0x0
debug_exec_mem : ORIGIN = 0x9FC20490, LENGTH = 0x3B20
kseg0_boot_mem : ORIGIN = 0x9FC20490, LENGTH = 0x0
I'm still not sure if that's the correct way to put it but it seems to now work.
I've seen another example here https://www.microchip.com/forums/m942247.aspx
where the _RESET_ADDR is set to the kseg1_boot_mem, which I tried but the linker then says pic32m-ld.exe: section .app_excpt loaded at [9d000180,9d00018f] overlaps section .reset loaded at [9d000000,9d0001f3]