Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't flash STM32F0 targets #594

Closed
6 tasks done
skalidindi3 opened this issue May 18, 2017 · 0 comments · Fixed by #595
Closed
6 tasks done

Can't flash STM32F0 targets #594

skalidindi3 opened this issue May 18, 2017 · 0 comments · Fixed by #595

Comments

@skalidindi3
Copy link
Contributor

skalidindi3 commented May 18, 2017

Hi,
I'm having issues trying to flash binaries onto STM32F0 targets.

  • Programmer/board type: Stlink/v2-onboard
  • Programmer firmware version: stsw-link007V2J28M18RC2
  • Operating system: Mac OS X 10.10.3
  • Stlink tools version and/or git commit hash: 0498621
  • Stlink commandline tool name: st-flash
  • Target chip (and optional board): e.g STM32F051R8T6 (STM32F0 Discovery)

st-flash Output:

$ ./st-flash write ./blinky.bin 0x8000000
st-flash 1.3.1-18-g0498621
2017-05-17T22:26:24 INFO src/common.c: Loading device parameters....
2017-05-17T22:26:24 INFO src/common.c: Device connected is: F0 device, id 0x20006440
2017-05-17T22:26:24 INFO src/common.c: SRAM size: 0x2000 bytes (8 KiB), Flash: 0x10000 bytes (64 KiB) in pages of 1024 bytes
2017-05-17T22:26:24 INFO src/common.c: Attempting to write 1008 (0x3f0) bytes to stm32 address: 134217728 (0x8000000)
Flash page at addr: 0x08000000 erased
2017-05-17T22:26:24 INFO src/common.c: Finished erasing 1 pages of 1024 (0x400) bytes
2017-05-17T22:26:24 INFO src/common.c: Starting Flash write for VL/F0/F3/F1_XL core id
2017-05-17T22:26:24 INFO src/flash_loader.c: Successfully loaded flash loader in sram
2017-05-17T22:26:27 ERROR src/flash_loader.c: flash loader run error
2017-05-17T22:26:27 ERROR src/common.c: stlink_flash_loader_run(0x8000000) failed! == -1
stlink_fwrite_flash() == -1

Expected output:

$ ./st-flash --reset write ./blinky.bin 0x8000000
st-flash 1.3.1-18-g0498621
2017-05-17T22:24:15 INFO src/common.c: Loading device parameters....
2017-05-17T22:24:15 INFO src/common.c: Device connected is: F0 device, id 0x20006440
2017-05-17T22:24:15 INFO src/common.c: SRAM size: 0x2000 bytes (8 KiB), Flash: 0x10000 bytes (64 KiB) in pages of 1024 bytes
2017-05-17T22:24:16 INFO src/common.c: Attempting to write 1008 (0x3f0) bytes to stm32 address: 134217728 (0x8000000)
Flash page at addr: 0x08000000 erased
2017-05-17T22:24:16 INFO src/common.c: Finished erasing 1 pages of 1024 (0x400) bytes
2017-05-17T22:24:16 INFO src/common.c: Starting Flash write for VL/F0/F3/F1_XL core id
2017-05-17T22:24:16 INFO src/flash_loader.c: Successfully loaded flash loader in sram
  0/0 pages written
2017-05-17T22:24:16 INFO src/common.c: Starting verification of write complete
2017-05-17T22:24:16 INFO src/common.c: Flash written and verified! jolly good!

Verbose (debug) erroneous output:

