DonaldBecker / arm-utilities

Automatically exported from code.google.com/p/arm-utilities
0 stars 0 forks source link

stlink-download: Timing problem after writing first block to flash #3

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
  1. Flashing a binary whose size exceeds 2048 byte

What is the expected output? What do you see instead?
  Rereading the bytes after the flash process returns 0xff
  (Verifying is not implemented, but returns 0 :-)

What version of the product are you using? On what operating system?
  arm-utilities-2011-6-28, Linux

Please provide any additional information below.

I have had a problem with a bin file whose size exceeds 2048 byte.
In my case only the first 2048 bytes were written.

There might be a timing problem while waiting for the status.
I have just added a sleep as long as the status is not STLINK_CORE_HALTED

# Before

 Writing ARM memory 0x08000000..0x08020000 from /home/mc/vc/rhaag/microcontroller/arm/stm32f100/apps/demo-gpio-basic/src/../build/demo-gpio-basic-stm32f100.bin.
Read 2324 bytes from file 
/home/mc/vc/rhaag/microcontroller/arm/stm32f100/apps/demo-gpio-basic/src/../buil
d/demo-gpio-basic-stm32f100.bin
Flash write 08000000..08000914, size 2324/914.
 SCSI residue was 4, sense length 0.
 SCSI residue was 4, sense length 0.
Flash status 00, control 0004.
Flash write: Run 1, size 2324, chunk size 2048, offset 0
 SCSI residue was 4, sense length 0.
 SCSI residue was 4, sense length 0.
Flash status 20, control 0001 status 80.

# Patched

 Writing ARM memory 0x08000000..0x08020000 from /home/mc/vc/rhaag/microcontroller/arm/stm32f100/apps/demo-gpio-basic/src/../build/demo-gpio-basic-stm32f100.bin.
Read 2324 bytes from file 
/home/mc/vc/rhaag/microcontroller/arm/stm32f100/apps/demo-gpio-basic/src/../buil
d/demo-gpio-basic-stm32f100.bin
Flash write 08000000..08000914, size 2324/0x914.
 SCSI residue was 4, sense length 0.
 SCSI residue was 4, sense length 0.
Flash status 00, control 0004.
Flash write: Run 1, size 2324, chunk size 2048, offset 0
Status is 128, sleeping ...
Flash write: Run 2, size 276, chunk size 276, offset 2048
Status is 128, sleeping ...
 SCSI residue was 4, sense length 0.
Flash write succeeded

I've attached a patch which solves the problem for me.

Original issue reported on code.google.com by goo...@ddsf.de on 2 Jul 2011 at 8:29

Attachments:

GoogleCodeExporter commented 9 years ago
I've added verify code.

I'll review the patch to see if there is additional checks I can do during the 
flash write.

Original comment by donald.b...@gmail.com on 12 Jul 2011 at 1:45