fpoussin / QStlink2

Cross-platform STLink v2 GUI
Other
187 stars 72 forks source link

Unable to program and erase on linux #20

Closed Lanchon closed 9 years ago

Lanchon commented 9 years ago

platform: linux mint 17 board: stm32f3discovery qstlink2 version: 1.2.0

$ qstlink2 -cwVv ./stock-demo.bin >write.log 2>&1 result: the first 0x800 bytes of flash are erased to 0xFF.

$ qstlink2 -cev >erase.log 2>&1 result: flash not erased.

see attached logs. write.log.txt erase.log.txt

Lanchon commented 9 years ago

program and erase bugs verified on current master compiled against Qt 5.

fpoussin commented 9 years ago

I will run some tests. Are you sure your flash option registers are clear ? (flash protection)

Lanchon commented 9 years ago

Yes, I can program the device fine with st-flash but fails with your code. I tested this repeatedly. I'm using the stlink/v2 embedded in the F3 discovery board, and i have the latest stlink firmware loaded.

EDIT: btw, shouldn't erase clear the protection? (sorry, i'm new to stm32.)

fpoussin commented 9 years ago

Ok, I will test on my F3 Discovery board. Thanks.

Lanchon commented 9 years ago

This is the file I'm programming, flashes and runs fine with: st-flash --reset write stock-demo.bin 0x8000000

It's the stock software preloaded on my F3DISCO (property of ST, license on their site).

stock-demo.zip.txt (remove the '.txt' extension)

fpoussin commented 9 years ago

Can you try with an older version of QStlink2?

sudo apt-get install qstlink2=1.1.7

Lanchon commented 9 years ago

Sorry I'm unable to test at this time. Were you not able to reproduce? EDIT: Again, this happens on master branch too.

fpoussin commented 9 years ago

I can reproduce with 1.2.0, I'm working on a fix.

fpoussin commented 9 years ago

For some reason if fails with your file, but other projects compiled with GCC are working fine. Only the first flash page is not written.

Lanchon commented 9 years ago

FYI, this file contains the stock firmware as shipped by ST and downloaded by your own tool (using PPA version 1.2.0). It can be successfully reprogrammed into the device (and then runs fine) with st-flash.

Try flashing some GCC project (works according to you), then download, then reflash. The same might probably happen. The download contains the whole flash (even unused parts). The bug might be related to the bin file being large or equal the size of the flash.

fpoussin commented 9 years ago

I found the bug, it was trying to delete an extra flash page at the end of the flash area, so it was deleting the first one instead... fixed :)

Lanchon commented 8 years ago

Thank you! What about erase not erasing, was it the same bug and also fixed?

fpoussin commented 8 years ago

I will check this one and reopen if needed. Thanks.

fpoussin commented 8 years ago

I fixed the mass erase as well.

Lanchon commented 8 years ago

Cool!