WCH-Link erase command doesn't erase the whole chip, as initially thought. It only erases the program memory segment.
The boot segment appears to be left untouched.
This commit is contained in:
@@ -57,6 +57,11 @@ namespace DebugToolDrivers::Wch
|
||||
this->targetConfig
|
||||
}
|
||||
)
|
||||
, programSegmentDescriptor(
|
||||
this->targetDescriptionFile.getSystemAddressSpaceDescriptor().getMemorySegmentDescriptor(
|
||||
"internal_program_memory"
|
||||
)
|
||||
)
|
||||
, flashProgramOpcodes(
|
||||
WchLinkDebugInterface::getFlashProgramOpcodes(
|
||||
this->targetDescriptionFile.getProperty("wch_link_interface", "programming_opcode_key").value
|
||||
@@ -352,11 +357,11 @@ namespace DebugToolDrivers::Wch
|
||||
const TargetAddressSpaceDescriptor& addressSpaceDescriptor,
|
||||
const TargetMemorySegmentDescriptor& memorySegmentDescriptor
|
||||
) {
|
||||
if (memorySegmentDescriptor.type == TargetMemorySegmentType::FLASH) {
|
||||
return this->eraseFlashMemory();
|
||||
if (memorySegmentDescriptor == this->programSegmentDescriptor) {
|
||||
return this->wchLinkInterface.eraseProgramMemory();
|
||||
}
|
||||
|
||||
throw Exception{"Erasing non-flash memory not supported in WchLinkDebugInterface"};
|
||||
// Ignore other (non-program memory) erase requests, for now.
|
||||
}
|
||||
|
||||
void WchLinkDebugInterface::enableProgrammingMode() {
|
||||
@@ -471,10 +476,6 @@ namespace DebugToolDrivers::Wch
|
||||
this->softwareBreakpointRegistry.remove(softwareBreakpoint);
|
||||
}
|
||||
|
||||
void WchLinkDebugInterface::eraseFlashMemory() {
|
||||
this->wchLinkInterface.eraseChip();
|
||||
}
|
||||
|
||||
std::span<const unsigned char> WchLinkDebugInterface::getFlashProgramOpcodes(const std::string& key) {
|
||||
if (key == "op1") {
|
||||
return FlashProgramOpcodes::FLASH_OP1;
|
||||
|
||||
Reference in New Issue
Block a user