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

Fixing verification fail for chip ID L4RX #839

Merged
merged 1 commit into from
Oct 11, 2019
Merged
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
10 changes: 6 additions & 4 deletions src/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -1659,7 +1659,8 @@ int stlink_erase_flash_page(stlink_t *sl, stm32_addr_t flashaddr)
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)) {
(sl->chip_id == STLINK_CHIPID_STM32_L496X) ||
(sl->chip_id == STLINK_CHIPID_STM32_L4RX)) {
// calculate the actual bank+page from the address
uint32_t page = calculate_L4_page(sl, flashaddr);

Expand Down Expand Up @@ -1779,11 +1780,11 @@ int stlink_erase_flash_page(stlink_t *sl, stm32_addr_t flashaddr)
if (sl->flash_type == STLINK_FLASH_TYPE_WB) {
uint32_t flash_page = ((flashaddr - STM32_FLASH_BASE) / sl->flash_pgsz);
stlink_read_debug32(sl, STM32WB_FLASH_CR, &val);

// sec 3.10.5 - PNB[7:0] is offset by 3.
val &= ~(0xFF << 3); // Clear previously set page number (if any)
val |= ((flash_page & 0xFF) << 3);

stlink_write_debug32(sl, STM32WB_FLASH_CR, val);
} else if (sl->flash_type == STLINK_FLASH_TYPE_G0) {
uint32_t flash_page = ((flashaddr - STM32_FLASH_BASE) / sl->flash_pgsz);
Expand Down Expand Up @@ -2086,7 +2087,8 @@ int stlink_write_flash(stlink_t *sl, stm32_addr_t addr, uint8_t* base, uint32_t
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)) {
(sl->chip_id != STLINK_CHIPID_STM32_L496X) &&
(sl->chip_id != STLINK_CHIPID_STM32_L4RX)) {

if( sl->version.stlink_v == 1 ) {
printf("STLINK V1 cannot read voltage, defaulting to 32-bit writes on F4 devices\n");
Expand Down