From 51612127ff96e480f32976894219d40cba2a4187 Mon Sep 17 00:00:00 2001 From: zyno42 <83068959+zyno42@users.noreply.github.com> Date: Mon, 14 Mar 2022 17:53:54 +0100 Subject: [PATCH] Disable debug mode and add comment for Issue #296 Also leave some instructions on how to enable it again. Debug mode is currently the same as unsafe mode due to libtapasco not handling this case of access mode. Additionally, the DMA Buffers, Interrupts, etc. are also allocated in Monitor Mode which leads to the problem that you have to start your other runtime twice. For this case I've added a comment in the help section of `tapasco-debug`. --- .../examples/Rust/tapasco-debug/src/app.rs | 21 +++++++++++-------- .../examples/Rust/tapasco-debug/src/main.rs | 8 +++++-- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/runtime/examples/Rust/tapasco-debug/src/app.rs b/runtime/examples/Rust/tapasco-debug/src/app.rs index 47caddae..b2fd9cd7 100644 --- a/runtime/examples/Rust/tapasco-debug/src/app.rs +++ b/runtime/examples/Rust/tapasco-debug/src/app.rs @@ -65,7 +65,7 @@ impl<'a> App<'a> { // Get Tapasco Loadable Linux Kernel Module let tlkm = TLKM::new().context(TLKMInit {})?; // Allocate the device with the given ID - let mut tlkm_device = tlkm + let tlkm_device = tlkm .device_alloc(device_id, &HashMap::new()) .context(TLKMInit {})?; @@ -77,13 +77,14 @@ impl<'a> App<'a> { // no special access is necessary. This is a no-op. "Monitor" } - AccessMode::Debug {} => { - // Change device access to exclusive to be able to acquire PEs - tlkm_device - .change_access(tapasco::tlkm::tlkm_access::TlkmAccessExclusive) - .context(DeviceInit {})?; - "Debug" - } + // TODO: 3. When Issue #296 is fixed, enable debug mode here again, too. + //AccessMode::Debug {} => { + // // Change device access to exclusive to be able to acquire PEs + // tlkm_device + // .change_access(tapasco::tlkm::tlkm_access::TlkmAccessExclusive) + // .context(DeviceInit {})?; + // "Debug" + //} AccessMode::Unsafe {} => { // Change device access to exclusive to be able to acquire PEs warn!("Running in Unsafe Mode"); @@ -277,7 +278,9 @@ impl<'a> App<'a> { if self.tabs.index == 0 { match self.access_mode { AccessMode::Monitor {} => {} - AccessMode::Debug {} | AccessMode::Unsafe {} => { + // TODO: 4. Replace the second next line with the next line: + // AccessMode::Debug {} | AccessMode::Unsafe {} => { + AccessMode::Unsafe {} => { match self.input_mode { InputMode::Normal => { match self.focus { diff --git a/runtime/examples/Rust/tapasco-debug/src/main.rs b/runtime/examples/Rust/tapasco-debug/src/main.rs index b66fc902..a36a91a2 100644 --- a/runtime/examples/Rust/tapasco-debug/src/main.rs +++ b/runtime/examples/Rust/tapasco-debug/src/main.rs @@ -25,8 +25,11 @@ type Result = std::result::Result; use structopt::StructOpt; +// TODO: 1. When issue #296 is fixed, remove the paragraph about the `EMFILE` error. /// The interactive `TaPaSCo` Debugger can be used to retrieve information about the loaded /// bitstream, monitor other `TaPaSCo` runtimes and write values to the registers of your PEs +/// +/// Currently due to a `libtapasco` bug where DMA Buffers, Interrupts, etc. are allocated even in monitor mode, you will have to start your other runtime twice, where the first time the `EMFILE` error is to be expected. #[derive(StructOpt, Debug)] #[structopt(rename_all = "kebab-case")] struct Opt { @@ -43,8 +46,9 @@ struct Opt { pub enum Command { /// Enter Monitor Mode where values cannot be modified, e.g. to monitor another runtime Monitor {}, - /// Enter Debug Mode where values can only be modified interactively in this debugger - Debug {}, + // TODO: 2. When issue #296 is fixed, enable debug mode again. + // /// Enter Debug Mode where values can only be modified interactively in this debugger + // Debug {}, /// Enter Unsafe Mode where values can be modified by this debugger and another runtime Unsafe {}, }