stlink: GD32F303VGT6: unknown coreid / stlink_flash_loader_init() == -1
- Programmer/board type: Stlink/v2
- Operating system: Ubuntu 18.04.1
- Stlink tools version and/or git commit hash: v1.5.1-15-g3295ab4
- Stlink commandline tool name: st-flash
- Target chip (and optional board): GD32F303VGT6
The chip erases fine, but gets the error “unknown coreid, not sure what flash loader to use, aborting! coreid: 2ba01477, chipid: 430” when it gets to the write routine.
Output:
Flash page at addr: 0x080ff800 erased
2019-02-14T18:14:06 INFO common.c: Finished erasing 512 pages of 2048 (0x800) bytes
2019-02-14T18:14:06 INFO common.c: Starting Flash write for VL/F0/F3/F1_XL core id
2019-02-14T18:14:06 ERROR flash_loader.c: unknown coreid, not sure what flash loader to use, aborting! coreid: 2ba01477, chipid: 430
2019-02-14T18:14:06 WARN flash_loader.c: Failed to write flash loader to sram!
2019-02-14T18:14:06 ERROR common.c: stlink_flash_loader_init() == -1
2019-02-14T18:14:06 DEBUG common.c: *** stlink_read_debug32 ffffffff is 0x8000000
2019-02-14T18:14:06 DEBUG common.c: *** stlink_write_reg
data_len = 2 0x2
81 00
2019-02-14T18:14:06 DEBUG common.c: *** stlink_read_debug32 ffffffff is 0x8000004
2019-02-14T18:14:06 DEBUG common.c: *** stlink_write_reg
data_len = 2 0x2
80 00
2019-02-14T18:14:06 DEBUG common.c: *** stlink_run ***
stlink_fwrite_flash() == -1
2019-02-14T18:14:06 DEBUG common.c: *** stlink_exit_debug_mode ***
2019-02-14T18:14:06 DEBUG common.c: *** stlink_write_debug32 a05f0000 to 0xe000edf0
2019-02-14T18:14:06 DEBUG common.c: *** stlink_close ***
ST-LINK Utility says:
Device ID:0x430
Device flash Size : 1 Mbytes
Device family :STM32F10xx XL-density
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 17 (9 by maintainers)
Commits related to this issue
- Restored support for STM32-Clones -> CKS devices with Core ID 0x2ba01477 (Closes #756 #757 #761 #766 #769 #805) — committed to stlink-org/stlink by Nightwalker-87 4 years ago
Hi, Sizito. Project changed a bit, but it’s quite easy to align.
Change /include/stm32.h - to look like: // cortex core ids #define STM32VL_CORE_ID 0x1ba01477 #define CS32VL_CORE_ID 0x2ba01477 #define STM32F7_CORE_ID 0x5ba02477
Change src/flash_loader.c - inside function stlink_flash_loader_write_to_sram to look like (~line 264): } else if (sl->core_id == STM32VL_CORE_ID || sl->core_id == CS32VL_CORE_ID || sl->chip_id == STLINK_CHIPID_STM32_F1_MEDIUM || sl->chip_id == STLINK_CHIPID_STM32_F3
Then you need to compile the stlink utility with those changes and it should work…
You are right here. To be honest, I could have found that out by myself, if I had taken a closer look - never mind…
I like that idea of using core-id + chip-id + reading out the manufacturer to identify boards correctly - for genuine boards as well as for clone boards. Maybe there even is a 4th parameter that can help to distinguish. One has to do some research on that. Anyway that could be an approach to avoid quite a few false identifications. However this could be hardcoded without the need for command line arguments.
The idea of having a lookup table similar to the example above put into our documentation, is also desirable from my point of view. It can be based on the listing in
/include/stlink/chipid.hand/include/stm32.h. This could also replace/doc/testedboards.mdwhich I believe is (partly) outdated. The available information from there can be included in such a table however.Hi @Nightwalker-87, I had a look at your chronology of events surrounding the CS32 chip https://github.com/texane/stlink/issues/756#issuecomment-605629968 . It’s a bit of a Comedy of Errors and would have just gone on if you hadn’t resolved it, so thanks for finally doing that.
I don’t think #805 would have fixed this, as that adds detection for a chip ID of
STLINK_CHIPID_STM32_F1_MEDIUM(0x410). From https://github.com/texane/stlink/issues/769#issue-410536487 this GD32 board has chip ID 0x430 (not 0x410) and core ID 0x2ba01477.Identifying the GD32 board by its chip ID would probably not work. The latest version of chipid.h describes the chip ID value 0x430 as belonging to an STM32F1 board
STLINK_CHIPID_STM32_F1_XL. So assigning that value to the GD32 board (a clone of an STM32F303 board) would break identification for the “STM32_F1_XL” board.We could try identifying this board by its core ID, but we know that the core ID 0x2ba01477 is problematic as different boards have this ID. That was why the fix in #757 introduced a regression in #761 .
Here’s what I could gather about these boards:
STLINK_CHIPID_STM32_F1_MEDIUM)From the issues we had it seems the IDs from clone chips are not to be trusted. Maybe we should be able to select the flash loader using command line arguments instead, as suggested here https://github.com/texane/stlink/issues/761#issuecomment-462868649 ?
An interim solution might be to identify a clone board by its core ID AND chip ID, which should hopefully be unique enough?
Hi all, I’ve faced the same problem with the CS32F103C8T6 chip, which is the clone of STM32F103C8T6.
Maybe it will be valuable for reporter, since it tooked a lot of time to figure-out what’s wrong, - I’ve added my chip’s core id in following way:
After this - all worked as expected. Since your’s chip is different, please pay attention to double check what core identifier it should clone.
Regards, Volodymyr.