All Projects → im-tomu → Toboot

im-tomu / Toboot

Licence: gpl-3.0
Bootloader for the EFM32HG Tomu Board

Programming Languages

c
50402 projects - #5 most used programming language

Projects that are alternatives of or similar to Toboot

f1usb
Einfaches Beispiel für die Entwicklung eines USB FullSpeed Device auf Basis des STM32F103 ohne die Verwendung externer Bibliotheken
Stars: ✭ 27 (-58.46%)
Mutual labels:  usb, usb-devices
PIC16F1-USB-DFU-Bootloader
DFU protocol variant of Matt Sarnoff's PIC16F1-USB-Bootloader
Stars: ✭ 39 (-40%)
Mutual labels:  usb, bootloader
DfuBootloader
STM32 USB device bootloader using DFU class interface
Stars: ✭ 79 (+21.54%)
Mutual labels:  usb, bootloader
Dirtyjtag
JTAG probe firmware for STM32F1
Stars: ✭ 183 (+181.54%)
Mutual labels:  arm, usb
Hoodloader2
16u2 Bootloader to reprogram 16u2 + 328/2560 with Arduino IDE
Stars: ✭ 509 (+683.08%)
Mutual labels:  usb, bootloader
Arduino boards
Board definitions for SparkFun-manufactured AVR, ARM, and ESP-based Arduino boards.
Stars: ✭ 189 (+190.77%)
Mutual labels:  arm, bootloader
exynos-usbdl
Unsigned code loader for Exynos BootROM
Stars: ✭ 57 (-12.31%)
Mutual labels:  arm, usb
Sboot stm32
Secure USB DFU1.1 bootloader for STM32
Stars: ✭ 181 (+178.46%)
Mutual labels:  usb, bootloader
ws-ldn-12
ARM / STM32F7 DIY synth workshop
Stars: ✭ 62 (-4.62%)
Mutual labels:  arm, usb
getting-started
List of ideas for getting started with TimVideos projects
Stars: ✭ 50 (-23.08%)
Mutual labels:  usb, usb-devices
Jesfs
Jo's Embedded Serial File System (for Standard Serial NOR-Flash)
Stars: ✭ 104 (+60%)
Mutual labels:  arm, bootloader
Libwdi
Windows Driver Installer library for USB devices
Stars: ✭ 928 (+1327.69%)
Mutual labels:  usb, usb-devices
Ehal
Embedded Hardware Abstraction Library
Stars: ✭ 84 (+29.23%)
Mutual labels:  arm, usb
Gnu Eprog
Embedded Programming with the GNU Toolchain
Stars: ✭ 230 (+253.85%)
Mutual labels:  arm, bootloader
Usbdk
Usb Drivers Development Kit for Windows
Stars: ✭ 181 (+178.46%)
Mutual labels:  usb, usb-devices
stm32-usb-bootloader
This repository contains bootloader for stm32f1xx microcontrollers. It works for stm32f103ret6, but you can simply adopt it to any MCU supporting STM32 HAL library with USB and SD-card
Stars: ✭ 40 (-38.46%)
Mutual labels:  usb, bootloader
Openmoko Usb Oui
USB Product ID allocations for Free Software / Open Hardware
Stars: ✭ 156 (+140%)
Mutual labels:  usb, usb-devices
Usbdeviceswift
wrapper for IOKit.usb and IOKit.hid written on pure Swift that allows you convenient work with USB devices
Stars: ✭ 156 (+140%)
Mutual labels:  usb, usb-devices
buddy-linux
Do you remember "Wubi Ubuntu Installer"? This project is both a replacement and an improvement of Wubi. You will be able to install your Debian (or derived) distribution on a PC without repartitioning it, simply by using a secondary/external boot device (like a USB drive).
Stars: ✭ 17 (-73.85%)
Mutual labels:  usb, usb-devices
Usbguard
USBGuard is a software framework for implementing USB device authorization policies (what kind of USB devices are authorized) as well as method of use policies (how a USB device may interact with the system)
Stars: ✭ 668 (+927.69%)
Mutual labels:  usb, usb-devices

Bootloader for Tomu board

This repo contains Toboot and associated support files for the EFM32HG Tomu board.

Toboot is a DFU-based bootloader for Tomu that supports easy and driver-free firmware updates.

Using Toboot

When you insert Tomu, Toboot runs by default. Some programs (such as the u2f code) set the TOBOOT_CONFIG_FLAG_AUTORUN flag, and start running immediately. To enter Toboot on these devices, short out the two outer pins with tweezers as you insert Tomu:

Force Entry

When Toboot runs, the lights will flash like this:

Toboot Pattern

You should install dfu-util. Linux users can find it in your package manager. Mac users can use Homebrew. The Windows binary is provided in the bin/ directory. Chrome users can use a web version (but Linux users should make sure the udev permissions are set up correctly first.)

You can show a list of detected devices with dfu-util --list. You can load a new program image with dfu-util --download.

Toboot API

While Toboot supports jumping straight to code, it is also possible to take advantage of more advanced features such as secure sectors and automatic program booting. This requires setting up a configuration struct located at the correct offset.

More information on the Toboot API is available in API.md.

The API is specified in toboot-api.h.

Watchdog Timer

Toboot Sets the Watchdog Timer. Your program will reboot if the watchdog timer isn't cleared within a few tens of milliseconds. This is to ensure the code returns to the bootloader if you accidentally do something like flash an MP3 file, or try to program the .ihex version.

A quick-and-dirty way to do this is to put the following at the start of your program:

*(uint32_t *)0x40088000UL = 0;

Of course, it's better to actually use a Watchdog driver and keep the watchdog fed normally. But this will at least get you going.

Entering Toboot

By default, Toboot will always run when a board is powered on. To automatically run your program at poweron, create a valid Toboot V2.0 header and set TOBOOT_CONFIG_FLAG_AUTORUN. This was done to make it easy to develop software, because all you need to do to load new firmware is to unplug Tomu and plug it back in.

There are several reasons why a user might end up in Toboot:

  1. The config value doesn't have TOBOOT_CONFIG_FLAG_AUTORUN set, and the board has just been powered on.
  2. There is no main application loaded. This can happen if you've erased the flash, or if you've loaded an invalid binary. The program's start address must be in flash, and the stack pointer must be in RAM.
  3. The board has failed to finish booting three times in a row. This can happen if you've loaded an invalid program, or if you haven't cleared the watchdog timer.
  4. The magic value 0x74624346 is stored in the boot token area, at RAM address 0x20000000.
  5. The user shorts the two outer pads together when they apply power AND the program has NOT set TOBOOT_LOCKOUT_MAGIC.

Installing or Upgrading Toboot

If you have an old toboot that isn't booting after you flashed code, make sure to short pins 1 and 4 as shown above, before plugging tomu in.

To install Toboot, use the boosted files in the prebuilt/ directory. It's a 2 stage process: First, flash Toboot and then flash AN0042 (into the Toboot serial loader). FIXME: what does AN0042 stand for?

Toboot is unable to reflash itself. This is to prevent partial updates from corrupting the firmware. Instead, a support program is appended to the start of Toboot, and the entire thing is uploaded as one chunk.

Building Toboot

Toboot is designed to be simple to build. Ensure you have an ARM toolchain installed such as the official one from ARM, as well as make. Then simply build:

cd toboot/
make

Creating Updates

Toboot is not allowed to overwrite intself, to prevent partial updates from making a board unusable.

The Booster program is used to update or install Toboot. The source code is located in the booster/ directory. Use make-booster to wrap toboot.bin in a booster app, and flash the resulting image using dfu-util:

cd ../booster/
make
gcc make-booster.c -o make-booster
./make-booster ../toboot/toboot.bin toboot-booster.bin
cp toboot-booster.bin toboot-booster.dfu
dfu-suffix --pid 0x70b1 --vid 0x1209 --add toboot-booster.dfu

You can then flash the resulting toboot-booster.dfu using dfu-util, or using the legacy serial uploader to flash toboot-booster.bin:

dfu-util -d 1209:70b1 -D toboot-booster.dfu

Flashing onto a new Tomu

Brand-new Tomus will not have Toboot installed. Instead, they might have the SiLabs AN0042 bootloader.

The recommend way to load the bootloader onto a Tomu board is using a Raspberry Pi with OpenOCD. Instructions for doing this can be found in the openocd directory. You need OpenOCD version 0.10.0 or later to have EFM32HG support.

Tomu can be powered using the 3.3V pin, so you can create a sort of "programming wand" by bringing 3.3V, GND, SCK, and SIO out to a 0.1" header, running openocd in a loop, and touching the programming pins on the side of a Tomu board. The process only takes a few seconds, so contact doesn't have to be great.

Legacy Bootloader

SiLabs AN0042 was the original bootloader. It requires an IAR compiler to build, as well as custom drivers/software on the host device. This bootloader is available in the 'an0042' branch, and has been removed from the master branch. It is here for historical interest, and for compatibility with stock EFM32HG utilities.

License

This project is broadly licensed under GPL-3.0, except for toboot-api.h which is Apache-licensed.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].