Before logging an issue, please update to the latest release of Visual Micro from the Downloads Page.

When Logging a Support Issue in the Forum, please ensure you have also:-

  • Enabled vMicro > Compiler > Show Build Properties
  • Re-Compile your program with these settings enabled
 
Save the new Output to a Text File and....
  • Click the Reply button and attach as .txt file OR
  • Click here to Email us with the file attached, and a link to your post
Support requests without the output above may be impossible to answer, so please help us to help you
 
Page Index Toggle Pages: [1] 2  Send TopicPrint
Hot Topic (More than 8 Replies) Can't start JTAG debugging session with Teknic ClearCore (Read 5740 times)
Richard T
Junior Member
**
Offline


Posts: 15
Joined: Jan 31st, 2023
Can't start JTAG debugging session with Teknic ClearCore
Jan 31st, 2023 at 3:31pm
Print Post  
I've been debugging over the serial port up until now, but want to dig deeper with JTAG debugging.

I've purchased the recommended Teknic ClearCore ATMEL-ICE JTAG debugger and cable from Teknic in the USA. I've connected to the JTAG header and plugged into the debugger SAM port as described in the ClearCore manual. 

The ClearCore powers up ok and the debugger red and green leds come on too.

In Visual Studio, under the Visual Micro menu, I've selected hardware debugger, ATMEL-ICE and No Project + Libraries Optimisation. I've selected the Debug build configuration.

When I try to start debugging, I get the following error:

"Unable to start debugging. Unexpected GDB output from command "-target-select remote localhost:3333", Remote connection closed"

I've attached the verbose output of the micro build window.

I'd appreciate guidance as to how to solve this issue!
  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2370
Joined: Feb 13th, 2019
Re: Can't start JTAG debugging session with Teknic ClearCore
Reply #1 - Jan 31st, 2023 at 3:46pm
Print Post  
Thanks for the report, can you enable the options shown at the top of the page and also attach the complete build output so we can see the complete configuration?
  
Back to top
 
IP Logged
 
Richard T
Junior Member
**
Offline


Posts: 15
Joined: Jan 31st, 2023
Re: Can't start JTAG debugging session with Teknic ClearCore
Reply #2 - Jan 31st, 2023 at 3:55pm
Print Post  
Sorry! I missed the pre-issue logging instructions at the top of this forum page.

I've attached the requested compiler output.
  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2370
Joined: Feb 13th, 2019
Re: Can't start JTAG debugging session with Teknic ClearCore
Reply #3 - Jan 31st, 2023 at 4:04pm
Print Post  
Thanks for the output.

From the logs you currently have the Serial Debugging enabled, which does not need the Atmel ICE.

Can you change to the below options, and re-upload the log?
vMicro > Debugger > Debug: Hardware
vMicro > Debugger > Hardware Debugger: Atmel ICE

If there is time pressure Visual Micro is also available for Microchip Studio, and works alongside their debugging tools.
  
Back to top
 
IP Logged
 
Richard T
Junior Member
**
Offline


Posts: 15
Joined: Jan 31st, 2023
Re: Can't start JTAG debugging session with Teknic ClearCore
Reply #4 - Jan 31st, 2023 at 4:24pm
Print Post  
Thanks - I've recompiled and attached again (I'm having to switch between serial debugging to be able to continue work, and hardware debugging to work out the jtag issue)
  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2370
Joined: Feb 13th, 2019
Re: Can't start JTAG debugging session with Teknic ClearCore
Reply #5 - Jan 31st, 2023 at 5:09pm
Print Post  
Thanks and understand the switching between the configurations.

If you add a local board.txt to your project (vMicro > Add Code > Add Local Board.txt) and paste in the contents from the attached file, this should allow the debugging to improve (currently it is selecting the wrong cfg file, and none is provided in the board package).
  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Richard T
Junior Member
**
Offline


Posts: 15
Joined: Jan 31st, 2023
Re: Can't start JTAG debugging session with Teknic ClearCore
Reply #6 - Feb 1st, 2023 at 12:33pm
Print Post  
Thanks - I've done as instructed and still get the same error - build output attached.
  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2370
Joined: Feb 13th, 2019
Re: Can't start JTAG debugging session with Teknic ClearCore
Reply #7 - Feb 1st, 2023 at 12:48pm
Print Post  
Thanks for the log, can you also enable vMicro > Uploader > Verbose (if not already enabled) and try attaching the debugger from Debug > Attach to Process, and send the additional JSON Output shown?

