Giter Site home page Giter Site logo

an0042-flasher's Introduction

an0042-flasher

I was given some tomu at LCA2020, but didn't get them flashed with toboot (which makes it easy to flash firmware using dfu-util), so needed to get that on there.

Luckily you can do that by using xmodem to send toboot over a USB serial connection that the boot loader on board provides. Unluckily it seems that more recent versions of macOS have made it much more likely that you'll hit a bug in the bootloader that makes uploads fail.

Thans to that bug I found the python library xmodem, which has even been modified to attempt to mitigate this issue, and so I wrapped that in a script that connects to the tomu, starts upload mode, sends toboot, and then tells the device to boot.

Because it still tends to fail a lot, I've alos included a simple script that just keeps retrying the entire process.

Prerequisites

I'm not a python person, so I haven't done proper things with requirements.txt or setup.py or what not. Sorry about that!

  1. On macOS you'll need Command Line Tools or Xcode installed (definitely will if you use homebrew to install python).
  2. Get python3 (on a mac use homebrew and brew install python)
  3. Install pyserial and xmodem. (I did this using: pip3 install pyserial --user, pip3 install xmodem --user)
  4. Plug in your tomu
  5. Download toboot-boosted.bin and put it in this directory

Run

  1. Run ls -lah /dev/cu.usbmodem* to find the device path for your tomu. For me it's always /dev/cu.usbmodem3101, but it could be something else. If you get multiple entries here, proceed with extreme caution - this script does not have any validation and thus you might try and write toboot to something else. Best case it crashes, worse case you could brick that other device. Update the value on the line in flash.py if needed: serial = serial.Serial('/dev/cu.usbmodemXXXX)

  2. ./flash-with-retry.sh

  3. If the script fails more than a few times, unplug & replug the tomu, this seems to help. Otherwise, just be patient & it'll likely work eventually. You can also use python3 reset.py to tell the boot loader to reset.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.