Skip to content

Getting started guide

Shaun Walker edited this page Oct 14, 2013 · 17 revisions

This guide is an in-depth introduction to the Galago development tools, installation instructions and a reference for command-line debugging.

Buy Galago hardware

New Galago devices are available at Logiblock.com.

API Reference

The ultimate Galago API reference is the built-in documentation in GalagoAPI.h.

You may also read the API documentation on the wiki.

Logiblock IDE

The Logiblock IDE is still under active development. Please report IDE issues you find to our GitHub issue tracker.

Bugs you find with the Galago API or libraries should be filed as issues against the Galago project.

IDE Launcher, auto-updater version 0.3.7 (latest):

Getting started with the command-line tools

The command-line tools are a great way to get started with Galago before the new Logiblock IDE is released, or before every feature you need is implemented.

The Logiblock platform, which forms the foundation of the IDE, allows you to build, download and debug code on Galago and compatible hardware. You can use it directly at the command line and it will integrate with other workflows.

Introduction and demo

Youtube video
Click to view on YouTube

Installation prerequisites

To use the Logiblock platform from the command-line, you need to install Node.js (version 0.10.12 or higher required.)

Notes:

You can use the single node binary directly if you do not wish to (or cannot) install it to your system.

Node.js is built-in to the Logiblock IDE, so a separate install is not necessary to use that (but won't hurt.)

Download the Logiblock platform

The core command-line development tools are available in a single package from our auto-update servers. To download them, save and unpack the following:

Logiblock platform - version 0.9.16

Double-click to unpack the tar.gz archive on Mac and Linux, or use tar -zxf <archive.tar.gz>. On Windows, decompress using any popular 3rd-party archive tool.

Install Galago USB drivers (Windows only)

Unlike other operating systems, Windows needs a driver to recognize Galago. Please install it from this archive by decompressing the zip, right-clicking Galago.inf and selecting Install.

Install Galago udev rule (Linux only)

On some Linux distributions, Galago hardware cannot be detected or used by non-root users without a udev rule. We recommend all Linux users install this rule as udev policies may become stricter when you update your OS. To establish a rule, do the following:

As root, create a file in /etc/udev/rules.d/ named 90-galago.rules with the following contents:

SUBSYSTEMS=="usb", ATTRS{idVendor}=="00b1", ATTRS{idProduct}=="ab04", MODE:="0666"
ATTRS{idVendor}=="00b1", ATTRS{idProduct}=="ab04", MODE:="0666", ENV{ID_MM_DEVICE_IGNORE}="1"

To unsure the rule takes effect, exit the command-line tools or the nitride IDE and unplug/plug-in the device before continuing.

Creating a project

A Galago project, whether created inside the IDE or not, has a project file that defines it. This file is named module.json and is stored in JSON notation. To create a project from scratch, use the template available on the Project Files page, or invoke the SDK as follows from a blank directory:

Please be certain to create and cd to a new directory for your project, outside the Logiblock Platform directory.

mkdir <new directory for project>

cd <new directory for project>

node <platform directory>/bin/SDK.js --init

This will create a boilerplate module.json file and a main.cpp containing a simple example project.

Building

To build a project, invoke the SDK by itself in the project directory. In all examples, you may also pass an optional argument containing the project's path if you wish to build from a location outside the project.

node <platform directory>/bin/SDK.js

node <platform directory>/bin/SDK.js path/to/your/project (optional path)

The first time you run the platform tools, it will download a GNU SDK to build your project. These SDKs are about 40MB so the script will report download progress as it's installed.

Downloading built firmware

To build and then download firmware to a connected Galago, pass the --install argument.

node <platform directory>/bin/SDK.js --install

Debugging

To build, download and debug firmware on a connected Galago, pass the --debug argument. After installing, gdb will be invoked in pass-through mode.

node <platform directory>/bin/SDK.js --debug

Initially, gdb will try to connect to the drivers on the default port. If the port is in use, try ports counting up from 1033 with gdb commands like following:

(gdb) target remote localhost:1034

Appendix A: gdb command reference

Run/stop control

(gdb) c -- continues running from the initial stopped state or when a breakpoint is hit

(gdb) ^C -- (ctrl+c) interrupts a running program

(gdb) step -- step in

(gdb) n -- next line (step over)

(gdb) finish -- run until end of current function and report return value (step out)

Inspecting location and variables

(gdb) l -- (L) display lines of the program surrounding where it's stopped

(gdb) bt -- 'backtrace', display the callstack for the current point (i.e. which function(s) called here)

(gdb) info locals -- display the name, type and value of local variables

(gdb) info reg -- display the value of all core registers

(gdb) p <variable name> -- display the value of the specified variable

(gdb) p/x <variable name> -- display the value of the specified variable, in hexadecimal

(gdb) set <variable name> = <value> -- change the value of the specified variable

Breakpoints

(gdb) info b -- display the current breakpoint locations and statuses

(gdb) b <location> -- set a breakpoint at a location; displays the corresponding breakpoint number

examples:

(gdb) b main.cpp:80 -- break on line 80 of main.cpp

(gdb) b 59 -- break on line 59 of the current file (wherever execution is stopped)

(gdb) b onSerialData -- break upon entry to the function onSerialData(...)

(gdb) b *0x3d4 -- break on the instruction at offset 0x3d4

(gdb) d <breakpoint num> -- delete the specified breakpoint

Appendix B: Manual SDK download

In rare circumstances, the platform tools may not download the SDK correctly. In that case, please download the SDK for your operating system manually. Note: there's nothing Galago-specific about this SDK, and you may use a GNU ARM Cortex SDK built from source or provided by another vendor.

SDK for Mac - version 0.2.1

SDK for Linux - version 0.1.5

SDK for Windows - version 0.2