Hi all,
I have a problem with using OpenOCD to access flash memory in STM32F4
discovery MB997C. The same setup and commands work perfectly well with
the older revision of the board (i.e. MB997B). When using flash
autodetection, OpenOCD detects 8192kB of flash (the MCU has 1024kB
according to the specification) contained into over 60 sectors of which
only 12 first sectors are consistent with the datasheet. Moreover, the
'stm32f2x unlock 0' and 'flash protect 0 0 last off' commands success
most times, but then writing to flash fails in the erase phase with
'stm32x device protected' message.
I tried setting the flash memory size to a fixed value of 1024kB. It
shows only the proper sectors then, but I'm still unable to access the
flash.
> reset halt
target state: halted
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x08000188 msp: 00000000
> flash info 0
device id = 0x10016413
ignoring flash probed value, using configured bank size
flash size = 1024kbytes
#0 : stm32f2x at 0x08000000, size 0x00100000, buswidth 0, chipwidth 0
# 0: 0x00000000 (0x4000 16kB) not protected
# 1: 0x00004000 (0x4000 16kB) not protected
# 2: 0x00008000 (0x4000 16kB) not protected
# 3: 0x0000c000 (0x4000 16kB) not protected
# 4: 0x00010000 (0x10000 64kB) not protected
# 5: 0x00020000 (0x20000 128kB) not protected
# 6: 0x00040000 (0x20000 128kB) not protected
# 7: 0x00060000 (0x20000 128kB) not protected
# 8: 0x00080000 (0x20000 128kB) not protected
# 9: 0x000a0000 (0x20000 128kB) not protected
# 10: 0x000c0000 (0x20000 128kB) not protected
# 11: 0x000e0000 (0x20000 128kB) not protected
STM32F4xx - Rev: Z
> flash write_image erase unlock test.hex
auto erase enabled
auto unlock enabled
stm32x device protected
failed erasing sectors 0 to 0
in procedure 'flash'
> flash info 0
Device Security Bit Set
#0 : stm32f2x at 0x08000000, size 0x00100000, buswidth 0, chipwidth 0
# 0: 0x00000000 (0x4000 16kB) protected
# 1: 0x00004000 (0x4000 16kB) protected
# 2: 0x00008000 (0x4000 16kB) protected
# 3: 0x0000c000 (0x4000 16kB) protected
# 4: 0x00010000 (0x10000 64kB) protected
# 5: 0x00020000 (0x20000 128kB) protected
# 6: 0x00040000 (0x20000 128kB) protected
# 7: 0x00060000 (0x20000 128kB) protected
# 8: 0x00080000 (0x20000 128kB) protected
# 9: 0x000a0000 (0x20000 128kB) protected
# 10: 0x000c0000 (0x20000 128kB) protected
# 11: 0x000e0000 (0x20000 128kB) protected
STM32F4xx - Rev: Z
>
Writing to flash with ST-LINK Utility works. I also tried setting
Option bytes in the software, but it makes no noticeable difference in
OpenOCD. Upgrading the ST-LINK firmware doesn't help either.
I tried both resetting and power cycling the MCU after 'stm32f2x
unlock 0' command. Power-cycling does nothing, but after that command
and 'reset init' right after, the next flash accessing command doesn't
output 'Device Security Bit Set'.
There is a log of stdout & stderr of 'openocd -f
/usr/share/openocd/scripts/board/stm32f4discovery.cfg -d3'
http://mtbg.eu/oocd.log
And the corresponding telnet on port 4444 log:
http://mtbg.eu/oocd-telnet.log
Best regards,
mtbg
------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60133471&iu=/4140/ostg.clktrk
_______________________________________________
OpenOCD-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openocd-devel