5

Im working on Arduino Uno board recently im stuck with my code, i couldnt debug using print() in ArduinoIde.So i downloaded AtmelStudio 6.2 for debug purpose. when i set the breakpoint and try to build .Im getting the warning The breakpoint will not currently be hit. Unable to set requested breakpoint on target.The current selected deviceis unable to set breakpoints during runtime

please help me sort this issue

satish
  • 51
  • 1
  • 4
  • I found that by causing a compile error in affected files (add a typo then compile) the problem is fixed after correcting the typo and recompiling. – Mark Jan 02 '18 at 01:45

4 Answers4

2

Following workarounds worked with the same problem using ATMega 168P on Atmel Studio 7 with Atmel-ICE.

1. Assembler

Insert the following assembler code where you want your breakpoint:

asm("break");

Please note, this is a really ugly solution and not suitable for all situations. It only works with DEBUGwire and makes your program stop in any case, even if no programmer is attached.

2. Create new project

Creating a new project at a different location helped as well. I copied all the required files to the new folder. The new location has a short path (C:\atmel\project...) and contains no spaces, no umlauts etc.

pafodie
  • 87
  • 1
  • 10
2

I had a similar problem, the difference was that I could only hit breakpoints in the original modules of my project (i.e. those already existent when I created the .cproj), any modules I added later wouldn't have the program stopped in breakpoints placed on them.

The solution (2) mentioned by @pafodie worked to solve this, but in the process I found a simpler way: just delete the .atsuo file. It will later be automatically recreated, and the problem disappears (at least until you add more modules). It seems AS6 caches something there that isn't updated when new files are added, or does it incorrectly.

Fabio Ceconello
  • 15,819
  • 5
  • 38
  • 51
  • Helped me right now with AS7, thanks. (I actually deleted whole .vs directory that included that .atsuo) – firda Jul 22 '20 at 10:28
2

I might've found a solution that works, for me at least! You need to disable compiler optimization. In Atmel Studio,

Hit Alt+F7 > ToolChain > Optimization {there are 2 Optimization windows but only one fits the shoes} > Optimization level > None

I found it here, explained better than I did: https://www.microchip.com/webdoc/GUID-ECD8A826-B1DA-44FC-BE0B-5A53418A47BD/index.html?GUID-8FF26BD2-DBFF-48DD-91FB-8585D91A938D figure 5

Vedprakash Wagh
  • 3,595
  • 3
  • 12
  • 33
Bass
  • 21
  • 1
0

If using external Makefile, make sure the -g (debug) flag is set in CFLAGS.

Otherwise, Atmel Studio would have no idea how the source files correspond to the compiled binary.

new_at_coding
  • 31
  • 1
  • 4