AVRStudio4 gdb-target plugin (for simavr)

Go To Last Post
11 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

This is a plugin for gdb-targets for AVRStudio4. It works as follows:
- AVRStudio4: open project (eg an ATTiny25 project)
- AVRStudio4: Debug / Select Platform and Device : myCompany.myPlugin / ATTiny25
- simavr: ./run_avr -g -m attiny25 -f 8000000
- AVRStudio4: compile/assemble the project
- AVRStudio4: run the project
- AVRStudio4: enter ip and port of the gdb-server (eg localhost:1234)
- AVRStudio4: debug the project...

AVRStudio4 will connect to the simavr-gdb-server via this gdb-target-plugin.

Following commands work:
- run
- break
- stop
- reset
- set/remove breakpoint
- single step (everything else is mapped to single step)

You need to download the bin-package and execute the AVRSTUDIO_REGISTER.CMD to register the plugin with AVRStudio4. Before deleting the files, you should UNREGISTER.CMD the files.

It comes with the sources.
Thread about simavr is here:
http://www.avrfreaks.net/index.p...
simavr git repo is here:
http://gitorious.org/simavr

Project is here:
http://www.avrfreaks.net/index.p...

2010.10.20: initial release v1

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

@PRosendahl

Allthough i don't use gdb on windows (only on linux) , i would like to thank you for publishing your work here.

/Bingo

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Actually, I am doing exactly that.

simavr runs on my Ubuntu host, while AVRStudio4 runs on a windows virtual machine.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm getting ready to install a distro to my 2nd computer
but I would like recommendations:

1) Debian or Ubuntu ?
2) I guess GDB is ( alot ? ) more powerful than the dragon ?
3) Can I use the Dragon to work with GDB instead of buying AVR jtag ICE for this plugin ?

1) Studio 4.18 build 716 (SP3)
2) WinAvr 20100110
3) PN, all on Doze XP... For Now
A) Avr Dragon ver. 1
B) Avr MKII ISP, 2009 model
C) MKII JTAGICE ver. 1

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

1) Ubuntu (which is a derivative of Debian anyway)

2) You misunderstand, gdb is a piece of PC software. It does (for debugging) what AVR Studio does on Windows. You will use it WITH your Dragon. Because gdb knows nothing about driving an Atmel Dragon you run a second piece of software that connects the two called avarice. (that in itself will be using a thing called libusb to connect to the Atmel debugger hardware)

3) Yes avarice works as well with the Dragon as it does with JTAGICEmkII

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ubuntu is more or less the bleeding edge, with lots of current stuff and packages. Works stable enough for me.

Debian is rather security-oriented. That is, they lag behind 1-2 years in packages, but they are tested well and pretty safe.

Of course, you can set the package manager to any repo you want. Above is for standard installation.

The GDB server is part of simavr, but it works with any other gdb-server I guess.

I would prefer the built-in debugger of AVRStudio over this plugin. BUT if you want debug the hackable simavr, you will need this.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

My bad, I meant is GDB + dragon more powerful in debugging capabilities than using Studio + dragon ?

Quote:
I would prefer the built-in debugger of AVRStudio over this plugin
Why ?

thanks all

1) Studio 4.18 build 716 (SP3)
2) WinAvr 20100110
3) PN, all on Doze XP... For Now
A) Avr Dragon ver. 1
B) Avr MKII ISP, 2009 model
C) MKII JTAGICE ver. 1

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

My bad, I meant is GDB + dragon more powerful in debugging capabilities than using Studio + dragon ?

It's the same (in functionality, if not operation). But why guess about this - you can try it out for yourself using simulavr. Start two command prompts. In one run "simulavr -g -f project.elf" and then just leave it running. In another run "avr-gdb project.elf" then type the command "target remote localhost:1212" or the shortened form "ta re localhost:1212". Now just keep typing "step" to step through the program. In fact in gdb you just type it once and then keep hitting [enter] which repeats the last command.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Studio has a CPU-specific debugger - for example you can see the IO regs with clear names.
The Studio built-in simulator mk II has very detailed models for the CPUs, much better than simavr.
If you are using the Dragon target (only restriction is not to use the occupy the debug wire), then you have a very good debugging solution.

The question is:
Why use Studio + GDB-plugin + simavr?
Well, simavr is 100% hackable. You can embed it into any context. For example, you can emulate a complete board around it.
You cannot do that with Studio. Studio just simulates the CPU-side of life, not the input/output pins.

I tried to hack the simulator mk ii, but had to realize the above... and then I found simavr.
I have added the ATTiny10 target to simavr, and as the next step I plan to write an emulator for the stuff around the chip. Then I can truely debug that thing.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

1)Is Studio actually running GDB as its debug client app.for Atmel's JTAGs or something they wrote internal ?

2) What language(s) allows one to design a plugin for Studio, Eclipse, etc and does Atmel provide the interface info for free ( I guess so )?

3) How long did it take you to write the code for the plugin and using what language?

Seems like a great effort and thanks for it !

1) Studio 4.18 build 716 (SP3)
2) WinAvr 20100110
3) PN, all on Doze XP... For Now
A) Avr Dragon ver. 1
B) Avr MKII ISP, 2009 model
C) MKII JTAGICE ver. 1

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

1) no, Studio has its own debug interface. This plugin acts as a translator between the Studio-debug-interface and the gdb-server

2) this plugin is written in c#. it is a COM component. atmel provides an SDK, but that is for c/c++ plugin development.

3) it is impossible to distinguish between the code analysis/reverse engineering of Studio and writing the plugin. i like writing in c# (for rapid windows development) coupled with p/invoke. some parts of the plugin are written in c/c++.