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

Running on lk devices

Michael Thomsen edited this page Feb 4, 2016 · 3 revisions

Setup

There are a few steps in getting us going on the lk devices. First we need a few tools and compilers:

gcc:

sudo apt-get install gcc-arm-none-eabi

If you intend to debug code, install gdb. There is a bug where the docs have the same name as the normal gdb (see https://bugs.launchpad.net/ubuntu/+source/gdb-arm-none-eabi/+bug/1267680 ) - so we force it to overwrite. If you for some reason don't want to overwrite the normal gdb man pages you can compile gdb for arm from scratch)

gdb:

sudo apt-get install -o Dpkg::Options::="--force-overwrite" gdb-arm-none-eabi

Please note, if your board is old, you may need to update the firmware, see the section at the bottom for doing that.

We need to enable our user to use the usb connection, which is as simple as:

$ sudo su
$ echo 'SUBSYSTEM=="usb", ATTR{idVendor}=="0483", MODE="0664", GROUP="plugdev"' > /etc/udev/rules.d/60-usb.rules
$ exit

Openocd is already pulled down as part of gclient runhooks, so we are good to go.

You should now be able to run:

tools/openocd.sh

which should connect to the device. Validate this, and then quit the program (write exit)

Getting the lk system installed

First, we build the image that we need to flash onto the device

cd third_party/lk
make stm32f746g-disco-dartino -j12

Now, flash it onto the device

tools/lk/flash-image.sh --disco third_party/lk/out/build-stm32f746g-disco-dartino/lk.bin

Running dart code

The device is communicating over /dev/ttyACM0, so in another terminal window, do:

cat /dev/ttyACM0

Compile and run some dart code on the device:

out/ReleaseIA32/dartino export hello.dart to foo.snapshot
./tools/lk/run_snapshot_lk.sh foo.snapshot /dev/ttyACM0

The output can be seen in the terminal window running cat /dev/ttyACM0

Running the graphical sample:

out/ReleaseIA32/dartino export samples/lk/gfx/lines_with_history.dart to foo.snapshot
./tools/lk/run_snapshot_lk.sh foo.snapshot /dev/ttyACM0

Updating the firmware

ST link installation:

  • Download stlink tool (called firmware upgrade on their site, currently STSW-LINK007) from st tool.
  • Install udev rules according to readme.txt (in root of downloaded zip)
  • Unplug the device and plug it back in to apply rules
  • Start STLink tool to update firmware