All Projects → cvra → Can Bootloader

cvra / Can Bootloader

Licence: bsd-2-clause
The bootloader used to flash our CAN-connected boards

Programming Languages

python
139335 projects - #7 most used programming language
c
50402 projects - #5 most used programming language

Projects that are alternatives of or similar to Can Bootloader

HPS2FPGAmapping
SoCFPGA: Mapping HPS Peripherals, like I²C or CAN, over the FPGA fabric to FPGA I/O and using embedded Linux to control them (Intel Cyclone V)
Stars: ✭ 27 (-70.97%)
Mutual labels:  bootloader, can-bus
Dgos
Operating System
Stars: ✭ 90 (-3.23%)
Mutual labels:  bootloader
Kbfs
Keybase Filesystem (KBFS)
Stars: ✭ 1,218 (+1209.68%)
Mutual labels:  distributed-systems
Disel
Distributed Separation Logic: a framework for compositional verification of distributed protocols and their implementations in Coq
Stars: ✭ 85 (-8.6%)
Mutual labels:  distributed-systems
Microdot
Microdot: An open source .NET microservices framework
Stars: ✭ 1,222 (+1213.98%)
Mutual labels:  distributed-systems
Uuid Random
Fastest UUID with cryptographic PRNG for JS
Stars: ✭ 87 (-6.45%)
Mutual labels:  distributed-systems
Candb
Library for parsing CAN bus database description formats
Stars: ✭ 78 (-16.13%)
Mutual labels:  can-bus
Pgo
PGo is a source to source compiler to compile PlusCal into Go lang
Stars: ✭ 92 (-1.08%)
Mutual labels:  distributed-systems
Tractor
structured concurrent, Python parallelism
Stars: ✭ 88 (-5.38%)
Mutual labels:  distributed-systems
Dolphin
Distributed API Gateway
Stars: ✭ 84 (-9.68%)
Mutual labels:  distributed-systems
Micronucleus
ATTiny usb bootloader with a strong emphasis on bootloader compactness.
Stars: ✭ 1,240 (+1233.33%)
Mutual labels:  bootloader
Go2p
Simple to use but full configurable p2p framework
Stars: ✭ 80 (-13.98%)
Mutual labels:  distributed-systems
Storj
Ongoing Storj v3 development. Decentralized cloud object storage that is affordable, easy to use, private, and secure.
Stars: ✭ 1,278 (+1274.19%)
Mutual labels:  distributed-systems
Can Utils
Linux-CAN / SocketCAN user space applications
Stars: ✭ 1,216 (+1207.53%)
Mutual labels:  can-bus
Gotree
Gotree is a vertically distributed framework. Gotree's goal is to easily develop distributed services and liberate the mental burden of developers.
Stars: ✭ 91 (-2.15%)
Mutual labels:  distributed-systems
Sfs
The distributed object storage server used by PitchPoint Solutions to securely store billions of large and small files using minimal resources. Object data is stored in replicated volumes implemented like Facebooks Haystack Object Store. Object metadata which essentially maps an object name to a volume position is stored in an elasticsearch index.
Stars: ✭ 78 (-16.13%)
Mutual labels:  distributed-systems
Can library
Multiplatform Arduino library for supporting the native CAN controller on Due (SAM3X) and Teensy 3.1 (K2X) as well as MCP2515 through SPI
Stars: ✭ 81 (-12.9%)
Mutual labels:  can-bus
Docker Superset
Repository for Docker Image of Apache-Superset. [Docker Image: https://hub.docker.com/r/abhioncbr/docker-superset]
Stars: ✭ 86 (-7.53%)
Mutual labels:  distributed-systems
Cirrus
Serverless ML Framework
Stars: ✭ 93 (+0%)
Mutual labels:  distributed-systems
Nats Server
High-Performance server for NATS.io, the cloud and edge native messaging system.
Stars: ✭ 10,223 (+10892.47%)
Mutual labels:  distributed-systems

Bootloader protocol

Python tests

Unit tests

STM32 builds

This repository contains the code used for the bootloader running on every microcontroller in our robots. It allows us to quickly update the firmware on all (>20) boards quickly and without disassembly or additional electrical connections.

Config pages

The bootloader code is followed by two pages of bootloader config. The two pages are for redundancy and are checked by a CRC32 placed at the beginning of a page. The bootloader checks the configuration CRC at boot. If an invalid page is detected, its content is replaced by the redundant page.

After the bootloader has updated one of the two configuratio pages, it verifies it before proceeding to the second one. This ensures that there is always a valid configuration page to prevent bricking a board.

The config contains the following informations, stored as a messagepack map:

  • ID: Unique node identifier, ranging from 1 to 127.
  • name: Human readable name describing the board (ex: "arms.left.shoulder"). Max length: 64
  • device_class: Board model (ex: "CVRA.MotorController.v1"). Max length: 64
  • application_crc: Application CRC. If the CRC matches the bootloader will automatically boot into it after a timeout.
  • application_size: Needed for CRC calculation.
  • update_count: Firmware update counter. Used for diagnostics and lifespan estimation.

Performance considerations

Assuming :

  • CAN speed is 1 Mb/s
  • CAN overhead is about 50%
  • Protocol overhead + data drop is about 10%. The size of a write chunk might affect this since invalid data is dropped by chunk.
  • Binary size : 1 MB
  • The bottleneck is in the CAN network, not in the CRC computation or in the flash write speed.
  • The time to check the CRC of each board can be neglected.
  • We use multicast write commands to lower bandwith usage.

We can flash a whole board (1MB) in about 20 seconds. If all board in the robot run the same firmware, this is the time required to do a full system update!

Safety features

The bootloader is expected to be one of the safest part of the robot firmware. Correcting a bug in the bootloader could be very complicated, requiring disassembly of the robot in the worst cases. Therefore, when implementing the bootloader or the associated protocol, the following safety points must be taken into account:

  • The bootloader must never erase itself or its configuration page.
  • It should never write to flash if the device class does not match. Doing so might result in the wrong firmware being written to the board, which is dangerous.
  • If the application CRC does not match, the bootloader should not boot it.
  • On power up the bootloader should wait enough time for the user to input commands before jumping to the application code.

Building

  1. Run CVRA's packager script: packager.
  2. Build libopencm3: pushd libopencm3 && make && popd.
  3. Build your desired platform: cd platform/motor-board-v1 && make.
  4. Flash the resulting binary to your board: make flash.
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].