$ ./st-flash --debug write ./blinky.bin 0x8000000
st-flash 1.3.1-18-g0498621
2017-05-17T22:16:27 DEBUG src/common.c: stlink current mode: mass
2017-05-17T22:16:27 DEBUG src/common.c: stlink current mode: mass
2017-05-17T22:16:27 DEBUG src/common.c: *** stlink_enter_swd_mode ***
2017-05-17T22:16:27 DEBUG src/common.c: *** looking up stlink version
2017-05-17T22:16:27 DEBUG src/common.c: st vid         = 0x0483 (expect 0x0483)
2017-05-17T22:16:27 DEBUG src/common.c: stlink pid     = 0x3748
2017-05-17T22:16:27 DEBUG src/common.c: stlink version = 0x2
2017-05-17T22:16:27 DEBUG src/common.c: jtag version   = 0x1c
2017-05-17T22:16:27 DEBUG src/common.c: swim version   = 0x0
2017-05-17T22:16:27 DEBUG src/common.c:     notice: the firmware doesn't support a swim interface
2017-05-17T22:16:27 DEBUG src/common.c: *** stlink_jtag_reset ***
2017-05-17T22:16:27 DEBUG src/common.c: *** stlink_reset ***
2017-05-17T22:16:27 INFO src/common.c: Loading device parameters....
2017-05-17T22:16:27 DEBUG src/common.c: *** stlink_core_id ***
2017-05-17T22:16:27 DEBUG src/common.c: core_id = 0x0bb11477
2017-05-17T22:16:27 DEBUG src/common.c: *** stlink_read_debug32 0 is 0xe0042000
2017-05-17T22:16:27 DEBUG src/common.c: *** stlink_read_debug32 20006440 is 0x40015800
2017-05-17T22:16:27 DEBUG src/common.c: *** stlink_read_debug32 ffff0040 is 0x1ffff7cc
2017-05-17T22:16:27 INFO src/common.c: Device connected is: F0 device, id 0x20006440
2017-05-17T22:16:27 INFO src/common.c: SRAM size: 0x2000 bytes (8 KiB), Flash: 0x10000 bytes (64 KiB) in pages of 1024 bytes
2017-05-17T22:16:27 DEBUG src/common.c: *** set_swdclk ***
2017-05-17T22:16:27 DEBUG src/common.c: stlink current mode: debug (jtag or swd)
2017-05-17T22:16:27 DEBUG src/common.c: stlink current mode: debug (jtag or swd)
2017-05-17T22:16:27 DEBUG src/common.c: *** stlink_force_debug_mode ***
2017-05-17T22:16:27 DEBUG src/common.c: *** stlink_status ***
2017-05-17T22:16:27 DEBUG src/common.c:   core status: halted
2017-05-17T22:16:27 INFO src/common.c: Attempting to write 1008 (0x3f0) bytes to stm32 address: 134217728 (0x8000000)
2017-05-17T22:16:27 DEBUG src/common.c: *** stlink_core_id ***
data_len = 2 0x2
 77 14

2017-05-17T22:16:27 DEBUG src/common.c: core_id = 0x0bb11477
2017-05-17T22:16:27 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x4002200c
2017-05-17T22:16:27 DEBUG src/common.c: *** stlink_read_debug32 80 is 0x40022010
2017-05-17T22:16:27 DEBUG src/common.c: *** stlink_write_debug32 45670123 to 0x40022004
2017-05-17T22:16:27 DEBUG src/common.c: *** stlink_write_debug32 cdef89ab to 0x40022004
2017-05-17T22:16:27 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40022010
2017-05-17T22:16:27 DEBUG src/common.c: Successfully unlocked flash
2017-05-17T22:16:27 DEBUG src/common.c: *** stlink_write_debug32 2 to 0x40022010
2017-05-17T22:16:27 DEBUG src/common.c: *** stlink_write_debug32 8000000 to 0x40022014
2017-05-17T22:16:27 DEBUG src/common.c: *** stlink_read_debug32 2 is 0x40022010
2017-05-17T22:16:27 DEBUG src/common.c: *** stlink_write_debug32 42 to 0x40022010
2017-05-17T22:16:27 DEBUG src/common.c: *** stlink_read_debug32 3 is 0x4002200c
...
2017-05-17T22:16:27 DEBUG src/common.c: *** stlink_read_debug32 3 is 0x4002200c
2017-05-17T22:16:27 DEBUG src/common.c: *** stlink_read_debug32 20 is 0x4002200c
2017-05-17T22:16:27 DEBUG src/common.c: *** stlink_read_debug32 2 is 0x40022010
2017-05-17T22:16:27 DEBUG src/common.c: *** stlink_write_debug32 82 to 0x40022010
Flash page at addr: 0x08000000 erased
2017-05-17T22:16:27 INFO src/common.c: Finished erasing 1 pages of 1024 (0x400) bytes
2017-05-17T22:16:27 INFO src/common.c: Starting Flash write for VL/F0/F3/F1_XL core id
2017-05-17T22:16:27 DEBUG src/common.c: *** stlink_write_mem32 52 bytes to 0x20000000
2017-05-17T22:16:27 INFO src/flash_loader.c: Successfully loaded flash loader in sram
2017-05-17T22:16:27 DEBUG src/common.c: *** stlink_read_debug32 82 is 0x40022010
2017-05-17T22:16:27 DEBUG src/common.c: *** stlink_write_debug32 45670123 to 0x40022004
2017-05-17T22:16:27 DEBUG src/common.c: *** stlink_write_debug32 cdef89ab to 0x40022004
2017-05-17T22:16:27 DEBUG src/common.c: *** stlink_read_debug32 2 is 0x40022010
2017-05-17T22:16:27 DEBUG src/common.c: Successfully unlocked flash
2017-05-17T22:16:27 DEBUG src/common.c: Finished unlocking flash, running loader!
2017-05-17T22:16:27 DEBUG src/flash_loader.c: Running flash loader, write address:0x8000000, size: 1008
2017-05-17T22:16:27 DEBUG src/common.c: *** stlink_write_mem32 1008 bytes to 0x20000034
2017-05-17T22:16:27 DEBUG src/common.c: *** stlink_write_reg
data_len = 2 0x2
 80 00

