callwyat / mplab-extension

Build, Program, and Debug MPLAB Projects from the comfort of VS Code
Other
22 stars 9 forks source link

Support for Microchip ICD3 #13

Closed fclante closed 1 year ago

fclante commented 1 year ago

It would be nice if support for this tool was added as well. Might as well include support for the ICD2 also if its not too much :-). Thanks for the awesome work!

callwyat commented 1 year ago

What is the name of the ICD2 in the project file? “nbProject/configuration.xml”

pustekuchen91 commented 1 year ago

Hey,

i would be interested in ICD3 Support also.

For ICD3 it should be: <platformTool>ICD3PlatformTool</platformTool>

callwyat commented 1 year ago

The ICD3 and ICD2 should now work with the MPLABX debug configuration as of version 0.1.15 (which is a pre release) It will be included in a normal release if all goes well. Can you test it out and confirm it works?

pustekuchen91 commented 1 year ago

Hi @callwyat,

sorry, needed some time to get my new pc configured. But now i was able to test the plugin with the ICD3. I ran into an issue.

grafik

As you can see, there is a missing line break, between the commands.

I'm in a ubuntu 20.04 devcontainer

vscode ➜ /workspaces/myproject(support-debugging-in-vscode) $ lsusb
Bus 001 Device 002: ID 04d8:9009 Microchip Technology, Inc. (www.microchip.com) MPLAB® ICD3 tm (www.microchip.com)

For anyone who is interested, This is my launch.json (I'm using qbs as build tool ):

{
    "version": "0.2.0",
    "configurations": [

        {
            "type": "mdb",
            "request": "launch",
            "name": "MPLABX Debug",
            "filePath": "${command:qbs.getProductExecutablePath}",
            "stopOnEntry": true,
            "device": "PIC32MX795F512L",
            "toolType": "ICD3",
            "preLaunchTask": "Qbs: Build",
        }

    ]
}

tested with 0.1.16

callwyat commented 1 year ago

Unfortunately, I don’t think I’ll be able to help with this issue. The extension acts as an adapter between VSCode and an executable called MDB (Microchip Debugger). If I had an ICD3, I would try invoking MDB directly and seeing if I could get it to work, but I only have the PICKIT3 and 4.

Here is the MDB documentation I used. If you have questions about it, I should be able to help, and if you figure out what needs to be done to make it work, I can implement it in the extension!

pustekuchen91 commented 1 year ago

Thanks for the Info. I think your plugin is correct at the moment. I manually tried with mdb to connect to the icd3.

>hwtool                                                                                                                                                   ?
Oct 31, 2023 2:01:59 PM com.microchip.mplab.nativeloader.NativeLoader loadNativeLibrary
INFO: Library resource path: libs/libUSBAccessLink_3_38.so
Oct 31, 2023 2:01:59 PM org.openide.util.NbPreferences getPreferencesProvider
WARNING: NetBeans implementation of Preferences not found
       Index               Tool Type           Serial Number              IP Address    Description
           0                    icd3                       ?                     N/A    <cannot_open>04D8:9009

on windows its looks like this.

hwtool                                                                                                                ?
       Index               Tool Type           Serial Number              IP Address    Description
           0                    icd3            BUR--------                     N/A    MPLAB ICD3 tm

so it seems that in my devcontainer the driver for the icd3 is not available.

When reading a bit in the MDB documentation, i saw some properties which can be set (See Table 3-6). This could be extended in the plugin. I dont need them at this moment, but options like poweroptions.powerenable could be needed by someone else.

THis options should be set before hwtool <tool> is called.

callwyat commented 1 year ago

Ahh yes the tool options. Those were originally always extracted from the project file and sent to the tool, but it caused issues with the 4 series of tools (e.g. PICKIT4, ICD4) were they wouldn’t connect, so they are now off by default, but they can be enabled in the VSCode Settings, or they can set directly using the MDB debug type.

Seeing as you think this isn’t a plugin issue, I’ll go ahead and close this issue 😊