Skip to content

Commit

Permalink
Fix verification of flash error for STM32L496x device (stlink-org#617)
Browse files Browse the repository at this point in the history
There were missing chipid checks of STM32L496xx and STM32L46x devices.
  • Loading branch information
rdlim committed Jul 15, 2017
1 parent 0c84c29 commit 97f81d6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
9 changes: 7 additions & 2 deletions src/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -1484,7 +1484,10 @@ int stlink_erase_flash_page(stlink_t *sl, stm32_addr_t flashaddr)
unlock_flash_if(sl);

/* select the page to erase */
if (sl->chip_id == STLINK_CHIPID_STM32_L4 || sl->chip_id == STLINK_CHIPID_STM32_L43X) {
if ((sl->chip_id == STLINK_CHIPID_STM32_L4) ||
(sl->chip_id == STLINK_CHIPID_STM32_L43X) ||
(sl->chip_id == STLINK_CHIPID_STM32_L46X) ||
(sl->chip_id == STLINK_CHIPID_STM32_L496X)) {
// calculate the actual bank+page from the address
uint32_t page = calculate_L4_page(sl, flashaddr);

Expand Down Expand Up @@ -1859,7 +1862,9 @@ int stlink_write_flash(stlink_t *sl, stm32_addr_t addr, uint8_t* base, uint32_t

/* TODO: Check that Voltage range is 2.7 - 3.6 V */
if ((sl->chip_id != STLINK_CHIPID_STM32_L4) &&
(sl->chip_id != STLINK_CHIPID_STM32_L43X))
(sl->chip_id != STLINK_CHIPID_STM32_L43X) &&
(sl->chip_id != STLINK_CHIPID_STM32_L46X) &&
(sl->chip_id != STLINK_CHIPID_STM32_L496X))
{
if( sl->version.stlink_v == 1 ) {
printf("STLINK V1 cannot read voltage, defaulting to 32-bit writes on F4 devices\n");
Expand Down
5 changes: 4 additions & 1 deletion src/gdbserver/gdb-server.c
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,10 @@ char* make_memory_map(stlink_t *sl) {
(unsigned int)sl->sram_size,
(unsigned int)sl->flash_size - 0x20000,
(unsigned int)sl->sys_base, (unsigned int)sl->sys_size);
} else if(sl->chip_id==STLINK_CHIPID_STM32_L4) {
} else if((sl->chip_id==STLINK_CHIPID_STM32_L4) ||
(sl->chip_id==STLINK_CHIPID_STM32_L43X) ||
(sl->chip_id==STLINK_CHIPID_STM32_L46X) ||
(sl->chip_id==STLINK_CHIPID_STM32_L496X)) {
snprintf(map, sz, memory_map_template_L4,
(unsigned int)sl->flash_size, (unsigned int)sl->flash_size);
} else {
Expand Down

0 comments on commit 97f81d6

Please sign in to comment.