Skip to content

OpenResearchInstitute/joco-2019-badge

Repository files navigation

joco-2019-badge

Code and documentation for the unofficial electronic badge for the JoCo Cruise 2019.

This is based on the excellent work that the AND!XOR team produced for the DEFCON 25 Bender Badge. It's a software revision designed to work on the badge hardware that was built for the 2018 cruise.

All code and hardware design files are closed until March 16th, 2019 and then are licensed under the Apache license 2.0 unless superceded by notices in individual files or directories.

Getting Started

Some resources must be installed outside of this source tree. One of these is the Nordic SDK.

Choose a place to install these on your file system. For example, we'll use "/src/joco-support/".

Download the version 12.3 of the Nordic SDK from here and unzip it into the directory you chose.

It's known that later versions of the SDK are not compatible with the existing badge code. We may work on fixing that, which is why we don't install the SDK in the source tree for the project.

Now edit your shell init or rc file to set the following environment variable when you create a shell, substituting your chosen path:

export SDK_ROOT=/src/joco-support/nRF5_SDK_12.3.0_d7731ad

Ubuntu Installation (non-ARM host)

Download the GNU ARM Embedded Toolchain. Choose one of these methods:

Then edit $SDK_ROOT/components/toolchain/gcc/Makefile.posix and change the value for GNU_INSTALL_ROOT to the directory where your toolchain was installed.

If you plan to hook up hardware for programming and debugging, you'll need the Segger JLink software. It's available from https://www.segger.com/downloads/jlink/ for a variety of host platforms. We used version V6.18b, but the latest version is probably fine. To install on Ubuntu on an Intel PC:

sudo dpkg -i <path-to-downloads>/JLink_Linux_V618b_x86_64.deb

You'll also need a couple of command line tools from Nordic. These are available from https://www.nordicsemi.com/Software-and-Tools/Development-Tools/nRF5-Command-Line-Tools/Download (change the platform on the left-hand side to Linux64). We used version 9.7.0, but the latest version is probably fine. Install them in a location outside this project, like the Nordic SDK. For example using the location "/src/joco-support", you can do the following:

mkdir -p /src/joco-support/bin
cd /src/joco-support/bin
tar xvf <path-to-downloads>/nRF5x-Command-Line-Tools_9_7_0_Linux-x86_64.tar

Now edit your shell init or rc file to set the following environment variable when you create a shell, substituting your chosen path:

export NRFJ_BIN=/src/joco-support/bin

Ubuntu on an ARM Host

If you want to develop on an ARM-based host, most of the components are available.

The Nordic SDK is the same.

You should be able to sudo apt-get install gcc-arm-none-eabi to get the toolchain.

You can get JLink software from Segger here

The command line tools nrfjprog and mergehex are not currently available for ARM hosts. You can use the JLink tools to program the device, so you can probably work around nrfjprog.

Build the code

cd firmware/src

make

cd ..

./update.sh

JTAG interface hardware

To flash the code to the badge and use the Ozone debugger, you'll need a JTAG hardware interface. The one that was used by the development team is the Segger J-Link EDU Mini.

It's much easier to connect to the board if you use a short flat cable and a mating header on the board end. All these can be purchased from these retailers:

Pin 1 on the J-Link EDU Mini is labeled with a (1) icon. Plug in the red edge of the ribbon cable that comes with the J-Link to this pin.

On the badge, look for the row of 10 holes in a 2x5 arrangement to the right of the RIGADO bluetooth chip on the top right. Pin 1 is not labeled, but is the square pad on the top left. Plug the 2x5 header into these holes, then plug in the red edge of the cable so Pin 1 is the top left of the header (which is plugged in to the square pad).

Flashing the target

Make sure the badge is powered on (ensure three AA batteries are inserted, then turn on the switch on the bottom left) before flashing the target.

After powering on the badge, there are two ways to flash. Either:

cd firmware

./provision.sh

or

cd firmware/src

make flash_softdevice

make flash

The make flash_softdevice can be omitted after the first time.

Updating the Micro SD card

The directory SD Image contains files which should be on the Micro SD card plugged in next to the screen.

Unplug the SD card from the badge, attach to a Micro SD card adapter, insert into an SD card reader, connect to a computer, then sync over the contents. For example:

rsync -rav SD\\\ Image/ /path/to/mounts/NO\ NAME

Setting up the Segger Ozone debugger

This was correct for Ubuntu 14.04.5 64 bit

Install the Ozone package from here

The manual is useful (same link)

IMPORTANT NOTE:

Ozone version 2.56 would not work for me. It would halt execution in seemingly random places and not load source code.

Version 2.54b works fine

If you're using the Segger edu device, Select the device as Nordic nRF52832_xxAA

Choose SWD for the debugger device and NOT USB.

open the badge .out file to bring in source files