Skip to content

Commit

Permalink
Disable debug mode and add comment for Issue esa-tu-darmstadt#296
Browse files Browse the repository at this point in the history
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`.
  • Loading branch information
zyno42 committed Mar 18, 2022
1 parent 335d715 commit 5161212
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 11 deletions.
21 changes: 12 additions & 9 deletions runtime/examples/Rust/tapasco-debug/src/app.rs
Expand Up @@ -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 {})?;

Expand All @@ -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");
Expand Down Expand Up @@ -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 {
Expand Down
8 changes: 6 additions & 2 deletions runtime/examples/Rust/tapasco-debug/src/main.rs
Expand Up @@ -25,8 +25,11 @@ type Result<T, E = Error> = std::result::Result<T, E>;

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 {
Expand All @@ -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 {},
}
Expand Down

0 comments on commit 5161212

Please sign in to comment.