Tag: embedded

  • Hardware hacking, part 2: the bench I work on and what each tool is for

    Hardware hacking, part 2: the bench I work on and what each tool is for

    Part 2 of 7 in the Hardware hacking series. Part 1: updating the firmware on a Pinecil V2.

    Nothing on my bench is expensive. I bought it one problem at a time, and that matters for this series. I’m not trying to show off lab gear. The point is how little it takes to look inside a device, and how little an attacker needs for the same job. If a cheap logic analyzer and a serial cable can show what a router prints at boot, then “nobody will ever open it” is not a security control.

    The rules before the tools

    Diagram: five device interfaces, the bench tool used to reach each, and the matching defender control

    I drew the diagram above. It links each interface a device exposes to the bench tool that reaches it and the control that closes it.

    Everything here happens on hardware I own and am allowed to take apart. No work devices, no borrowed ones, nothing that belongs to a neighbour or a client.

    I do not open, probe or connect anything that is plugged into mains. Many small devices, such as smart plugs, bulbs and some power bricks, have supplies that are not isolated from mains, so a board’s ground can sit at mains potential. I work on boards powered from a proper low-voltage adapter, a battery or USB, and if I am unsure what powers a board, I do not connect anything.

    Then the boring habits. Power down and unplug before soldering, swapping a chip or moving a probe onto a chip. For UART and logic captures I make the connections with the target off and power it up afterwards, from its own supply only, never from the serial cable as well. Ground goes on first and comes off last. I touch an earthed metal object, such as an unpowered PC case, before handling a board, and I hold boards by the edges, because static discharge can damage chips without any visible sign. If you use a wrist strap, use one with a built-in series resistor and never wear it near anything that could be connected to mains. Wear safety glasses when cutting leads or soldering, and keep some ventilation going.

    The iron: Pinecil V2

    I covered the firmware in part 1. It is a small USB-C powered iron running IronOS, and I use it for tinning wires, pin headers and joint rework. A hot tip burns skin and scorches a desk, so it sits in its stand while it is on, and I let it cool before putting it away.

    The logic analyzer: HiLetgo 24 MHz, 8 channels

    This is a cheap Saleae-style clone that works with the open source sigrok and PulseView software through the fx2lafw driver. It records when each of up to eight digital lines goes high or low. It does not measure voltage and it does not replace a multimeter. It gives you timing.

    Two things matter in practice. The sample rate tops out at 24 MHz, but a UART at 115200 baud has bits about 8.68 microseconds long, so at 24 MHz you get roughly 208 samples per bit, far more than needed. The other is voltage. I have not found a datasheet for mine, so I treat its inputs as unprotected with a threshold I cannot adjust. I measure the target’s logic level with a multimeter first, with the target powered from its own supply and nothing else connected, I connect the analyzer’s ground before any signal lead, and I do not expect it to read a 1.8V signal reliably.

    In part 6 I decode I2C and SPI with it. Here is PulseView with a capture loaded. This is a synthetic signal I generated with a Python script (8N1 at 115200 baud, written as a raw binary file and opened in PulseView), not a capture from a device.

    PulseView window with a synthetic 115200 baud UART signal on channel 0 and a millisecond time scale

    The trace is synthetic UART data on channel 0, with milliseconds along the top.

    The serial cable: FTDI FT232RL, 5V

    A USB-to-serial cable with an FTDI chip and a 6-pin 0.1 inch female header. It lets a PC talk to the UART console that many routers and embedded boards expose on a few unpopulated pads. A UART needs a transmit line, a receive line and a ground. The line idles high, and each byte is framed by a low start bit and a high stop bit. There is no clock, so both sides have to agree on the baud rate in advance.

    Mine is sold as a 5V cable, and I expect its data lines to be 5V too, not only the red power wire. I will confirm that by measuring the idle level of its TX line with the USB end plugged in. Many boards run their UART at 3.3V, and a 5V transmit line into a 3.3V receiver is the real risk, which leaving the red wire unconnected does not fix. I never connect the cable’s 5V wire to a target, I connect only ground, TX and RX (cable TX to target RX, target TX to cable RX), and I measure the target’s logic level first. Part 3 makes this cable safe on 3.3V targets, with the numbers worked out.

    The programmer: XGecu T48

    A universal programmer with a ZIF socket and a set of adapters (mine came with 19) for SPI and I2C EEPROM, NOR and NAND flash, microcontrollers and BIOS chips. Its software, Xgpro, is Windows only, so I won’t show screenshots of it here and I only download it from the vendor. Chips go in the socket once they’re off the board, which means desoldering, heat and a steady hand. Orientation and supply voltage have to be right before I start a read, because a chip in backwards or at the wrong voltage can be destroyed.

    The probe frame

    A small frame with four probe pens that holds against a board and touches the pads or pins of a chip without desoldering it. It is sold as a BDM frame, though it is just a probe holder and has nothing to do with Motorola’s debug interface. I use it when I can’t or won’t desolder something, and it is where most of my failed reads come from. The rest of the board is still attached to the chip, so other devices on the same bus can interfere. Back-powering can also damage the board or the programmer, so for in-circuit reads the board stays unpowered except for whatever the programmer supplies, at the voltage the chip expects. Part 5 covers reading in circuit, and why I read every chip twice and compare hashes before I trust a dump.

    The small stuff

    DOWELL micro flush cutters for trimming leads, always cutting away from my face because clipped leads fly. A pack of 120 Dupont jumper wires for temporary connections. A sheet of PTM7950 phase-change thermal pad for putting a device with a heatsink back together properly. A pad that has been removed gets replaced rather than reused, and old residue is cleaned off with isopropyl alcohol first.

    What is not on the bench

    No JTAG or SWD probe. Part 7 on debug ports is therefore about concepts, pinouts and how vendors lock those ports, not a walkthrough on my own hardware.

    Why a defender should care

    Every tool above is cheap and easy to buy, which is the whole argument. If your product ships with an open UART console, an unprotected SPI flash holding secrets in plain text, or a debug port that never got locked, assume someone with this bench will find it. The fixes are in the design: authenticate or close the console, encrypt and sign what is in flash, and fuse the debug port before shipping. The later parts show each of these on boards I own.

    Other parts of the Hardware hacking series: 1, updating the firmware on a Pinecil V2; 2, the bench I work on; 3, using my 5V FTDI cable on 3.3V UARTs; 4, finding the UART console on a router I own; 5, reading SPI flash without wrecking it; 6, decoding I2C and SPI with sigrok; 7, JTAG and SWD basics.

  • Hardware hacking, part 1: updating the firmware on a Pinecil V2

    Hardware hacking, part 1: updating the firmware on a Pinecil V2

    Part 1 of 7 in the Hardware hacking series.

    I do most of my soldering and rework with a Pine64 Pinecil V2, and it is the first tool in this series because it is the one I touch every time I open a device. This series is about the bench gear I actually own: the Pinecil, an FTDI serial cable, a cheap logic analyzer, an XGecu T48 programmer and a probe frame for chips I don’t want to desolder. Everything here is done on my own hardware, from the defender’s side. If you understand how a device looks from the inside, you know what an attacker with ten minutes and a screwdriver can learn about it.

    Firmware first, then. A soldering iron that talks USB-C power delivery and Bluetooth is a small computer, and it deserves updates like any other. The V2 runs IronOS, the open source firmware by Ralim, on a Bouffalo BL706 chip.

    Which release and which file

    As I write this (October 2026) the latest stable IronOS release is v2.23, published on 31 August 2025. Its changelog has a few items I care about: Bluetooth LE is now off by default on the V2, the default USB-PD negotiation uses a more conservative profile, and there are fixes for PD supplies that caused reboots with some laptops. Bluetooth support for the V2 first arrived in v2.21, so if you are on v2.21 or v2.22 this update switches it off by default, and anything older has no Bluetooth to switch off.

    The release page lists assets for every supported iron. For the V2 you want Pinecilv2.zip. The similarly named Pinecil.zip is for the original V1, which uses a different chip and a different file format.

    The Assets list of the IronOS v2.23 release on GitHub, with Pinecilv2.zip boxed in red and Pinecil.zip boxed in orange. Red annotation labels were added to the screenshot.

    That screenshot is the real GitHub page, with the two boxes and labels added by me. GitHub also shows a SHA-256 digest for each asset. After downloading I compared it with the local file:

    $ sha256sum Pinecilv2.zip
    fe75a2e3227ba53b7fdd8b0d8a362fc2ff0af264ce442ba76e26f21a3abb7503  Pinecilv2.zip

    That matches the full SHA-256 digest GitHub’s API reports for the asset (the release page truncates it, so compare all 64 characters, not just the start). It only proves the file I got is the file GitHub is serving, which is still worth ten seconds. Inside the zip there is one .bin per language. I use Pinecilv2_EN.bin, 194,508 bytes in this release. Ignore the .dfu and .hex files for a normal update. Pine64’s wiki is explicit that flashing a .dfu as firmware leaves the iron unable to boot.

    Putting the iron in flash mode

    This is the one step you can’t do from software. First a safety note: let the tip cool completely and park the iron in its stand before you unplug it or start fiddling with cables. If it boots normally instead of staying black, it is a live iron on a USB supply, so unplug it straight away rather than pressing buttons. Now unplug everything, hold the minus button, and only then plug the USB-C cable into the iron. Pine64’s wiki says to keep holding for around 10 to 15 seconds after plugging in. If the screen stays black, you are in flash mode. If it boots normally, unplug and try again, because the order matters.

    Screenshot of the Flash Mode section of the Pine64 wiki page on Pinecil firmware, including the warning not to use the DC barrel jack while updating.

    The warning at the top of that section matters. Pine64’s wiki says that using the DC barrel jack during a firmware update may destroy both your computer and the Pinecil, and that the iron is designed to use only one power port at a time. So for the whole update only the USB-C cable goes in: no barrel jack, no second supply, nothing on the other rear port.

    I have not photographed the iron’s own screen and buttons for this post yet, so the black-screen state and the on-device menus are described here rather than shown. In flash mode the iron does not appear as a USB drive. According to the wiki it shows up on Linux as a ttyACM serial device, and Windows lists it as a COM port.

    Flashing with blisp

    blisp is Pine64’s command line flasher for Bouffalo chips, and it is what I would reach for first. Version 0.0.5 (August 2025) is the current release and there are prebuilt binaries for Linux (x86_64, aarch64, armv7, riscv64), macOS and Windows. Unzip it, put it next to the .bin and run:

    sudo ./blisp write -c bl70x --reset Pinecilv2_EN.bin

    On Windows it is .\blisp.exe write -c bl70x --reset .\Pinecilv2_EN.bin from an administrator terminal, and the leading .\ matters. I can’t plug the iron into the machine I used for the screenshots, so I ran the real tool with no iron attached, in a throwaway Ubuntu 24.04 container:

    Terminal output in a dark theme showing blisp v0.0.5, the sha256sum of Pinecilv2.zip, the size of Pinecilv2_EN.bin, and the blisp write command ending in Device not found with exit status 3.

    “Device not found” with exit status 3 is what you get when the iron isn’t in flash mode, or when the cable is charge-only. If you see it with the iron attached, check the troubleshooting list below. I haven’t seen the success output because there was no iron on that machine. With --reset, blisp restarts the chip after the write.

    PineFlash, the GUI option

    Pine64’s wiki lists PineFlash as the GUI route. It is a community project by Spagett1, not a Pine64 product, and its latest release is 0.5.5 from April 2024. I ran the Linux AppImage in the same kind of container, under a virtual display:

    The PineFlash 0.5.5 window with the status Soldering Iron Disconnected, Pinecil V2 selected, and an empty version dropdown.

    The layout is simple: pick the iron, pick a version, pick a language, press Update. The Connection Guide section repeats the hold-minus instruction with a diagram. The problem showed up in the log panel:

    PineFlash log panel showing the line Invalid json downloaded, could not fetch versions, highlighted with a red box and an annotation label.

    On my run the version list never filled in, and the only entry in the dropdown was “Custom”. My network could reach GitHub fine, so it is probably not a plain connectivity problem, although I haven’t ruled out something like API rate limiting. I suspect the app is tripping on the newer release layout (v2.23 ships a metadata.zip asset), but I haven’t confirmed that. In practice, with PineFlash 0.5.5 you may need to download the .bin yourself and use the custom file option, at which point blisp is less work. I haven’t tested a real flash with PineFlash, so I won’t claim it works end to end.

    Checking the version and getting back out

    After the flash, unplug the iron and plug it in normally. Pine64’s wiki says to hold the minus button for a couple of seconds on the home screen to see the firmware version, and it should read v2.23. I would rather show you my own screen than paraphrase a wiki, so a photo of it will go in here later.

    Pine64’s wiki says the Pinecil is very hard to brick with a firmware update, and that re-flashing usually fixes a bad one: enter flash mode again and write a known good file. The flash-mode bootloader sits in the chip’s ROM, which is why that route is always available. To roll back, download the older release from the same GitHub page, take its Pinecilv2_EN.bin and run the same command. If something goes wrong, work through these in order:

    • Hold the minus button before the cable goes in, and keep holding for 10 seconds or more.
    • Try another cable. Some USB-A to USB-C cables carry power only.
    • Try another port, or another computer. Some laptop USB-C ports negotiate badly, and a plain USB-A port often works.
    • On Windows, name the port with -p COM3 (or whatever Device Manager shows). On macOS, allow the new device when prompted, then replug in flash mode.
    • Make sure you used the .bin, not the .dfu.

    Next is the rest of the bench: the tools I use to open up devices, and why each one earns its place.

    Other parts of the Hardware hacking series: 1, updating the firmware on a Pinecil V2; 2, the bench I work on; 3, using my 5V FTDI cable on 3.3V UARTs; 4, finding the UART console on a router I own; 5, reading SPI flash without wrecking it; 6, decoding I2C and SPI with sigrok; 7, JTAG and SWD basics.

  • Serial Consoles Considered Legacy?

    Serial Consoles Considered Legacy?

    I love how serial consoles are considered legacy by some, yet on dev boards it is the only way to interact with it until you have an OS installed. Ubuntu seems to not only no longer support serial console installs (last mention was 16.04 and even that required modifying the installer a little), but they seem to no longer support pxe as well..? I guess I’ll look into a “legacy” distro then. Cursor search suggests Debian still supports both serial consoles and pxe…