I am making progress getting nuttx running from flash on the C139 but I suspect I might be running into an issue where when code is trying to store a value into flash memory where nuttx code and data are that nuttx seems to stall/halt, maybe an exception vector is being jumped to by the CPU but nuttx isn't quite setup to handle it just yet.

Am I right that I would need to unlock flash in order to write even just one byte/word?

I tried doing the same sequence of writes that are in cfi_flash.c flash_block_unlock() but that seemed to stall as well... maybe I need to do some initialization of some sort? I may try to port over cfi_flash.c|h into nuttx.

nuttx is loaded into two pages: 0x10000 and 0x20000

I copied the macros for writew and __arch_putw and did
writew(0x60,0x0); // CFI_CMD_PROTECT
writew(0xD0,0x10000); // CFI_PROT_UNLOCK
writew(0xff,0x0); // CFI_CMD_RESET
writew(0x60,0x0); // CFI_CMD_PROTECT
writew(0xD0,0x20000); // CFI_PROT_UNLOCK
writew(0xff,0x0); // CFI_CMD_RESET

Seemed to halt at the first write.

Thanks for any hints, at this point I'm just hacking to try and get things working.

-Craig