Skip to content

Getting Started

Simon Schubert edited this page Jun 25, 2013 · 7 revisions

Getting started

The following list are generic instructions, regardless of your choice of bootstrap programmer. See below for instructions specific to the different bootstrapping methods.

Main steps

  1. Assemble board
  2. Install toolchain software
  3. Flash USB bootloader using external programmer
  4. Flash application code using bootloader via USB

Install toolchain software

  1. Download SAT (summon-arm-toolchain) from https://s3.amazonaws.com/mchck/sat-62efaf8-32bit.tar.bz2
  2. Extract SAT in your ~ (will create ~/sat)
  3. Clone git repo from git://github.com/corecode/mchck.git
  4. Install dependencies for the toolchain:
    1. ruby 1.9

Flash USB bootloader using external programmer

If your MC HCK already has a bootloader pre-programmed, you can skip this section.

First follow the Per-programmer instructions below.

  1. Connect programmer to MC HCK (see Per-programmer instructions)
  2. Run make in bootloader/usb-dfu to build the DFU bootloader
  3. Flash the bootloader with ruby ../../programmer/flash.rb $BACKEND dfu.bin 0

Flash application code

  1. Plug the MC HCK into USB (pad with folded paper to get solid contact)
  2. Press the program button - the MC HCK will attach as DFU device to USB: Bus 001 Device 125: ID 2323:0001
  3. Run make in examples/blink to build the blink demo
  4. Flash the blink demo with dfu-util -D blink.bin

Further steps

Remote debugging

Run ruby programmer/gdbserver.rb $BACKEND to start a gdbserver stub. In another terminal, use ~/sat/bin/arm-none-eabi-gdb myexec.elf to start gdb. Attach to the gdbserver stub with target remote :1234.

Reset or other exceptions will break into gdb as SIGSEGV, even tho the exception might not have been a segment violation.

You can use breakpoints and hardware watchpoints. If you use a write watchpoint (default when using watch), it will not work well for registers that do not change content after a write – gdb will automatically filter such accesses. Use awatch instead.

Per-programmer instructions

Bus Pirate

Extra dependencies

  • serialport gem:
    gem install serialport
        

Hooking up the programmer

  • 3V3 to DBG1 (topmost, just below upper row)
  • GND to DBG2
  • MOSI to DBG3
  • CLK to DBG4

images/mchck-r4-buspirate.jpg

Toolchain config

The Bus Pirate attaches as USB serial device. Find its device node in /dev/serial/by-id/; let’s call that $DEV. Use name=buspirate:dev=$DEV as $BACKEND.

Bus Blaster

The Bus Blaster’s CPLD must be flashed with a KT-Link buffer. I don’t quite remember how I did it, so please contribute information when you figure it out.

Extra dependencies

  • libftdi-ruby gem:
    gem install libftdi-ruby
        

Hooking up the programmer

  • VTG to DBG1 (topmost, just below upper row)
  • GND to DBG2
  • TMS to DBG3
  • TCK to DBG4

images/mchck-r4-busblaster.jpg

Toolchain config

The Bus Blaster is used directly via libusb/libftdi. You will have to specify the USB VID and PID in the backend config. Let’s hope you don’t have more than one Bus Blaster attached, or it probably won’t work. Set $BACKEND to name=ftdi:vid=0x0403:pid=0x6010.

Clone this wiki locally