There should also be a log in the build folder which may show further information:  clearcore.ino_DebugOpenOCD.log
« Last Edit: Feb 1st, 2023 at 12:48pm by Simon@Visual Micro »  
Back to top
 
IP Logged
 
Richard T
Junior Member
**
Offline


Posts: 15
Joined: Jan 31st, 2023
Re: Can't start JTAG debugging session with Teknic ClearCore
Reply #8 - Feb 1st, 2023 at 1:25pm
Print Post  
I hope the attached shows what you need.
  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Richard T
Junior Member
**
Offline


Posts: 15
Joined: Jan 31st, 2023
Re: Can't start JTAG debugging session with Teknic ClearCore
Reply #9 - Feb 1st, 2023 at 1:28pm
Print Post  
Sorry... sent serial version. Hardware debugger output attached.
  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Richard T
Junior Member
**
Offline


Posts: 15
Joined: Jan 31st, 2023
Re: Can't start JTAG debugging session with Teknic ClearCore
Reply #10 - Feb 1st, 2023 at 1:31pm
Print Post  
Please can I check: does the localhost:3333 entry imply I need an ethernet cable connected from the ClearCore to my laptop? As I understand it, I only need the debugger USB cable.
  
Back to top
 
IP Logged
 
Richard T
Junior Member
**
Offline


Posts: 15
Joined: Jan 31st, 2023
Re: Can't start JTAG debugging session with Teknic ClearCore
Reply #11 - Feb 1st, 2023 at 1:36pm
Print Post  
I've attached clearcore.ino_DebugOpenOCD.log as requested
  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2370
Joined: Feb 13th, 2019
Re: Can't start JTAG debugging session with Teknic ClearCore
Reply #12 - Feb 1st, 2023 at 1:40pm
Print Post  
Thanks for the information, it seems the overrides are not being applied for some reason, which is why the errors occur in the OpenOCD log.

The localhost:3333 connection is the port OpenOCD is serving for GDB to connect to, beneath VS when debugging, and it is normal when debugging via USB with our current configuration.  The OpenOCD log provided shows these layers are connecting up, but OpenOCD has been told it is the wrong chip is the root issue so far.

An alternative approach (which gives full manual configuration):
1) Click vMicro > Add Code > Add Custom GDB Debugger (Advanced)
2) Open the "ARM_ClearCore.Debug.debugger_launch.json" file and paste in the attached files' contents and save it
3) Change the vMicro > Debugger > Hardware Debugger: Manual/Custom

If you then try attaching the debugger again it should use the correct OpenOCD cfg file (atsame5x.cfg) when debugging.
« Last Edit: Feb 1st, 2023 at 1:45pm by Simon@Visual Micro »  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Richard T
Junior Member
**
Offline


Posts: 15
Joined: Jan 31st, 2023
Re: Can't start JTAG debugging session with Teknic ClearCore
Reply #13 - Feb 1st, 2023 at 1:46pm
Print Post  
Thanks - that appears to work Smiley

I've set a breakpoint in an ISR - I can't see it paused at the breakpoint, as I'd expect. The debug output is:

openocd: Open On-Chip Debugger 0.10.0+dev-01058-g853a05287 (2020-02-13-16:41)
openocd: Licensed under GNU GPL v2
openocd: For bug reports, read
openocd:      http://openocd.org/doc/doxygen/bugs.html
openocd: debug_level: 2
openocd: 
=thread-group-added,id="i1"
GNU gdb (GNU Tools for Arm Embedded Processors 7-2017-q4-major) 8.0.50.20171128-git
Copyright (C) 2017 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>;
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=i686-w64-mingw32 --target=arm-none-eabi".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word".
=cmd-param-changed,param="pagination",value="off"
0x0000059c in ?? ()
Note: automatically using hardware breakpoints for read-only addresses.
Warning: Exceptions are not supported in this scenario.

Program received signal SIGINT, Interrupt.
0x00000cf2 in ?? ()
  
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2370
Joined: Feb 13th, 2019
Re: Can't start JTAG debugging session with Teknic ClearCore
Reply #14 - Feb 1st, 2023 at 1:49pm
Print Post  
Glad to hear you are up and running, we will implement this and update this thread when this is available.

