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

Fix verification of flash error for STM32L496x device (#617) #618

Merged
merged 1 commit into from
Jul 15, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 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,8 +1862,10 @@ 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");
write_flash_cr_psiz(sl, 2);
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