You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am looking to set up a development environment for the raspberry pi pico using the pi pico debug adapter together with probe-rs. I succeeded to get it working in astrovim as described in the wiki:
return {
"mfussenegger/nvim-dap"
opts = function()
local dap = require("dap")
if not dap.adapters then dap.adapters = {} end
dap.adapters["probe-rs-debug"] = {
type = "server",
port = "${port}",
executable = {
command = vim.fn.expand "$HOME/.cargo/bin/probe-rs",
args = { "dap-server", "--port", "${port}" },
},
}
-- Connect the probe-rs-debug with rust files. Configuration of the debugger is done via project_folder/.vscode/launch.json
require("dap.ext.vscode").type_to_filetypes["probe-rs-debug"] = { "rust" }
-- Set up of handlers for RTT and probe-rs messages.
-- In addition to nvim-dap-ui I write messages to a probe-rs.log in project folder
-- If RTT is enabled, probe-rs sends an event after init of a channel. This has to be confirmed or otherwise probe-rs wont sent the rtt data.
dap.listeners.before["event_probe-rs-rtt-channel-config"]["plugins.nvim-dap-probe-rs"] = function(session, body)
local utils = require "dap.utils"
utils.notify(
string.format('probe-rs: Opening RTT channel %d with name "%s"!', body.channelNumber, body.channelName)
)
local file = io.open("probe-rs.log", "a")
if file then
file:write(
string.format(
'%s: Opening RTT channel %d with name "%s"!\n',
os.date "%Y-%m-%d-T%H:%M:%S",
body.channelNumber,
body.channelName
)
)
end
if file then file:close() end
session:request("rttWindowOpened", { body.channelNumber, true })
end
-- After confirming RTT window is open, we will get rtt-data-events.
-- I print them to the dap-repl, which is one way and not separated.
-- If you have better ideas, let me know.
dap.listeners.before["event_probe-rs-rtt-data"]["plugins.nvim-dap-probe-rs"] = function(_, body)
local message =
string.format("%s: RTT-Channel %d - Message: %s", os.date "%Y-%m-%d-T%H:%M:%S", body.channelNumber, body.data)
local repl = require "dap.repl"
repl.append(message)
local file = io.open("probe-rs.log", "a")
if file then file:write(message) end
if file then file:close() end
end
-- Probe-rs can send messages, which are handled with this listener.
dap.listeners.before["event_probe-rs-show-message"]["plugins.nvim-dap-probe-rs"] = function(_, body)
local message = string.format("%s: probe-rs message: %s", os.date "%Y-%m-%d-T%H:%M:%S", body.message)
local repl = require "dap.repl"
repl.append(message)
local file = io.open("probe-rs.log", "a")
if file then file:write(message) end
if file then file:close() end
end
}
However, this does not work with nvchad, which I am using normally. NVChad throws an error "Failed to run config for nvim-dap". If I replace
opts = function() ...
by
config = function() ...
the error disappears, but the launch configuration in .vscode/launch.json defining the config for probe-rs is not recognized. Therefore, I cannot start a debugging session on the embedded target. How can I overcome this problem? Thanks for any additional hint to me being a newbie!
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I am looking to set up a development environment for the raspberry pi pico using the pi pico debug adapter together with probe-rs. I succeeded to get it working in astrovim as described in the wiki:
However, this does not work with nvchad, which I am using normally. NVChad throws an error "Failed to run config for nvim-dap". If I replace
by
the error disappears, but the launch configuration in .vscode/launch.json defining the config for probe-rs is not recognized. Therefore, I cannot start a debugging session on the embedded target. How can I overcome this problem? Thanks for any additional hint to me being a newbie!
Beta Was this translation helpful? Give feedback.
All reactions