Author Topic: Viewing pheripheral registers while debugging  (Read 4267 times)

Offline zainka

  • Multiple posting newcomer
  • *
  • Posts: 12
Viewing pheripheral registers while debugging
« on: March 29, 2016, 11:37:00 pm »
Hi

I use CB 16.01 on xubuntu 15.10 to develope and debug code for AVR8s. This has prooven to be very stable when using avrdude, avarice and atmels own avr-gcc tool package with avr-gdb together with jtagice-mk2 debugger.

However, there is one problem that needs an solution. CB has no clue of the special function registers, or pheripheral registers if you like, thus I can not view easily the content of the timer registers or ADC and such.

I am currently trying to figure out how to eventually write a plugin that adds this feature based on atmels own peripheral register file description, a xml file that is part of Atmel studio. The plugin would then ask for such a file (a setting in the project setup) and based on its content (special for each chip) provide a window under the "debug window" menu much like the CPU registers debug window so that one may read and write to these registers easily.

But, for all I know, there might be an solution for this already somewhere, so I would be glad to hear your experiences for debugging with access to pheripheral registers. How are you dealing with this today?

Breg

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 11724
    • Travis build status
Re: Viewing pheripheral registers while debugging
« Reply #1 on: March 30, 2016, 06:05:27 pm »
What is this xml file doing? Can you show me an example?
And how do you ask the debugger for the special registers?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Quiss

  • Multiple posting newcomer
  • *
  • Posts: 74
Re: Viewing pheripheral registers while debugging
« Reply #2 on: March 30, 2016, 07:48:06 pm »
For sometime ago, I did something like that for STM .svd files (.xml file), it looks like:


I basicly copied one of the debugging windows and edited it but it's been a long time and it is really a mess. Maybe you could use this as a starting point.

Edit: I forgot to put a .svd file.
« Last Edit: March 30, 2016, 07:51:04 pm by Quiss »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 11724
    • Travis build status
Re: Viewing pheripheral registers while debugging
« Reply #3 on: March 30, 2016, 08:00:23 pm »
What are the gdb commands to read and write the registers?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Quiss

  • Multiple posting newcomer
  • *
  • Posts: 74
Re: Viewing pheripheral registers while debugging
« Reply #4 on: March 31, 2016, 08:38:52 am »
Same as ExamineMemory; you just get perihperal register's address (base address+offset) from the .xml or .svd file:
Code: [Select]
[debug]>>>>>>cb_gdb:
[debug]> if 1
x/1xw0x48000400
x/1xw0x48000404
end
[debug] > > >0x48000400: 0x00000000
[debug]0x48000404: 0x00000000
[debug]>>>>>>cb_gdb:
I do not know about AVR but it should be similiar.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 11724
    • Travis build status
Re: Viewing pheripheral registers while debugging
« Reply #5 on: March 31, 2016, 06:48:39 pm »
I guess this could be implemented in the cpu registers window using some generic api design.
I'm not sure I'll have the time to improve this, but I'm available to review or improve patches.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 11724
    • Travis build status
Re: Viewing pheripheral registers while debugging
« Reply #6 on: March 31, 2016, 11:51:11 pm »
Can you post a feature request on sf.net, so this is not forgotten? (but first wait for someone fit bring sf.net back to life, because it is badly broken at the moment)
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline zainka

  • Multiple posting newcomer
  • *
  • Posts: 12
Re: Viewing pheripheral registers while debugging
« Reply #7 on: April 07, 2016, 05:43:23 pm »
Hi

Thank you I will certainly look into your code. It should be possible to write something to be generic so that more than one architecture could be supported. Thanks for sharing. I am a bit busy by the time beeing but will start as soon as possible.

I have added an xml file for AVRs as an example. Its basically the same as for ARM, baseaddress + offset. Take a look if interested. They are part of atmel studio but one may also download these as a package pr. avr or arm architecture from Atmel at http://packs.download.atmel.com/ .... As mentioned basically the same as ARMs svd files but Atmel meant they where crappy and created their own style, I do not know what the exact differentness are.

Vidar
« Last Edit: April 07, 2016, 06:00:03 pm by zainka »