From 6ce5416b7185b1dc9dd497ba9ca0c2739f81305f Mon Sep 17 00:00:00 2001 From: JackN Date: Wed, 15 Mar 2023 12:12:51 -0400 Subject: [PATCH 1/2] Slightly relax the RISC-V restriction when handling `restart` request. Allows restart, but does not re-flash. --- CHANGELOG.md | 3 +++ debugger/src/server/debugger.rs | 30 ++++++++++++++++-------------- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d76094f53e..d68b774b58 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -43,6 +43,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - probe-rs-debugger: Remove `restart-after-flashing` option, and make it the default behaviour. (#1550) +- probe-rs-debugger: Slightly relax the RISC-V restriction when handling `restart` request. Allows restart, but does not re-flash. (#) + ### Added - Added EFM32TG11B family targets #1420 @@ -55,6 +57,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Add default sequence 'debug_core_stop', which disables debugging when disconneting from ARM cores by default. (#1525) - probe-rs-debugger: Initial support for 'gdb-like' commands to be typed into VSCode Debug Console REPL. (#1552) + - The `help` command will list available commands, and arguments. - Command completions are supported for the individual commands, but not for the arguments. - Additional commands can be added in the future, as required, but will benefit from some refactoring to share code with functionality that is already implementated in `dap_adapter.rs` for MS DAP requests. diff --git a/debugger/src/server/debugger.rs b/debugger/src/server/debugger.rs index aba02df0a4..ff6fa807ce 100644 --- a/debugger/src/server/debugger.rs +++ b/debugger/src/server/debugger.rs @@ -228,24 +228,26 @@ impl Debugger { } "threads" => debug_adapter.threads(&mut target_core, &request), "restart" => { - if target_core.core.architecture() == Architecture::Riscv { + if target_core.core.architecture() == Architecture::Riscv + && self.config.flashing_config.flashing_enabled + { debug_adapter.show_message( MessageSeverity::Information, - "In-session `restart` is not currently supported for RISC-V.", + "Re-flashing the target during on-session `restart` is not currently supported for RISC-V. Flashing will be disabled for the remainder of this session.", ); - Ok(()) - } else { - // Reset RTT so that the link can be re-established - target_core.core_data.rtt_connection = None; - let result = target_core - .core - .halt(Duration::from_millis(500)) - .map_err(|error| anyhow!("Failed to halt core: {}", error)) - .and(Ok(())); - - debug_session = DebugSessionStatus::Restart(request); - result + self.config.flashing_config.flashing_enabled = false; } + + // Reset RTT so that the link can be re-established + target_core.core_data.rtt_connection = None; + let result = target_core + .core + .halt(Duration::from_millis(500)) + .map_err(|error| anyhow!("Failed to halt core: {}", error)) + .and(Ok(())); + + debug_session = DebugSessionStatus::Restart(request); + result } "setBreakpoints" => debug_adapter.set_breakpoints(&mut target_core, &request), "setInstructionBreakpoints" => { From 98cc355e7c98108947acd2bafc0f635d45c70df0 Mon Sep 17 00:00:00 2001 From: JackN Date: Wed, 15 Mar 2023 12:18:27 -0400 Subject: [PATCH 2/2] CHANGELOG --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d68b774b58..049dced666 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -43,7 +43,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - probe-rs-debugger: Remove `restart-after-flashing` option, and make it the default behaviour. (#1550) -- probe-rs-debugger: Slightly relax the RISC-V restriction when handling `restart` request. Allows restart, but does not re-flash. (#) +- probe-rs-debugger: Slightly relax the RISC-V restriction when handling `restart` request. Allows restart, but does not re-flash. (#1569) ### Added