Skip to content

Instantly share code, notes, and snippets.

@johnnyman727
Last active September 2, 2016 00:22
Show Gist options
  • Save johnnyman727/23de244b454fd382e57d to your computer and use it in GitHub Desktop.
Save johnnyman727/23de244b454fd382e57d to your computer and use it in GitHub Desktop.
Detailed instructions on updated firmware/bootloader (worked heavily off of https://gist.github.com/kevinmehall/3eb4e87158dfc7a0fe64)
interface sysfsgpio
transport select swd
#RST 39
#SWCLK 41
#SWDIO 42
sysfsgpio_swd_nums 41 42
source [find target/at91samdXX.cfg]
# Get root access to device
dterm /dev/tty.usbmodem1422 #(or usbmodem1412)
# If device isn't already connected to wifi
# edit /etc/config/wireless with your wifi credentials (ssid, security (psk2 probs) and add option key= {your password})
# if this is a totally new board, use network and wireless settings from page 3 of https://docs.google.com/document/d/1K5FIAtoIwSWagSRgzCMo5ufcsJez_DsNyJhKYiiOFlk/edit# . Use nano as a text editor (like 'nano /etc/config/wireless' and 'nano /etc/config/network')
# Then connect to wifi
wifi
# Then make sure yellow led comes on and terminal reports authentication successful
# Update remote package repository
opkg update
# You will probably get the following error but don't freak out (it doesn't matter):
Collected errors:
* opkg_download: Failed to download http://downloads.openwrt.org/snapshots/trunk/ramips/mt7620/packages/tessel/Packages.gz, wget returned 8.
# download the package for openocd (used for programming samd21)
opkg install openocd
# get the ip address of your Tessel
ifconfig
# it will look something like this:
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:724 errors:0 dropped:0 overruns:0 frame:0
TX packets:724 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:50677 (49.4 KiB) TX bytes:50677 (49.4 KiB)
wlan0 Link encap:Ethernet HWaddr 02:A3:DB:18:BE:3D
inet addr:192.168.128.60 Bcast:192.168.128.255 Mask:255.255.255.0
inet6 addr: fe80::a3:dbff:fe18:be3d/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1273 errors:0 dropped:0 overruns:0 frame:0
TX packets:668 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1451297 (1.3 MiB) TX bytes:61670 (60.2 KiB)
# The address can be found in the wlan0 section under "inet addr": 192.168.128.60
# Copy the openocd.cfg file below into ~/openocd.cfg on the Tessel 2
# Run openOCD on Tessel 2 using settings from the config file you just created
openocd -f openocd.cfg
####
THE FOLLOWING COMMANDS ARE TO BE RUN ON A SHELL SESSION ON THE HOST COMPUTER, NOT TESSEL 2
####
# Clone the firmwware repo
git clone git@github.com:tessel/t2-firmware.git
# Download dependencies
git submodule update --init --recursive
# Build the firmware
make
# A whole bunch of shit will print out. Don't freak out. Too much.
# Now we will need to copy the SSH key of our HOST COMPUTER into the Tessel in order to remotely deploy the firmware binary. Find the public ssh key of your HOST COMPUTER (probably in ~/.ssh/id_rsa.pub unless you saved it someplace special... replace the path below if you did)
cat ~/.ssh/id_rsa.pub
# Copy the output from that command and paste it into /etc/dropbear/authorized_devices (the file may not be exist already)
nano /etc/dropbear/authorized_keys # and then copy and save (ctrl+x, y, enter)
####
Are you updating the bootloader? The file that is the argument to arm-non-eabi-gdb below will be /build/boot.elf below
Are you updating the firmware? The file that is the argument to arm-non-eabi-gdb below will be /build/firmware.elf below
####
# Place the IP Address of YOUR Tessel below (it's probably not the same) (and change the filename if you're updating the bootloader)
arm-none-eabi-gdb build/firmware.elf -ex 'target remote 192.168.128.60:3333'
# You will get output like below:
GNU gdb (GNU Tools for ARM Embedded Processors) 7.6.0.20131129-cvs
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=x86_64-apple-darwin10 --target=arm-none-eabi".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /Users/Jon/Code/vagrant-shared/v2-firmware/build/boot.elf...done.
Remote debugging using 192.168.128.60:3333
0x00000000 in exception_table ()
# Now you will be in a remote gdb session. First, reset the target (this may close your dterm session)
mon reset halt
# It will report something like this
target state: halted
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x00000a2c msp: 0x20000508
# Then load the new bootloader
load
# It will report more stuff:
oading section .text, size 0xc78 lma 0x0
Loading section .relocate, size 0x4 lma 0xc78
Start address 0x0, load size 3196
Transfer rate: 1 KB/sec, 1598 bytes/write.
# At this point, it has probably finished. Go ahead and quit
quit, y, enter
# Now you will want to power cycle Tessel 2 so the new firmware is run on the Atmel
# Then you're done!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment