-
Notifications
You must be signed in to change notification settings - Fork 36
Debugging via serial on the STM Discovery board
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
Plug in your STM Discovery board.
Use the dartino tool to compile, export and flash a program
$ out/ReleaseX64/dartino flash ~/test/main.dart
Done building image: main.bin
Flashing image: main.bin
The program will start running after the flashing.
To debug the dartino program, you must first set it up to listen for a debugger before running.
Find the .dartino-settings
file and change embedder_options
to contain the string "enable_debugger".
Reflash the program. And now the program will print "Listening for connection"
Now attach to the program via the tty. The session will be used to keep the connection open until the debug command.
$ out/ReleaseX64/dartino attach tty /dev/ttyACM0 in session foo
Attached to /dev/ttyACM0
And now you can start the debugger with:
$ out/ReleaseX64/dartino debug ~/test/main.dart in session foo
Starting session. Type 'help' for a list of commands.
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");
>
If you pull a never version of dartino, remember that you need to rebuild, reflash and restart dartino
$ out/ReleaseX64/dartino quit
To start using the new version.
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.