So how do you debug an Arduboy game?

so in my day job I can run my code in simulation inside gdb, or use printf on a serial port, or attach a kernel debugger over serial cables if things go really bad, but how does one debug with the arduboy short of using arduboy.print() on the tiny screen?

thanks!

B

Speaking from general Arduino experience, and not any Arduboy experience, you often debug with print statements, but to the serial port. Then you can open a serial console on your connected computer and see the output. I’d like to think that the same will still work with Arduboy. The Arduino environment (and codebender, for that matter) has a built-in serial monitor program. You can also use any software (e.g. terminal emulator) that can take input from a serial port.

2 Likes

The usual path in debugging a C/C++ program would be to use gdb. Embedded devices can be a challenge. So… we have http://avarice.sourceforge.net/. I haven’t tried using this with a microcontroller, and there are probably other solutions. Your best bet in any debugging that at all involves see situation is to look to GDB, so try googling “arduino gdb”, “avr gdb”, “avr-gcc gdb” etc. Somewhere you find a solution to step through your program and view the registers, view code as you step, that sort of thing, which is all built into gdb.

If anyone tries it, please share your results. :thumbsup:

right, I had done that as well in the past, but I didn’t seem to get any output on the serial console with the Arduboy, perhaps it’s not setup for that, I don’t know… or maybe i need to use stderr or some other fd, I think i was still using stdout at the time that I tried it…

1 Like

Serial output (and input) over USB works with the Arduboy.
Here’s a simple demo sketch:

#include <Arduboy.h>

Arduboy arduboy;
int count = 0;

void setup() {
  arduboy.begin();
  Serial.begin(9600);
}

void loop() {
  arduboy.clear();
  arduboy.setCursor(0,0);
  arduboy.print("Count = ");
  arduboy.print(count);
  arduboy.display();

  Serial.print("Displayed count: ");
  Serial.println(count);

  count++;

  delay(1000);
}
1 Like

It is actually possible to use an in series circuit programmer and use AVR toolchain with their debug process. You can step through code and set breaks and all that stuff you can do. You’ll have to crack open the case and solder to the pads, but they are all there for you!

1 Like

That’s kind of neat. Is it a shield or something? I remember hearing about a hardware debugger, but I didn’t know if you had to build it or if there were products available.

Is this link on target Kevin? https://www.arduino.cc/en/Tutorial/ArduinoISP

Hi all,

Hoping on this train mighty late, but whatever I do I can’t get Serial to print to the Arduino IDE console. I’m brand new to Arduino and would consider myself a hobby programmer at best, so ELI5.

Here’s my code:

  void setup() {
    arduboy.begin();
    arduboy.setFrameRate(10);
    Serial.begin(9600);
    Serial.print("HALP");
}

Arduino for Atmel Studio 7
http://www.visualmicro.com/page/Arduino-for-Atmel-Studio-7.aspx

http://community.arduboy.com/t/programming-arduboy-with-atmel-studio-7/2023/5?u=emutyworks

It doesn’t print to the console, it prints to the Serial monitor, it’s the button on the top right of the IDE that looks like a magnifying glass. Or something. Start it before you launch the game and make sure the baud rate is correct and everything should just pop up there.

:grinning: Awesome thanks!!!