Skip to content
This repository has been archived by the owner on Sep 15, 2022. It is now read-only.

Debugging via serial on the STM Discovery board

Michael Thomsen edited this page Jun 7, 2016 · 3 revisions

Flashing the program from source checkout.

Currently the support for debugging the program is only available on the master branch.

First ensure that all required third party dependencies have been downloaded by running

$ gclient sync

Now generate ninja files by running:

$ ninja

Build our normal host and client binaries:

$ ninja -C out/ReleaseX64 && ninja -C out/ReleaseIA32 && ninja -C out/ReleaseSTM

Debugging the dartino program with the dartino command-line debugger.

Plug in your STM Discovery board, and run the flash command with --debugging-mode added.

$ out/ReleaseX64/dartino flash --debugging-mode ~/test/main.dart
Done building image: main.bin
Flashing image: main.bin

Now the program will print "Listening for connection". Attach the command line debugger with:

(Note: On a Mac use /dev/tty.usbmodemXXXXX)

$ out/ReleaseX64/dartino debug ~/test/main.dart on tty /dev/ttyACM0
Attached to /dev/ttyACM0

And now you can run commands like:

> b main
### set breakpoint 0: main @ ../../../test/main.dart:3:11
> run
../../../test/main.dart:3:11
3      int i = 0;
> s
../../../test/main.dart:4:9
4      print("a");
> 

Debugging the vm with GDB

The debugger script used for lk can also be used here:

$ tools/lk/debug-image.sh --disco --gdb-embedded out/DebugSTM/disco_dartino.elf
$ fg

The fg command will bring GDB into the foreground ready to debug.

Press 'c' to continue execution, you should now be able to single step through the interpreter.