Hi Paul.

The reason I made a mdw 0, is that I understood that 0x08000000 is mapped to 
0x00000000 by default.
Anyway, before I unlocked the board, All I got from OpenOCD was...

in procedure 'mdw'

...for both 'mdw 0' and 'mdw 0x08000000' (I know by now that "in procedure 
'mdw'" means 'read error' or 'access error'.
Now both shows data as 0xffffffff, which is (what I) expected.

Before going into details on the steps I used to try mass-erasing, I'd like to 
ask if this is what it's expected to be:
> flash banks
#0 : stm32f4x.flash (stm32f2x) at 0x08000000, size 0x00100000, buswidth 0, 
chipwidth 0

-I'm asking, because I'm used to working with the LPC43xx, where I defined the 
banks like this:
target/lpc43xx-backup/lpc4337.cfg:flash bank flash_a lpc2000 0x1A000000 0x80000 
0 0 $CHIPNAME.m4 lpc4300 96000 calc_checksum
target/lpc43xx-backup/lpc4337.cfg:flash bank flash_b lpc2000 0x1B000000 0x80000 
0 0 $CHIPNAME.m4 lpc4300 96000 calc_checksum

... The STM32F4 is slightly different:
target/stm32f4x.cfg:flash bank $_FLASHNAME stm32f2x 0 0 0 0 $_TARGETNAME



I've just tried the following (being careful to do it exactly the way I'm 
describing it):
---8<-----8<-----8<-----
1: Unplug the board from the USB; it now has no power.
2: Plug in the board to the USB; it's now turned on.
3: Open a terminal window and enter the following to start a server:
$ cd (my project directory)
$ openocd -f board/stm32f4discovery.cfg
4: Open a second terminal window and enter the following:
$ cd (my project directory)
$ telnet localhost 4444
(connected)
5: halt the target, in order to avoid any errors...
target state: halted
target halted due to debug-request, current mode: Handler HardFault
xPSR: 0x01000003 pc: 0xfffffffe msp: 0xffffffd8
> stm32f4x unlock 0
stm32f4x errata detected - fixing incorrect MCU_IDCODE
device id = 0x10006413
flash size = 1024kbytes
stm32f2x unlocked.
INFO: a reset or power cycle is required for the new settings to take effect.
> shutdown
6: So far, everything's OK. Unplug the board from the USB; it now has no power
7: Plug in the board to the USB; it's now turned on.
8: In the first window, start the server again:
$ openocd -f board/stm32f4discovery.cfg
9: In the second window, telnet into the server:
$ telnet localhost 4444
10: halt the target, in order to avoid the 'target not halted' error.
> halt
11: try mass-erasing:
> stm32f4x mass_erase 0
stm32f4x errata detected - fixing incorrect MCU_IDCODE
device id = 0x10006413
flash size = 1024kbytes
stm32x device protected
stm32x mass erase failed
Runtime Error: embedded:startup.tcl:525: 
in procedure 'stm32f4x' 
in procedure 'stm32f2x' called at file "embedded:startup.tcl", line 525
--->8----->8----->8-----

... Repeating the above with 'reset halt' instead of unplugging the USB cable:

---8<-----8<-----8<-----
1: Plug in the board
2: Open WIndow 1 and start the server:
$ openocd -f board/stm32f4discovery.cfg
3: Open Window 2 and telnet into the server:
> halt
target state: halted
target halted due to debug-request, current mode: Handler HardFault
xPSR: 0x01000003 pc: 0xfffffffe msp: 0xffffffd8
> stm32f4x unlock 0
stm32f4x errata detected - fixing incorrect MCU_IDCODE
device id = 0x10006413
flash size = 1024kbytes
stm32f2x unlocked.
INFO: a reset or power cycle is required for the new settings to take effect.
> reset halt
target state: halted
target halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0xfffffffe msp: 0xfffffffc
> stm32f4x mass_erase 0
stm32x device protected
stm32x mass erase failed
Runtime Error: embedded:startup.tcl:525: 
in procedure 'stm32f4x' 
in procedure 'stm32f2x' called at file "embedded:startup.tcl", line 525
--->8----->8----->8-----

The first part of my linker-script(s) look like the following:

---8<-----8<-----8<-----
/* Linker script for STM32F407xG. */

MEMORY
{
  flash     (rx)  : ORIGIN = 0x08000000, LENGTH = 1024K /* FLASH EPROM bank */
}

INCLUDE linker-scripts/stm32f407.ld

--->8----->8<-----8<----  :)
/* Linker script for STM32F407. */

MEMORY
{
  sram0     (rwx) : ORIGIN = 0x20000000, LENGTH = 112K  /* 128KB data+code SRAM 
*/
  sram1     (rw)  : ORIGIN = 0x2001C000, LENGTH = 16K   /* 16KB data only SRAM 
*/
  sram2     (rw)  : ORIGIN = 0x10000000, LENGTH = 64K   /* 64KB CCM data only 
SRAM [CCM = Core Coupled Memory] */
}

_stack_end = 0x20020000;                                /* define a global 
symbol called _stack_end, which points to the end of SRAM */

INCLUDE linker-scripts/stm32f4xx.ld
--->8----->8----->8-----


Love
Jens

On Mon, 22 Dec 2014 09:13:03 +0300, Paul Fertser wrote:
> Hey Jens,
> 
> On Mon, Dec 22, 2014 at 04:58:02AM +0100, Jens Bauer wrote:
>>> halt                 
>>> stm32f4x unlock 0    
>> stm32f4x errata detected - fixing incorrect MCU_IDCODE
>> device id = 0x10006413
>> flash size = 1024kbytes
>> stm32f2x unlocked.
>> INFO: a reset or power cycle is required for the new settings to 
>> take effect.
>>> mdw 0 1000
> 
> This is not a correct address, flash is mapped to 0x08000000 on
> stm32s. Please make sure you have an appropriate linking script
> too. After unlocking _and_ power-cycling you should be able to perform
> mass erase and flashing.
> 
> HTH
> 
> -- 
> Be free, use free (http://www.gnu.org/philosophy/free-sw.html) software!
> mailto:fercer...@gmail.com

------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk
_______________________________________________
OpenOCD-devel mailing list
OpenOCD-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to