2017-06-14

Getting started with 1Bitsy and Black Magic Probe

Note: This stopped working with Ubuntu 19.04 and later (because the ARM package was not updated). But there is a solution: Getting the ARM toolchain to work on Ubuntu 19.04 and later (including for Black Magic Probe (BMP))

The Kickstarter project was great, but how do you actually get started using the two things, 1Bitsy and Black Magic Probe, once they are in your possession???

There is information about the devices, but not actually how to get started - like a step-by-step introduction with the blinking LED (single stepping over the code lines for ON and OFF would actually turn the built-in LED on and off). Or at least it is difficult to find - why isn't it featured very prominently? Where is the blog post that gets you started?

So far the best I have found is the YouTube video 1Bitsy & Black Magic Probe Linux Quickstart Tutorial  (and now with a transcript for the many required command-line commands - by yours truly).

I am also posting the transcript here due to the ephemeral nature of YouTube comments:


Transcript for commands and links


Notes:

Unlike the video, the three hardware connect events (indicated in the below) should be separate to get the same output on the command line as in the video.

I have also inserted the missing 'cd' to the 'fancy blink' directory (with the .elf file).

For a live USB Ubuntu 17.10 installation it was also necessary to install 'make' (added to the transcript).

For another install variation of Ubuntu 17.10 (regular install on an external USB SSD drive), also 'python-minimal' (for Python 2 - Python 3 was already installed).

Even newer versions of Ubuntu from 2019 (Ubuntu 19.04 and later), rendered the apt-get method (the first three steps here) for installing the cross GCC compiler and GDB useless. Installation fails with an error, and the rest will fail as a result. Solution: A follow-up blog post provides a solution that works, "Getting the ARM toolchain to work on Ubuntu 19.04 and later".

01 min 10 secs sudo add-apt-repository ppa:team-gcc-arm-embedded/ppa

01 min 30 secs sudo apt-get update

01 min 38 secs sudo apt-get install gcc-arm-embedded

01 min 51 secs sudo apt-get install git

XX min XX secs sudo apt-get install make

XX min XX secs sudo apt-get install python-minimal

02 min 02 secs git clone https://github.com/1bitsy/1bitsy-examples.git

02 min 07 secs cd 1bitsy-examples

02 min 12 secs git submodule init

02 min 15 secs git submodule update

02 min 21 secs make

02 min 28 secs id

02 min 32 secs sudo adduser $USER dialout

02 min 41 secs id

02 min 48 secs <The output should include "(dialout)" in the "groups=" part. In that case, log out. If it is not in the output, a restart of the computer is required (if a restart is not done the result is "Permission denied" in the "target extended-remote /dev/ttyACM0" line below).>

04 min 54 secs <Plug in Black Magic Probe to microUSB>

05 min 32 secs dmesg | tail

05 min 34 secs <Output includes: "ttyACM0" and "ttyACM1". "ttyACM0" is the COM port that GDB uses to communicate with the Black Magic Probe and "ttyACM1" is the auxiliary COM port that can be used to connect to the target board's serial port (so it is not necessary to use a separate USB-to-serial adapter).>

05 min 42 secs <Plug in 1bitsy to microUSB>

05 min 43 secs dmesg | tail

05 min 44 secs <Output includes: "ttyACM2" - but ONLY if there is already firmware on it that makes it appear as a serial device. This is NOT the case for the Kickstarter one...>

05 min 45 secs <Connect 1bitsy and Black Magic Probe using the JTAG cable. Note: the ribbon cable is to come from the SAME DIRECTION as the USB cable. That is, the ribbon cable does NOT cover the main chip/IC.>

05 min 48 secs cd ~/1bitsy-examples/examples/1bitsy/fancyblink

05 min 49 secs arm-none-eabi-gdb fancyblink.elf

05 min 54 secs target extended-remote /dev/ttyACM0

06 min 04 secs monitor version

06 min 11 secs monitor help

06 min 17 secs monitor jtag_scan

06 min 23 secs attach 1

06 min 27 secs load

06 min 30 secs run

06 min 32 secs y

06 min 37 secs <Ctrl + C>

06 min 38 secs list

06 min 43 secs tui enable

06 min 47 secs cont

06 min 51 secs <Ctrl + C>

06 min 52 secs step

06 min 53 secs start

06 min 56 secs y

07 min 00 secs next

07 min 04 secs step

07 min 07 secs next

07 min 07 secs next

07 min 17 secs next

07 min 22 secs cont

07 min 24 secs <Ctrl + C>

07 min 25 secs quit

07 min 26 secs y

07 min 26 secs y

DFU part:

07 min 44 secs <Press the user button and insert microUSB cable>

07 min 47 secs dmesg | tail

07 min 50 secs lsusb

07 min 54 secs <Output includes: "STMicroelectronics STM Device in DFU Mode">

07 min 57 secs sudo apt-get install dfu-util

08 min 13 secs make fancyblink.bin

08 min 18 secs ls

08 min 23 secs sudo dfu-util -d 0483:df11 -c 1 -a 0 -s 0x08000000:leave -D fancyblink.bin

09 min 07 secs <1bitsy is now programmed!>

09 min 10 secs <Links: <http://1bitsquared.com> (1BitSquared USA), <http://1bitsquared.de> (1BitSquared Germany), <http://1bitsy.org> (1Bitsy), and <http://github.com/blacksphere/blackmagic> (Black Magic Probe) >




Perhaps this blog post will do (covers Linux, Mac OS X, and Windows):

1Bitsy Quickstart Guide, Quickstart on the command line


A partial one (but with more in-depth explanations) is:

Getting Started (on GitHub, blacksphere/blackmagic)


Some GBD commands

  next (n)    Step over
  step (s)     Step into
  ????          Step out

  break 37  Set breakpoint at line 37
   ????        Set up watch for variable X



<To be expanded...>



Other resources:

Blackmagic probe Windows driver install tutorial  (YouTube video. It only contains instructions for installing the three different USB drivers, one for DFU (for Black Magic Probe itself) and the two that makes for the two virtual COM ports. And only for Black Magic Probe, not 1Bitsy.)