Skip to content

Commit

Permalink
Restored support for STM32-Clones
Browse files Browse the repository at this point in the history
-> CKS devices with Core ID 0x2ba01477
(Closes #756 #757 #761 #766 #769 #805)
  • Loading branch information
Nightwalker-87 committed Feb 20, 2020
1 parent bc068a3 commit 6692fdc
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions include/stm32.h
Expand Up @@ -9,6 +9,7 @@

// cortex core ids
#define STM32VL_CORE_ID 0x1ba01477
#define CS32VL_CORE_ID 0x2ba01477
#define STM32F7_CORE_ID 0x5ba02477

// Constant STM32 memory map figures
Expand Down
5 changes: 4 additions & 1 deletion src/common.c
Expand Up @@ -2262,7 +2262,10 @@ int stlink_write_flash(stlink_t *sl, stm32_addr_t addr, uint8_t* base, uint32_t
uint32_t flash_regs_base;
uint32_t pagesize;

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) {
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) {
flash_regs_base = STM32L0_FLASH_REGS_ADDR;
pagesize = L0_WRITE_BLOCK_SIZE;
} else {
Expand Down
1 change: 1 addition & 0 deletions src/flash_loader.c
Expand Up @@ -267,6 +267,7 @@ int stlink_flash_loader_write_to_sram(stlink_t *sl, stm32_addr_t* addr, size_t*
loader_code = loader_code_stm32l;
loader_size = sizeof(loader_code_stm32l);
} 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 ||
sl->chip_id == STLINK_CHIPID_STM32_F3_SMALL ||
Expand Down

2 comments on commit 6692fdc

@vzasukhin
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit breaks STM32F4xx flashing (see #761 (comment) ). Similar changes tried to add in #757, but this core ID also used by STM32F3xx, STM32F4xx and STM32L1xx. Correct support for CS32F103 already added in #805

@Nightwalker-87
Copy link
Member Author

@Nightwalker-87 Nightwalker-87 commented on 6692fdc Feb 26, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't confirm this when testing with my CKS32F103, which is falsely marked as STM32F103, but comes with the common Core-ID 0x2ba01477 for the CKS. So this is not working as expected in Release v1.6.0. With Release v1.6.1 I don't experience any issues anymore related to this hardware. Looking at this we deserve further investigation. I pushed a "Hotfix" to master to keep this branch working until this is finally reviewed on develop.

Please sign in to comment.