Hi Spencer,

Spencer Oliver wrote:
> On 17 January 2012 13:35, Jonathan Dumaresq <[email protected]>
> wrote: 
>> 
>> The stlinkV2. I got some of the protocol working but I could not get
>> the flash programmed. I can write to ram but could not get it work
>> with the flash. 
>> 
>> I try to disable the working area to have the jtag adapter to write
>> directly thru the register but this is not working too. I try to
>> bisect the st-link Utility but if I write to 1 word of flash or 1024
>> byte of flash they always download the flash helper in ram.
>> 
>> Until now, I can get the device reconised by openOCD with the device
>> ID. and Revision too. 
>> 
>> Regards
>> 
> 
> Looking at the datasheet it looks as if it uses the same flash
> controller as stm32f1 (stm32f1x.c).
 
Yes it is. Not 100% but really near. 

> 
> Now as you are using the stlink most of the armv6m stuff is hidden
> from OpenOCD - this is assuming the stlink correctly supports armv6m.
> I cannot see anything in the armv6m arch ref that would cause any
> problems.  
> 

OK


> The issue you will have is that stm32x_probe will not understand the
> target it finds. 
> What is returned by reading 0xE0042000 ?

The probing address is not the same. The new address is 0x40015800. But I
already add it to the stm32f1x flash driver. I just look if the device id
returned from the 0xE0042000 is 0x00000 than I read the new address and this
seem to work. 

The new device ID is 440 for the stm32f0x device. 

> 
> At this stage we will also want to disable any working areas, until
> we update the stm32x_flash_write_code for armv6m. 

Already done. 

> 
> Does a stm32x mass erase succeed?

No 

I just found that the unlocking process is not the same as the st-link do.
The stm32f1x driver only unlock the KEYR register, but the st-link unlock
both KEYR and OPTR register. After that the ST-LINK utility erase the OPT
bytes by writing to OPTER bit in CR.  And start the erase command by writing
1 to the STRT bit in CR. 

In resumé all the unlock sequence from the ST-LINK utility

READ OBR        =       0xFFFFFF00

READ WRPR       =       0xFFFF0000

READ OBR        =       0xFFFFFF00

READ 0xE000ED00  = 0x410CC200 (probably the flash size)

READ 0x40015800 =       0x10006440      (this is the Device ID)

READ SR = 0x 00000001

WRITE KEYR      = 0x45670123

WRITE KEYR      = 0xCDEF89AB

WRITE OPTKEYR   = 0x45670123

WRITE OPTKEYR   = 0xCDEF89AB

READ CR =       0x00000200

WRITE CR        =       0x00000220

WRITE CR        =       0x00000260

READ SR = 0x00000013

READ SR = 0x00000030

READ CR =       0x00000220

WRITE CR        =       0x00000200

>From there the flash should be completely unlocked. 

I will check the driver to see if I can fit something there. 

Thanx for you help

Regards

Jonathan
> 
> Cheers
> Spen



------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
OpenOCD-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to