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

Support for STM32L4, SM32L1 option bytes write. #847

Merged
merged 2 commits into from
Mar 16, 2020
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
14 changes: 6 additions & 8 deletions src/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -2822,7 +2822,6 @@ static int stlink_write_option_bytes_l1(stlink_t *sl, uint8_t* base, stm32_addr_
if( data != val ) {
WLOG("Writing option bytes 0x%04x\n", data);
stlink_write_debug32(sl, addr, data);

stlink_read_debug32(sl, addr, &val);
WLOG("Option bytes is 0x%08x\n",val);
}
Expand All @@ -2839,12 +2838,11 @@ static int stlink_write_option_bytes_l1(stlink_t *sl, uint8_t* base, stm32_addr_
write_uint32((unsigned char*) &data, *(uint32_t*) (base+4));
if( data != val ) {
WLOG("Writing 2nd option bytes 0x%04x\n", data);
stlink_write_debug32(sl, addr+4, data);

stlink_read_debug32(sl, addr+4, &val);
WLOG("2nd option bytes is 0x%08x\n",val);
stlink_write_debug32(sl, addr+4, data);
stlink_read_debug32(sl, addr+4, &val);
WLOG("2nd option bytes is 0x%08x\n",val);
}
}
}

/* Reload options */
stlink_read_debug32(sl, STM32L1_FLASH_REGS_ADDR + FLASH_PECR_OFF, &val);
Expand Down Expand Up @@ -3127,8 +3125,8 @@ int stlink_write_option_bytes(stlink_t *sl, stm32_addr_t addr, uint8_t* base, ui
else if((sl->chip_id == STLINK_CHIPID_STM32_L496X) && (addr == STM32_L496X_OPTION_BYTES_BASE)) {
return stlink_write_option_bytes_l496x(sl, base, len);
}
else if( ( (sl->chip_id == STLINK_CHIPID_STM32_L152_RE) || (sl->chip_id == STLINK_CHIPID_STM32_L1_HIGH) )
&& ( (addr == STM32_L1_OPTION_BYTES_BASE) || (addr == STM32_L1_OPTION_BYTES_BASE+4) ) ) {
else if(((sl->chip_id == STLINK_CHIPID_STM32_L152_RE) || (sl->chip_id == STLINK_CHIPID_STM32_L1_HIGH) ) &&
((addr == STM32_L1_OPTION_BYTES_BASE) || (addr == STM32_L1_OPTION_BYTES_BASE+4))) {
return stlink_write_option_bytes_l1(sl, base, addr, len);
}
else {
Expand Down