Debugging

Do you have a question on how to do something.
Ask in here.
Post Reply
rufessor
Posts: 291
Joined: Tue Oct 25, 2011 7:39 am

Debugging

Post by rufessor »

Hi All-

SO in playing around coding, I am starting to see that I really want a step by step debugging environment to check variables etc as the code runs. Is there anything that accomplishes this, I am starting to try to use Code Blocks but its not really an Arduino environment so its not working for me.... checking the web I am not seeing anything I can understand in terms of getting it to work in Arduino.
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Debugging

Post by rimai »

Not easy to get done :(
Roberto.
binder
Posts: 2865
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: Debugging

Post by binder »

Bryan wrote a tutorial he did for getting it to work with AVRStudio 4, but it was rather indepth and a little complicated. You could take a look at this (I have been meaning to do this but just haven't done it yet).

http://forum.reefangel.com/viewtopic.php?f=14&t=158
http://forum.reefangel.com/viewtopic.php?f=14&t=157
rufessor
Posts: 291
Joined: Tue Oct 25, 2011 7:39 am

Re: Debugging

Post by rufessor »

YIKES!

Yeah... the tutorial basically seems to mesh with the interweb findings... not so easy and maybe for me not worth it. I think I will just set up a serial monitor and introduce some serial outs with delays at the points I want to see the variable.. the only issue with this is when were playing with time based functions err... well... 10 am only happens at, well... 10 am! ehhehe. I guess I will debug the hard way... load run, change, repeat :lol:

I suppose I could change the time in the code... there is a way to do that I believe... I think I saw it in the time library I will look into this.

I am actually kinda surprised that someone has not created a way to do this... but perhaps my understanding of the scope of Arduino projects is a bit exaggerated. Thanks for the links. If I seriously flail I think I will just post the code in question and hope you guys can see the issue. Nothing pressing now, but I know based upon what I would like to do that it will happen!
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Debugging

Post by rimai »

Well, there are basically only 2 ways to get debugging on the AVR chip.
One uses SPI pins, which are usually being used for some other purposes, but Arduino chips don't even offer this option if I'm not mistaken.
The second one is a proprietary protocol called debugwire from AVR, which requires some special debugging board that costs $300 and doesn't make any sense to have it :(
This debugwire only uses one pin. The reset pin.
Then, AVR came up with the Dragon boards, which you can get to use debugwire at the cost of around $100. That's a little more manageable, but then Arduino boards also use the reset pin to auto-reset the board for the bootloader to kick in. Otherwise, you would have to hit a button every time you wanted to upload a code.
For Arduino boards that cost around $30, would people spend $100 to debug their code?
Roberto.
rufessor
Posts: 291
Joined: Tue Oct 25, 2011 7:39 am

Re: Debugging

Post by rufessor »

If I was doing this for something other than fun in a hobby that eats $$ for breakfast I might... but not really given that as I get more familiar with this system it will be less and less necessary.... I guess you could offer a "developer" package that has that feature... but I personally don't think I would have opted for it.

Cool to know.
Post Reply