Thanks for the reply @bobpaddock
Yes, I have read the article you linked. The example shown is writing an entire register (FOPT) using a single IFR write to 0x84. It makes sense and it's clear what the bytes/bits mean. But I'm struggling to understand how to write individual bits in the FSEC register using IFR 0x80-0x83.
Let's take the case of backdoor key to unlock the device (as you suggested). To do that I need to set the backdoor key by writing 8 bytes to IFR 0xB0. No problem because it's a "full bytes" type of write, easy to understand. Next I try to set FSEC:KEYEN to 10 by writing IFR 0x83, which is an "individual bits" kind of write, and it doesn't seem to work. See output below.
Any suggestions?
// check that device is unsecure
blhost -p COM4 -- get-property 17
Ping responded in 1 attempt(s)
Inject command 'get-property'
Response status = 0 (0x0) Success.
Response word 1 = 0 (0x0)
Security State = UNSECURE
// Program FSEC:KEYEN (bits 7:6) to 10
blhost -p COM4 flash-program-once 0x83 4 FFFFFFBF
Ping responded in 1 attempt(s)
Inject command 'flash-program-once'
Successful generic response to command 'flash-program-once'
Response status = 0 (0x0) Success.
// Program backdoor key to 0xBBBBBBBBBBBBBBBB
blhost -p COM4 flash-program-once 0xB0 8 BBBBBBBBBBBBBBBB
Ping responded in 1 attempt(s)
Inject command 'flash-program-once'
Successful generic response to command 'flash-program-once'
Response status = 0 (0x0) Success.
// Program FSEC:SEC (bits 1:0) to 11
blhost -p COM4 flash-program-once 0x80 4 FFFFFFFF
Ping responded in 1 attempt(s)
Inject command 'flash-program-once'
Successful generic response to command 'flash-program-once'
Response status = 0 (0x0) Success.
// reset so settings will take effect (also tried power cycle)
blhost -p COM4 reset
Ping responded in 1 attempt(s)
Inject command 'reset'
Successful generic response to command 'reset'
Response status = 0 (0x0) Success.
// unlock device with backdoor key
blhost -p COM4 -- flash-security-disable BBBBBBBBBBBBBBBB
Ping responded in 1 attempt(s)
Inject command 'flash-security-disable'
Response status = 103 (0x67) kStatus_FlashAccessError