Skip to content

Extending and improving the Tinysafeboot (TSB) bootloader originally written by Julien Thomas.

License

Notifications You must be signed in to change notification settings

seedrobotics/tinysafeboot

Repository files navigation

tinysafeboot

Public repository to expand on Julien Thomas excellent Tinysafeboot bootloader for ATMEGA and ATTINY

The original Tinysafeboot, including detailed documentation if available from Julien's website at http://jtxp.org/tech/tinysafeboot_en.htm

In this repository, we publish our changes and improvements made to TSB. We have written a brief introduction to TSB and the new features we've added here http://kb.seedrobotics.com/doku.php?id=tsb:home

Git repository structure:

  • firmware_ASM/original_FW: includes the firmware part to be installed on the ATMEGA and ATTINY devices using ICSP, originally written by Julien Thomas.
    This implementation has a bug when operating in Daisy chain (multiple devices connected in parallel). See issue #1
  • firmware_ASM/latest_stable_release/20170626-autobaud: bugfix for issue #1 in the tracker (inherited from Julian's code).
  • firmware_ASM/latest_stable_release/20200727-fixedbaud: Communication routines are rewritten to use the processor's native UART. It is the prefered version where using the native UART is a possibility as it includes may improvements. Open the folder latest_stable_release and see the README for more information.
  • software/tsb_loader_original: the original TSB Loader (PC software) written by Julien Thomas in FreeBasic.
    You can use this program to produce TSB binaries for your processor without needing to use an ATMEL assembler.
    If using this tool to read code from your processor, beware that it has a bug when saving to BIN files (it won't save the last byte); save to Intel HEX instead which does not have this issue.
    Binary versions produced by the tool also have the Daisy chain/Password escape bug and are of the Autobauding variant. Beware!
  • software/tsbloader_advanced: our completely re written TSB loader in Mono (C#) for cross platform compatibility.
    This new loader has several advantages:
    • NEW for the 20170626-autobaud version of the firmware: due to the communication timeout implemented in this version, it is recommended to use tsbloader_adv version 1.0.9 or higher
      Using earlier versions may result in an error when setting Password, TImeout or Magic bytes (this is because this information needs ot be passed quickly to prevent bootloader session timeout).
      Version 1.0.9 fixes this by asking this information to the user beforehand, and only after having it on hand, will it initiate the bootloader session.
      ( if using the GUI versionc you also need version or above to work correctly with tsbloader_adv 1.0.9 or newer)
    • You can specify the device Activation password on the command line (actually several individual passwords, if you are on a Daisy chain), thus eliminating the timeout you had in the original version before you could enter the password
    • Communication relies on the OS buffers to detect arrival of device replies, which makes this code significantly faster to run (for example at 19 200 bps it can be up to 5x faster than tsb_original, which uses hard coded wait times).
    • Extremely verbose output: in case of error you are told exactly what is wrong
    • Ability to perform multiple operations in one single TSB session (for example, a firmware erase/write/verify in one go).
      In the original TSB Loader, you need to reset the processor and start a new TSB session for each individual operation.
    • Configurable pre_wait times and reply_timeout times makes it extremely versatile when dealing with self resetting boards (Arduino-style)
    • Automatically repeatable operations for multiple devices: if you have devices on a daisy chain with unique passwords, you can provide a list of device passwords and all operations are performed on each of them, one at a time (your board needs to have an auto reset capability based on DTR transitions, similar to the Arduino implementation)
    • It implements a clever work around to overcome the bug on Daisy chain operation where silent devices might escape the "wrong password" lock, go into Emergency Erase confirm mode and subsequently boot. This loader can be used to attempt a bugfix on older, affected bootloaders.
      While this fix does not prevent them from booting, it forces the devices out of the "wrong password lock" before initiating any communication in order to prevent interferences from the Emergency erase confirmation.
    • Adds the ability to store 2 user defined "Magic Bytes" (useful for model numbers, batch identification, etc)
    • What it does NOT DO: it will not produce the TSB binaries to load on your ATMEGA/ATTINY device. If you need that feature, please use TSB original.

For further information see our introduction to TSB here http://kb.seedrobotics.com/doku.php?id=tsb:home

About

Extending and improving the Tinysafeboot (TSB) bootloader originally written by Julien Thomas.

Resources

License

Stars

Watchers

Forks

Packages

No packages published