These sources are the original sources from the Chromium OS Embedded Controller project, stripped down to the minimum required to build the Twinkie/Twonkie firmware.
Beyond what your distro should provide anyway, you'll need arm-none-eabi-gcc
to build the firmware and not much else.
make -j BOARD=twonkie
for Twonkie v1 hardwaremake -j BOARD=twonkiev2
for Twonkie v2 hardwaremake -j BOARD=twinkie
for the original Twinkie
The completed firmware will end up in build/<BOARD>/ec.bin
and can be flashed
as is.
Or you can run buildall.sh
to build all three images.
Check out the GitHub Releases page for pre-built firmware images.
For flashing you'll need dfu-util
. On Linux your package manager should offer
a package for it, for Windows you can find builds on their SourceForge site.
There are several ways to put Twinkie or Twonkie into bootloader mode:
- Twonkie only: Via the bootloader button. Press and hold the button while plugging in the USB cable.
- Via a cursed OTG cable. Plug an A-to-A USB cable into an USB-OTG adapter and use that concoction to connect Twonkie to your computer. The OTG adapter pulls the ID pin on the Micro-B connector high, a circuit on the Twonkie board detects this and asserts the STM32's bootloader signal.
- Via the
dfu
command at the USB console. Obviously this only works once there's a working firmware on the chip.
dfu-util -a 0 -s 0x08000000 -D ec.bin
If you entered DFU mode via the button or a cursed cable, just unplug Twonkie and plug it in again using a regular cable.
If you entered DFU mode via the dfu
command at the console, you have to
switch back using this command:
dfu-util -a 0 -s 0x08000000:force:unprotect
This will not actually flash anything, it will only exit the bootloader.
Twonkie has a simple console mode using a pair of bulk USB endpoints. In Linux,
the USB serial driver should support this mode and make the console available as
/dev/ttyUSBx
. If that device doesn't show up immediately you can try
sudo modprobe usbserial
echo '18d1 500A' | sudo tee /sys/bus/usb-serial/drivers/generic/new_id
For Windows there's a simple USB console program in util/shell.py.
It requires the libusb1
package from PyPI.