2017-05-17T22:16:27 DEBUG src/common.c: *** stlink_write_reg
data_len = 2 0x2
 80 00

2017-05-17T22:16:28 DEBUG src/common.c: *** stlink_write_reg
data_len = 2 0x2
 80 00

2017-05-17T22:16:28 DEBUG src/common.c: *** stlink_write_reg
data_len = 2 0x2
 80 00

2017-05-17T22:16:28 DEBUG src/common.c: *** stlink_write_reg
data_len = 2 0x2
 80 00

2017-05-17T22:16:28 DEBUG src/common.c: *** stlink_run ***
2017-05-17T22:16:28 DEBUG src/common.c: *** stlink_status ***
2017-05-17T22:16:28 DEBUG src/common.c:   core status: running
...
2017-05-17T22:16:33 DEBUG src/common.c: *** stlink_status ***
2017-05-17T22:16:33 DEBUG src/common.c:   core status: running
2017-05-17T22:16:33 ERROR src/flash_loader.c: flash loader run error
2017-05-17T22:16:33 ERROR src/common.c: stlink_flash_loader_run(0x8000000) failed! == -1
2017-05-17T22:16:33 DEBUG src/common.c: *** stlink_read_debug32 ffffffff is 0x8000000
2017-05-17T22:16:33 DEBUG src/common.c: *** stlink_write_reg
data_len = 2 0x2
 81 00

2017-05-17T22:16:33 DEBUG src/common.c: *** stlink_read_debug32 ffffffff is 0x8000004
2017-05-17T22:16:33 DEBUG src/common.c: *** stlink_write_reg
data_len = 2 0x2
 81 00

2017-05-17T22:16:33 DEBUG src/common.c: *** stlink_run ***
stlink_fwrite_flash() == -1
2017-05-17T22:16:33 DEBUG src/common.c: *** stlink_exit_debug_mode ***
2017-05-17T22:16:33 DEBUG src/common.c: *** stlink_write_debug32 a05f0000 to 0xe000edf0
2017-05-17T22:16:33 DEBUG src/common.c: *** stlink_close ***
skalidindi3 added a commit to skalidindi3/stlink that referenced this issue May 18, 2017
Fixes issue stlink-org#594.

Pull request stlink-org#592 (0498621) accidentally deleted the call to `set_flash_cr_pg`.
@Nightwalker-87 Nightwalker-87 linked a pull request Mar 17, 2020 that will close this issue
@Nightwalker-87 Nightwalker-87 added this to the v1.4.0 milestone Mar 17, 2020
@Nightwalker-87 Nightwalker-87 linked a pull request Mar 18, 2020 that will close this issue
@stlink-org stlink-org locked as resolved and limited conversation to collaborators Apr 14, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants