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

STM32L011G4 flash error (unknown coreid, write_half_pages failed) #564

Closed
5 tasks done
zakqwy opened this issue Mar 2, 2017 · 9 comments · Fixed by #572
Closed
5 tasks done

STM32L011G4 flash error (unknown coreid, write_half_pages failed) #564

zakqwy opened this issue Mar 2, 2017 · 9 comments · Fixed by #572

Comments

@zakqwy
Copy link
Contributor

zakqwy commented Mar 2, 2017

  • Programmer/board type: Stlink/v2-onboard (STM32F030 Discovery Board)
  • Operating system: Linux Mint 17.2
  • stlink version: v1.3.1/git-6f24bde
  • stlink commandline tool name: st-flash
  • Target chip: STM32L011G4

I am attempting to flash a simple 'hello-world' type LED blink program onto a bodged together STM32L011G4-based board, using my STM32F030 Discovery Board's on-board Stlink/v2.

Command: $ make helloworld.stlink-flash

Output:

FLASH helloworld.bin
st-flash 1.3.1
2017-03-02T16:27:46 INFO src/common.c: Loading device parameters....
2017-03-02T16:27:46 INFO src/common.c: Device connected is: L011 device, id 0x10086457
2017-03-02T16:27:46 INFO src/common.c: SRAM size: 0x800 bytes (2 KiB), Flash: 0x4000 bytes (16 KiB) in pages of 128 bytes
2017-03-02T16:27:46 INFO src/common.c: Attempting to write 480 (0x1e0) bytes to stm32 address: 134217728 (0x8000000)
Flash page at addr: 0x08000180 erased
2017-03-02T16:27:46 INFO src/common.c: Finished erasing 4 pages of 128 (0x80) bytes
2017-03-02T16:27:46 INFO src/common.c: Starting Half page flash write for STM32L core id
2017-03-02T16:27:46 ERROR src/flash_loader.c: unknown coreid, not sure what flash loader to use, aborting! coreid: bc11477, chipid: 457
2017-03-02T16:27:46 WARN src/flash_loader.c: Failed to write flash loader to sram!
2017-03-02T16:27:46 WARN src/common.c: stlink_flash_loader_init() == -1
2017-03-02T16:27:46 WARN src/common.c:
write_half_pages failed == -1
2/ 3 pages written
2017-03-02T16:27:46 INFO src/common.c: Starting verification of write complete
2017-03-02T16:27:46 ERROR src/common.c: Verification of flash failed at offset: 0
stlink_fwrite_flash() == -1
make: *** [helloworld.stlink-flash] Error 255

I got the same error using st-util and uploading the file manually. One thing I did notice -- when I first attempted to flash the chip the SRAM size was set to 0x4000 (i.e. 16 KiB); this was incorrect for the STM32L0 I am using so I changed line 455 of chipid.c to .sram_size = 0x800, and rebuilt the program. The flash memory size is correct for the G4 version.

I tried running st-flash erase and it seemed to work fine -- all 128 pages erased. I also tried shorting the BOOT0 pin (pin 1) to VCC and resetting the chip a few times, as suggested by other users experiencing similar-looking problems. This didn't seem to have any effect on subsequent programming attempts.

Perusing common.c I did notice the following lines (ln 1835-1836):
else if (sl->flash_type == STLINK_FLASH_TYPE_L0) {
/* use fast word write. todo: half page. */

Does this mean that the half page write mode isn't implemented and I just need to switch over to programming by word? I looked around for an option to do this but I couldn't find one.

@zakqwy
Copy link
Contributor Author

zakqwy commented Mar 3, 2017

Update: I realized that the commands I used above are specific to the libopencm3 examples. Here is the somewhat lengthy output of st-flash attempting to directly program a binary file with debug enabled:

$ st-flash --debug write helloworld.bin 0x8000000

st-flash 1.3.1
2017-03-03T09:53:13 DEBUG src/common.c: stlink current mode: mass
2017-03-03T09:53:13 DEBUG src/common.c: stlink current mode: mass
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_enter_swd_mode ***
2017-03-03T09:53:13 DEBUG src/common.c: *** looking up stlink version
2017-03-03T09:53:13 DEBUG src/common.c: st vid         = 0x0483 (expect 0x0483)
2017-03-03T09:53:13 DEBUG src/common.c: stlink pid     = 0x3748
2017-03-03T09:53:13 DEBUG src/common.c: stlink version = 0x2
2017-03-03T09:53:13 DEBUG src/common.c: jtag version   = 0xe
2017-03-03T09:53:13 DEBUG src/common.c: swim version   = 0x0
2017-03-03T09:53:13 DEBUG src/common.c:     notice: the firmware doesn't support a swim interface
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_jtag_reset ***
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_reset ***
2017-03-03T09:53:13 INFO src/common.c: Loading device parameters....
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_core_id ***
2017-03-03T09:53:13 DEBUG src/common.c: core_id = 0x0bc11477
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0xe0042000
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 10086457 is 0x40015800
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 3a80010 is 0x1ff8007c
2017-03-03T09:53:13 INFO src/common.c: Device connected is: L011 device, id 0x10086457
2017-03-03T09:53:13 INFO src/common.c: SRAM size: 0x800 bytes (2 KiB), Flash: 0x4000 bytes (16 KiB) in pages of 128 bytes
2017-03-03T09:53:13 DEBUG src/common.c: *** set_swdclk ***
2017-03-03T09:53:13 DEBUG src/common.c: stlink current mode: debug (jtag or swd)
2017-03-03T09:53:13 DEBUG src/common.c: stlink current mode: debug (jtag or swd)
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_force_debug_mode ***
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_status ***
2017-03-03T09:53:13 DEBUG src/common.c:   core status: halted
2017-03-03T09:53:13 INFO src/common.c: Attempting to write 480 (0x1e0) bytes to stm32 address: 134217728 (0x8000000)
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_core_id ***
data_len = 2 0x2
 77 14

2017-03-03T09:53:13 DEBUG src/common.c: core_id = 0x0bc11477
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c04
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 208 to 0x40023c04
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 0 to 0x8000000
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c04
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 7 to 0x40023c04
Flash page at addr: 0x08000000 erased2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c04
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 208 to 0x40023c04
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 0 to 0x8000080
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c04
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 7 to 0x40023c04
Flash page at addr: 0x08000080 erased2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c04
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 208 to 0x40023c04
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 0 to 0x8000100
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c04
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 7 to 0x40023c04
Flash page at addr: 0x08000100 erased2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c04
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 208 to 0x40023c04
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 0 to 0x8000180
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c04
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 7 to 0x40023c04
Flash page at addr: 0x08000180 erased
2017-03-03T09:53:13 INFO src/common.c: Finished erasing 4 pages of 128 (0x80) bytes
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 89abcdef to 0x40023c0c
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 2030405 to 0x40023c0c
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c04
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 8c9daebf to 0x40023c10
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 13141516 to 0x40023c10
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c04
2017-03-03T09:53:13 INFO src/common.c: Starting Half page flash write for STM32L core id
2017-03-03T09:53:13 ERROR src/flash_loader.c: unknown coreid, not sure what flash loader to use, aborting! coreid: bc11477, chipid: 457
2017-03-03T09:53:13 WARN src/flash_loader.c: Failed to write flash loader to sram!
2017-03-03T09:53:13 WARN src/common.c: stlink_flash_loader_init() == -1
2017-03-03T09:53:13 WARN src/common.c: 
write_half_pages failed == -1
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 20000800 to 0x8000000
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 8000165 to 0x8000004
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 8000163 to 0x8000008
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 8000161 to 0x800000c
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 0 to 0x8000010
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 0 to 0x8000014
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 0 to 0x8000018
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 0 to 0x800001c
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 0 to 0x8000020
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 0 to 0x8000024
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 0 to 0x8000028
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 8000163 to 0x800002c
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 0 to 0x8000030
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 0 to 0x8000034
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 8000163 to 0x8000038
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 8000163 to 0x800003c
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 8000161 to 0x8000040
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 8000161 to 0x8000044
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 8000161 to 0x8000048
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 8000161 to 0x800004c
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 8000161 to 0x8000050
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 8000161 to 0x8000054
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 8000161 to 0x8000058
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 8000161 to 0x800005c
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 8000161 to 0x8000060
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 8000161 to 0x8000064
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 8000161 to 0x8000068
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 8000161 to 0x800006c
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 8000161 to 0x8000070
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 8000161 to 0x8000074
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 8000161 to 0x8000078
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
  0/  3 pages written2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 8000161 to 0x800007c
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 8000161 to 0x8000080
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 8000161 to 0x8000084
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 8000161 to 0x8000088
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 8000161 to 0x800008c
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 8000161 to 0x8000090
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 8000161 to 0x8000094
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 8000161 to 0x8000098
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 8000161 to 0x800009c
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 8000161 to 0x80000a0
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 8000161 to 0x80000a4
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 8000161 to 0x80000a8
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 8000161 to 0x80000ac
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 8000161 to 0x80000b0
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 8000161 to 0x80000b4
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 8000161 to 0x80000b8
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 8000161 to 0x80000bc
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 4809b508 to 0x80000c0
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 f83cf000 to 0x80000c4
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 21014808 to 0x80000c8
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 23202200 to 0x80000cc
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 f818f000 to 0x80000d0
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 21204805 to 0x80000d4
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 f80cf000 to 0x80000d8
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 46c04b04 to 0x80000dc
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 2b003b01 to 0x80000e0
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 e7f5d1fb to 0x80000e4
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 581 to 0x80000e8
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 50000400 to 0x80000ec
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 186a0 to 0x80000f0
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 69431c0a to 0x80000f4
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 400b439a to 0x80000f8
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
  1/  3 pages written2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 4313041b to 0x80000fc
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 47706183 to 0x8000100
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 2500b5f7 to 0x8000104
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 68c76804 to 0x8000108
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 93019100 to 0x800010c
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 41299901 to 0x8000110
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 d50d07cb to 0x8000114
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 6e2103 to 0x8000118
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 43c940b1 to 0x800011c
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 46a4400c to 0x8000120
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 1c11400f to 0x8000124
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 46639c00 to 0x8000128
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 40b140b4 to 0x800012c
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 430f431c to 0x8000130
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 2d103501 to 0x8000134
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 6004d1ea to 0x8000138
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 bdf760c7 to 0x800013c
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 9424b06 to 0x8000140
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 1c0118d2 to 0x8000144
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 4019231f to 0x8000148
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 408b3b1e to 0x800014c
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 b5101c18 to 0x8000150
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 43206814 to 0x8000154
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 bd106010 to 0x8000158
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 40021000 to 0x800015c
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 4770e7fe to 0x8000160
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 4b142200 to 0x8000164
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 48154914 to 0x8000168
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 185118d3 to 0x800016c
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 d2034283 to 0x8000170
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 32046809 to 0x8000174
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 e7f46019 to 0x8000178
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
  2/  3 pages written2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 42934a11 to 0x800017c
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 2200d203 to 0x8000180
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 3304601a to 0x8000184
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 4c0fe7f8 to 0x8000188
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 429c4b0f to 0x800018c
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 cc08d202 to 0x8000190
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 e7f94798 to 0x8000194
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 4b0e4c0d to 0x8000198
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 d202429c to 0x800019c
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 4798cc08 to 0x80001a0
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 f7ffe7f9 to 0x80001a4
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 4c0bff8b to 0x80001a8
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 429c4b0b to 0x80001ac
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 cc08d202 to 0x80001b0
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 e7f94798 to 0x80001b4
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 20000000 to 0x80001b8
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 80001e0 to 0x80001bc
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 20000000 to 0x80001c0
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 20000000 to 0x80001c4
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 80001e0 to 0x80001c8
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 80001e0 to 0x80001cc
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 80001e0 to 0x80001d0
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 80001e0 to 0x80001d4
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 80001e0 to 0x80001d8
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 80001e0 to 0x80001dc
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c18

2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x40023c04
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 7 to 0x40023c04
2017-03-03T09:53:13 INFO src/common.c: Starting verification of write complete
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_mem32 ***
data_len = 128 0x80
 15 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

2017-03-03T09:53:13 ERROR src/common.c: Verification of flash failed at offset: 0
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x8000000
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_reg
data_len = 2 0x2
 80 00

2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x8000004
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_reg
data_len = 2 0x2
 80 00

2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_run ***
stlink_fwrite_flash() == -1
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_exit_debug_mode ***
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_write_debug32 a05f0000 to 0xe000edf0
2017-03-03T09:53:13 DEBUG src/common.c: *** stlink_close ***

@xor-gate
Copy link
Member

xor-gate commented Mar 3, 2017

I have added the STM32L011 but not 100% tested (only tested probe). Probably the configuration is broken (needs to verified against datasheet which I did not yet):
https://github.com/texane/stlink/blob/master/src/chipid.c#L448-L458

See also: https://github.com/pavelrevak/pystlink/blob/master/lib/stm32devices.py#L82-L92

@xor-gate xor-gate added this to the Unplanned (Contributions Welcome) milestone Mar 3, 2017
@zakqwy
Copy link
Contributor Author

zakqwy commented Mar 3, 2017

Thanks @xor-gate. I double-checked the chipid values against the datasheet and made one more change per table 3 from RM0377:

.bootrom_base = 0x1ff00000

However after rebuilding I still got the same error. I'll keep looking into the issue.

@xor-gate
Copy link
Member

xor-gate commented Mar 3, 2017

Ping @gluedig, @mcoquelin-stm32 could you verify this (if you have a target?). I'm not familiar with the current flash loaders.

@xor-gate
Copy link
Member

xor-gate commented Mar 3, 2017

Probably @tomdeboer has also some thoughts as he had some commit history on the L0 flash loaders.

@zakqwy
Copy link
Contributor Author

zakqwy commented Mar 15, 2017

Okay, I think I've got a fix for this. In common.h, there are a number of if statements that check chip_id and set flash_regs_base. The statements default to STM32L_FLASH_REGS_ADDRif the chip_id doesn't match the query, which is the wrong address for the STM32L011 series (it should be STM32L0_FLASH_REGS_ADDR). I updated the appropriate lines to:
if (sl->chip_id == STLINK_CHIPID_STM32_L0 || sl->chip_id == STLINK_CHIPID_STM32_L0_CAT5 || sl->chip_id == STLINK_CHIPID_STM32_L0_CAT2 || sl->chip_id == STLINK_CHIPID_STM32_L011). Locations in common.c: here, here, here.

@xor-gate
Copy link
Member

@zakqwy you may propose a pull request and get free credits :+)

@zakqwy
Copy link
Contributor Author

zakqwy commented Mar 15, 2017

done. @xor-gate feel free to edit the PR, it's (ahem) my first.

@xor-gate
Copy link
Member

Thanks, feel free to open a new issue or PR when something is not working as expected. Thank you for your contribution!

@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