Thanks for working with us on this to reach this point.
  
Back to top
 
IP Logged
 
Richard T
Junior Member
**
Offline


Posts: 15
Joined: Jan 31st, 2023
Re: Can't start JTAG debugging session with Teknic ClearCore
Reply #15 - Feb 1st, 2023 at 1:54pm
Print Post  
It looks like the debug session has started, but it doesn't appear to be stopped at the breakpoint - I'm not sure what state it's in.
  
Back to top
 
IP Logged
 
Richard T
Junior Member
**
Offline


Posts: 15
Joined: Jan 31st, 2023
Re: Can't start JTAG debugging session with Teknic ClearCore
Reply #16 - Feb 1st, 2023 at 2:04pm
Print Post  
I've got a continuous 5 kHz ISR running with some code in it - what's the expected behaviour whilst GDB debugging? I've set a single breakpoint in the main program, but it doesn't halt at it. The only debug options are to stop the process, nothing shows paused, as one would expect at a breakpoint, awaiting the usual step into etc. input.
  
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2370
Joined: Feb 13th, 2019
Re: Can't start JTAG debugging session with Teknic ClearCore
Reply #17 - Feb 1st, 2023 at 2:07pm
Print Post  
Apologies I thought you said it had stopped at the break in the ISR previously.

Does your ISR do something "visible" to check its' running (blink an LED or output Serial data?) just to confirm it is happening as expected on chip?

GDB can work in ISR's but it depends on the specific chipset being debugged from my understanding and the implementations of GDB/OpenOCD.

Does the project compile if you change the optimization to vMicro > Debugger > Optimization: None (it may allow the ISR to be debugged then if it is being optimized out).
« Last Edit: Feb 1st, 2023 at 2:16pm by Simon@Visual Micro »  
Back to top
 
IP Logged
 
Richard T
Junior Member
**
Offline


Posts: 15
Joined: Jan 31st, 2023
Re: Can't start JTAG debugging session with Teknic ClearCore
Reply #18 - Feb 1st, 2023 at 2:24pm
Print Post  
I disabled the ISR and set a definite breakpoint in the main program loop. The debugging session runs, but doesn't pause at the breakpoint. The only options in the debug menu are to end the session. I get the following debug output:

openocd: Open On-Chip Debugger 0.10.0+dev-01058-g853a05287 (2020-02-13-16:41)
openocd: Licensed under GNU GPL v2
openocd: For bug reports, read
openocd:      http://openocd.org/doc/doxygen/bugs.html
openocd: debug_level: 2
openocd: 
=thread-group-added,id="i1"
GNU gdb (GNU Tools for Arm Embedded Processors 7-2017-q4-major) 8.0.50.20171128-git
Copyright (C) 2017 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>;
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=i686-w64-mingw32 --target=arm-none-eabi".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word".
=cmd-param-changed,param="pagination",value="off"
0x0000059c in ?? ()
Warning: Exceptions are not supported in this scenario.
Note: automatically using hardware breakpoints for read-only addresses.

Breakpoint 1, main () at \arduino\main.cpp:42
42          delay(1);

I took at look at main.cpp, and see the following:

/*
* \brief Main entry point of Arduino application
*/
int main(void) {
    // - - - - - - - - - - - - - - - - - - - - - -
    // Perform C++ initializations before sketch
    // - - - - - - - - - - - - - - - - - - - - - -
    delay(1);
    // Start sketch "setup"
    setup();

    for (;Wink {
        // sketch "loop"
        loop();
        if (serialEventRun) {
            serialEventRun();
        }
    }

    return 0;
}

I tried attaching to the process again, leaving main.cpp open, in the hope that debug execution halted at delay(1), but nothing happens. The only option is to halt the session.
  
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2370
Joined: Feb 13th, 2019
Re: Can't start JTAG debugging session with Teknic ClearCore
Reply #19 - Feb 1st, 2023 at 2:31pm
Print Post  
Thanks, it's generally difficult to pause that early in the program as setup() is the first bit of code available to debug in normal Arduino code, and there can be some timing difficulty in getting that to work (though possible if needed).

If you set a breakpoint on a line of code in loop() which is always hit, does it stop on that?
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: [1] 2 
Send TopicPrint