dkelly wrote:
CPU is an S12NE64. The FPROT initial value stored in 0xff0d is 0xc7, protecting 0xf800 through 0xffff from being written or erased. Is there any way from inside the S12NE64 to modify this memory region without physical access to the chip and/or product?
No way. That's possibly only using BDM, when you can reset into special chip modes.
Have no problems updating the contents outside of 0xf800 to 0xffff.
The FSEC initial value stored in 0xff0f is 0xfe which is the "unsecured" value, and apparently not relevant to my problem.
The Backdoor key apparently has nothing to do with protection (against accidental write), only security (locked against copying using a BDM). The backdoor will do nothing to allow me to change 0xf800 through 0xffff from within, even if SEC[1:0] in FSEC was not already 0b10 unsecured.
That's right
The FPROT register is essentially moot when running on the BDM. Firmware has no problem updating 0xf800 through 0xffff when running with the BDM attached but fails when BDM is not attached. Is there anything I can do in firmware to make the S12 think a BDM is attached when it is not?
No.
Related problem: There is apparently no way to RESET the CPU from inside if COP is disabled. Someone disabled COP from within our _Startup() which is located in the protected region. This is the primary thing I'm trying to fix with a remote firmware update. If COP was enabled "ARMCOP = 0" promptly trips the COP and produces a RESET. Nobody thought to route an output pin to the RESET pin for software initiated hardware resets.
Is bootloader at f800-ffff writing write-once COPCTL register with CR0-CR2 bits all 0? If so, then yes, COP can't be enabled in your case.
But there's still one possibility. I think you can reset your chip using clock monitor reset. You should try to disable oscilator self clock mode and then do full stop. This should cause clock monitor reset. I don't remember details, what register and what bits to write, but I think it's possible.