2017-06-14

Getting started with 1Bitsy and Black Magic Probe

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 (note: 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)):

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

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 <logout>

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">

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>

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 22 secs cont

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.)


2017-04-16

Emacs basics

If you seldom use Emacs it is easy to forget the arcane operation of Emacs...



Exit Emacs

Ctrl + X Ctrl + C.



M-x notation

"M" is effectively "Alt" (on most systems).

Thus M-x means Alt + X.



C-x notation

"C" is effectively "Ctrl" (on most systems).

Thus C-x means Ctrl + X.



Creating/locating the settings file



Alt + X customize. Press "Apply and Save" (Emacs 24 for Windows). This will create the file ".emacs" in C:\Documents and Settings\username\Application Data or C:\Users\username\AppData\Roaming depending on the Windows version.

Locate it by: Ctrl + X D ~/ Return


Add modes/Elisp code

<This section is under construction...>

Example: Add the Intel-hex-mode Elisp code

Download it and copy file intel-hex-mode.el to the same folder as file .emacs.

Add this to .emacs:

    (require 'intel-hex-mode)




Files

To open a file: Ctrl + X Ctrl + F Enter <Select file> Enter

To save: Ctrl + X Ctrl + W Enter y 

Ctrl + X O to switch in split windows (e.g. after Ctrl + X B).


Ctrl + X Ctrl + B to get a list of windows (buffers).

Ctrl + X B to switch between windows.




To be continued...