jdolinay / avr_debug

Source level debugger for Arduino - GDB stub for Atmega328 microcontroller used in Arduino Uno.
GNU Lesser General Public License v3.0
142 stars 33 forks source link

Can't debug on Mac #53

Open stanimirsp5 opened 1 year ago

stanimirsp5 commented 1 year ago

Has anyone succeded to run avr_debug on Mac? I'm using VS Code for Mac with Arduino extension and now I want to be able to debug my program but there are a lot of obstacles in configuring the launch.json file.

image

So my biggest problem is with paths especially because documentation is strictly for Windows and it's very hard and time-consuming to search workarounds for Mac. So if anyone has succeeded in running the avr_debug on Mac, please tell me:

This is how my Arduino.ino file and my launch.json file looks like code snippet

Thanks for your time.

felias-fogg commented 1 year ago

Hi,

one way to get a decent avr-gdb on a Mac is using homebrew! Install the homebrew system and then:

brew tap osx-cross/avr && brew install avr-gdb

You can copy the binary which you find following the link at /usr/local/bin/avr-gdb to the place where you need it, or you simply set the path to that link.

The hardware folder on a Mac can either be found in the Application itself (you need to open the corresponding folder) or it is below ~/Library/Arduino15 (or both).

stanimirsp5 commented 1 year ago

Hi, @felias-fogg, thanks for your answer it was very helpful. I overcame my issues with the launch.json and I think everything is fine with the JSON file. This is the updated version link

Now my problem is that when I upload my code to Arduino and run the debugger it enters in loop and vs code begins constantly to load something. I thought the problem may be with Baud rate but I know that the debugger uses 115200 and the default baud rate for Arduino extention is 115200 too.

felias-fogg commented 1 year ago

Hi @stanimirsp5,

I did not try it out yet - I still have to install VSC and the Arduino extension. However, the default baud rate of avr-gdb is 9600! So you need to tell avr-gdb to switch to 115200. Either use set serial baud 115200 after avr-gdb started and before you establish a connection with target remote ... or call avr-gdb with the argument -b 115200.