My device is the dsPIC33EP64MC202. I have a bootloader which loads a program in flash to run or erases and rewrites that program as directed by serial commands. If possible, I would like to account for the possibility of changing the shared configuration bytes in the future, but it seems that might be impossible without a physical programmer.
From DS70618C (dsPIC33E/PIC24E Family Reference Manual), Section 30 (Device Configuration), 126.96.36.199:
Erasing the last page of program memory will automatically enable code protection, which prevents further reads or writes to program memory. As a result, it is not recommended to perform a page erase on the last page of memory where the Configuration bits are stored.
Given that erasing the page with the configuration words triggers code protection, how do I change the configuration bytes in my bootloader? I have tested erasing that page and writing new values to 0xAFF0 - 0xAFFA. Sure enough, only the original, unmodified values are there (before and after reset).