- Brace yourself
sudo apt-get update
sudo apt-get install cmake
sudo apt-get install libusb-1.0-0-dev
mkdir ~/proj
cd ~/proj
git clone https://github.com/texane/stlink stlink-repo
cd stlink-repo
make
sudo apt-get update
sudo apt-get install cmake
sudo apt-get install libusb-1.0-0-dev
mkdir ~/proj
cd ~/proj
git clone https://github.com/texane/stlink stlink-repo
cd stlink-repo
make
Hello Sir,
Thank for sharing the command for install stlink in raspberry pi
but I am facing issue while writing the .bin file into my controller Stm32f103cB.
Here the command for execution,
sudo st-flash --flash=128k write /home/pi/Desktop/Spell/Bootloader.bin 0x08000000
the outcome -->
st-flash 1.6.1-109-g781557d
2020-11-09T17:40:59 INFO common.c: F1xx Medium-density: 20 KiB SRAM, 128 KiB flash in at least 1 KiB pages.
file /home/pi/Desktop/Spell/Bootloader.bin md5 checksum: 4636419d5875ac7103da4e6dc66c566, stlink checksum: 0x0006b357
2020-11-09T17:40:59 INFO common.c: Attempting to write 4572 (0x11dc) bytes to stm32 address: 134217728 (0x8000000)
2020-11-09T17:41:00 INFO common.c: Flash page at addr: 0x08000000 erased
2020-11-09T17:41:00 INFO common.c: Flash page at addr: 0x08000400 erased
2020-11-09T17:41:00 INFO common.c: Flash page at addr: 0x08000800 erased
2020-11-09T17:41:00 INFO common.c: Flash page at addr: 0x08000c00 erased
2020-11-09T17:41:00 INFO common.c: Flash page at addr: 0x08001000 erased
2020-11-09T17:41:00 INFO common.c: Finished erasing 5 pages of 1024 (0x400) bytes
2020-11-09T17:41:00 INFO common.c: Starting Flash write for VL/F0/F3/F1_XL core id
2020-11-09T17:41:00 INFO flash_loader.c: Successfully loaded flash loader in sram
5/5 pages written
2020-11-09T17:41:00 INFO common.c: Starting verification of write complete
2020-11-09T17:41:00 ERROR common.c: Verification of flash failed at offset: 0
stlink_fwrite_flash() == -1
I hope anyone helps me resolve my problem,
Because I could not erase the read-only protection bits with st-link, I switched to openocd. It installed fine on RP ( using apt-install ) and works fine: erasing, resetting read-only protection fuses, and flashing an image. Thats all I need.
The GUI version of st-link can reset the protection bits. I could however not find how to do this from the commandline version of st-link. If somebody knows if and how this can be done I would be happy to hear it.
@Joypacharya I had a similar problem:
EraseFlash - Sector:0x4 Size:0x20000 2020-12-03T13:14:56 INFO common.c: Flash page at addr: 0x08020000 er ased
EraseFlash - Sector:0x5 Size:0x40000 2020-12-03T13:14:58 INFO common.c: Flash page at addr: 0x08040000 er ased
2020-12-03T13:14:58 INFO common.c: Finished erasing 6 pages of 262144 (0x40000) bytes
2020-12-03T13:14:58 INFO common.c: Starting Flash write for F2/F4/F7/L4
2020-12-03T13:14:58 INFO flash_loader.c: Successfully loaded flash loader in sram
enabling 32-bit flash writes
size: 32768
2020-12-03T13:14:59 ERROR flash_loader.c: flash loader run error
2020-12-03T13:14:59 ERROR common.c: stlink_flash_loader_run(0x8000000) failed! == -1
stlink_fwrite_flash() == -1
I had the st-link version st-flash 1.6.1-115-g8560f93-dirty
(st-flash --version). I tried to checkout to version 1.6 and it worked!
Steps:
sudo git checkout 6aa08a6
sudo make
I hope this helps!
Thank you.