SmartArduino / WiFiMCU

WiFiCMU-v0.9.8-pre release
https://github.com/SmartArduino/WiFiMCU
123 stars 65 forks source link

How to back up with ST-Link v2? #14

Closed gtalusan closed 8 years ago

gtalusan commented 8 years ago

I have an ST-Link attached to GND, Vin, D5, and D6.

I'm trying to back up the flash using this command:

$ st-flash --reset read out.bin 0x8000000
2016-02-08T18:09:36 INFO src/stlink-common.c: Loading device parameters....
2016-02-08T18:09:36 INFO src/stlink-common.c: Device connected is: F4 device (low power) - stm32f411re, id 0x10006431
2016-02-08T18:09:36 INFO src/stlink-common.c: SRAM size: 0x20000 bytes (128 KiB), Flash: 0x80000 bytes (512 KiB) in pages of 16384 bytes

I expect the file to be about 512KiB according to the debug messages above, but it outputs about 320KiB:

$ la -la out.bin 
-rwx------ 1 george george 322297 Feb  8 18:09 out.bin

If I read the flash memory to file again, I get the same sized file but the MD5's are different.

$ md5sum out*
859ee1eb340355c99f9d63c69bb05a74  out2.bin
177c0bcb1e3fcdc2dacebcc174abd184  out.bin

What is the correct procedure using ST-Link to back up the firmware?

SmartArduino commented 8 years ago

We tested this using Jlink with SEGGER J-Flash V4.98e, it worked fine. st-link has not been tested. The chip of WiFiMCU is stm32f411ce, so, bascially, the operation is normal as the smt32f4 serials.

gtalusan commented 8 years ago

Thanks, I'm finding bugs in the open source st-link software and possibly a hardware issue with my eBay ST-Link dongle.