Hi Peter, Paul and Spencer. Once again, John Frenz gave me valuable information on the OPTCR register. The following sequence allows me to write the new option values permanently to the OPTCR register: > reset halt; mww 0x40023C08 0x08192A3B; mww 0x40023C08 0x4C5D6E7F; mdw > 0x40023c14 > mww 0x40023C14 0x0fffaaec; sleep 200; mdw 0x40023c14; mww 0x40023C14 > 0x0fffaaef; sleep 200; mdw 0x40023c14; reset halt; mdw 0x40023c14
Note: I'm in the process of looking through the -d3 output of stm32f4x unlock 0. I'm not sure that it does what it is intended to do. So far I can confirm that it succeeds in unlocking the OPTCR register, but after the unlock command completes, the lock bit is set in the OPTCR register again, and the memory protection bits are unchanged. -But I'll have to do some more digging, before I am able to say what goes wrong. On Wed, 24 Dec 2014 23:37:00 +0100, Peter Stuge wrote: > Jens Bauer wrote: >> ... I think it would make sense if OpenOCD reads the OPTCR register and checks that it contains the right value. > Certainly, and anyone trying to say otherwise is not helping. I'm sadly unsurprised that the check is missing in OpenOCD. I also find it important to check the CR register right after image_write. I think it makes sense to do this after each time a sector was written, as checking it only after the last write might not catch all errors (eg. first sector protected, the rest unprotected would give no error). Further details on the OPTCR register and its value: I just found out that after each reset, the OPTCR register is changed back to 0x00AAAAE1; at least on my device. The value is different on John Frenz' device, so he might have a different revision (fortunately for me!) or the debugger he uses might initialize the OPTCR to this value by default. (This time I'm also posting to the list, eh; - I've made a second request to the developer of my mail program to include support for aliases) Love Jens ------------------------------------------------------------------------------ Dive into the World of Parallel Programming! The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net _______________________________________________ OpenOCD-devel mailing list OpenOCD-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openocd-devel