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

You no longer get a run button #194

Open
jonathanpallant opened this issue Jan 26, 2023 · 1 comment
Open

You no longer get a run button #194

jonathanpallant opened this issue Jan 26, 2023 · 1 comment

Comments

@jonathanpallant
Copy link
Member

jonathanpallant commented Jan 26, 2023

rust-analyser now expands the #[entry], decides that it doesn't result in a fn main() and therefore doesn't offer the run button anymore.

We need to remove references to the run button from the training.

You seem to have two options:

  1. Debug in VS Code, where you can single step, but you can't see the defmt log.
  2. Run probe-run on the console where you can see the defmt log but you can't single step.
@jonathanpallant
Copy link
Member Author

You can do this:

{
  "version": "0.2.0",
  "configurations": [
    {
      "cwd": "${workspaceRoot}",
      // TODO to debug a different program the app name ("hello") needs to be changed
      "executable": "./target/thumbv7em-none-eabihf/debug/panic",
      "name": "Debug Microcontroller (launch)",
      "request": "launch",
      "preLaunchTask": "rust: cargo build",
      "type": "cortex-debug",
      "runToMain": true,
      "configFiles": [
        "interface/jlink.cfg",
      ],
      "servertype": "openocd",
      "openOCDLaunchCommands": [
        "transport select swd",
        "source [find target/nrf52.cfg]"
      ],
      "rttConfig": {
        "enabled": true,
        "address": "auto",
        "decoders": [
          {
            "port": 0,
            "type": "console",
            "label": "Defmt RTT",
            "logfile": "${workspaceRoot}/rtt.log",
            "noprompt": true
          }
        ]
      }
    }
  ]
}

Once the debugger has started, parse the log file with defmt-print:

$ tail -F rtt.log | defmt-print -e ./target/thumbv7em-none-eabihf/debug/panic
ERROR This is the panic program.
└─ panic::__cortex_m_rt_main @ src/bin/panic.rs:19
ERROR Oh no! PanicInfo { payload: Any { .. }, message: Some(index out of bounds: the len is 3 but the index is 3), location: Location { file: "src/bin/panic.rs", line: 38, col: 13 }, can_unwind: true }
└─ panic::panic @ src/bin/panic.rs:11

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant