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 Send TopicPrint
Normal Topic Start with Debugging Starts Into Bootloader (Read 1305 times)
yaletowneric
Newbies
*
Offline


Posts: 8
Joined: Jul 8th, 2020
Start with Debugging Starts Into Bootloader
Jul 14th, 2020 at 4:45am
Print Post  
I've just started using an Atmel-ICE with a MKR1000. When I hit Debug-Start Debugging the following happens:

1. It appears to upload as normal.
2. Debugging starts (Watch window opens).
3. The onboard LED starts to flash (showing the board is in bootloader mode, also confirmed that the normal COM port in the drop down disappears and is replaced by the bootloader COM port).

At this point if I stop the debugger the onboard LED pulsing stops, but the normal COM port doesn't reappear until I press the reset button. I can however successfully debug by doing the following:

1. Stop the debugger.
2. Press the reset button on the board.
3. Use Debug->Attach to Process.

The sketch compiles and loads normally with the serial debugger.

Build and debug outputs are attached.
  

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


Posts: 2174
Joined: Feb 13th, 2019
Re: Start with Debugging Starts Into Bootloader
Reply #1 - Jul 14th, 2020 at 9:58am
Print Post  
Thanks for the clear report and details.

The COM Port disappears when uploading via the Atmel ICE, as this removes the boot loader.   

This can be re-burned either with a Serial Upload, or using the Upload > Burn Bootloader button when you have the Atmel ICE selected as the programmer, and would be completed after the upload of your sketch via the ICE.

We will investigate if there is anything else missing here, as similar problems have been seen on other boards (due/zero), and as you suggest for now the best approach is likely to be attach to process (which will work after upload via ICE as well as Serial).
  
Back to top
 
IP Logged
 
yaletowneric
Newbies
*
Offline


Posts: 8
Joined: Jul 8th, 2020
Re: Start with Debugging Starts Into Bootloader
Reply #2 - Jul 14th, 2020 at 1:16pm
Print Post  
Thanks for the quick reply. I did recognize the issue with the boot loader getting erased when using the Atmel-Ice uploader, so the above notes were with it using the serial uploader. 

I can shortcut the above procedure slightly by doing the upload with the vMicro start and upload button then attaching. The challenge is that if I need to catch a breakpoint in setup() that has usually passed before I can get the debugger attached.
  
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Online


Posts: 2174
Joined: Feb 13th, 2019
Re: Start with Debugging Starts Into Bootloader
Reply #3 - Jul 14th, 2020 at 6:06pm
Print Post  
Apologies for missing that, and investigating further the Start Debugging issue appears to be a timing issue.

If you add the Local Board.txt entry below, and retry the Start Debugging option:
Code
Select All
tools.atmelICE.server.initCmd=-c "sleep 500;init;reset halt" 


This worked well for me, and it is a 500ms wait essentially before Open OCD connects.  This can be extended but not by too much, else GDB fails to connect to OpenOCD (as its sleeping).


Also to force the program to reset on attach of the debugger, you can add the below line to the Local Board.txt file, allowing you to debug from the first line of setup(), when using the Attach option:
Code
Select All
vs-cmd.Debug.AttachtoProcess.tools.atmelICE.server.initCmd=-c "init;reset halt" 

« Last Edit: Jul 14th, 2020 at 6:11pm by Simon@Visual Micro »  
Back to top
 
IP Logged
 
yaletowneric
Newbies
*
Offline


Posts: 8
Joined: Jul 8th, 2020
Re: Start with Debugging Starts Into Bootloader
Reply #4 - Jul 15th, 2020 at 4:19am
Print Post  
That worked, thanks!
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint