↓ Skip to main content

Dumping the Firmware from a Labelprinter I Bought at Action

Introduction.
#

So i went to Action once again and managed to bu a Fichero labelprinter for around 12 Euros. Its a label printer that uses a tape with labels and it is a thermal printer, meaning it uses no ink just heat. This is the same type used for printing purchase receipts, just that this one only prints small labels. It is wireless and has a battery inside. It communicates with the fichero App and connects via Bluetooth Low Energy (BLE) to your phone.

The device.
#

So i did not make any pictures of the unboxing and or the device pre-dissasembled, but below is a picture and the webpage of the device in the Action store (not sponsored).

Link to the article in the webstore

Printer_box
printer

After hooking it up to my laptop with a USB-C data cable, i found out that it pops up as a USB printer device. But i have not yet been able to get that working. Perhaps USB is mostly for firmware updates or it requires some special magic sauce to get working?

3rd party control software.
#

So there is an opensource project of someone that reverse engineered the mobile app (decompiled android APK) and found a way to speak to the printer with some python code to bypass the required app. This software is more for being able to control it via a desktop/laptop. It works quite nicely! Its primarily for Windows, but also seems to work on Linux (i did have to set the bluetooth adapter mode of my Linux system to support ble). here is the link. It works great, but i did not yet find anyone who dumped the firmware of the device, which i am more curious off. The python code emulates the ble commands the apps sends, but unfortunately has no USB support yet, so using it via USB as a USB printer remains a mystery.

Research.
#

So before we delve into dumping the firmware, first lets do some research on the main chip inside the device, which is a: YC3121-d. I searched up the datasheet for the chip. I found it on the JLCPCB parts website which you can find Here. It is in Chinese, but i translated it to English. View my translated English version. So this datasheet is quite handy! Looking through the datasheet, We can see that it has a 32 Bit RISC CPU inside and supports Bluetooth 5.0. It has 64KB of ram and 512KB flash and 8KB OTP (One Time Programmable) storage. And it has a bunch of other useful stuff and peripherals integrated into it.

block_diagram

Scrolling down to the pinouts, we can see the pinout of the chip and can see what each pin does. My chip is the variant with the suffix: -d. Below is the pinout of that chip.

Pinout

We can see here and in the first pages of the datasheet that it has USB, UART and SWD, which could be handy entry points into being able to talk with the chip and dump its code.

Attempt via USB.
#

So because it shows up on the computer as a USB device, means the datalines to the main chip are connected with the USB port and the USB port is not just charging-only. Sadly i quickly abandoned this method as no matter what i did, i could not get it into a sort of USB DFU (Device Firmware Update) mode. I tried both buttons and also tried a bunch of other stuff, but no luck. Time to switch to another method i guess….

Attempts via UART.
#

So near the main chip is an array of 4 pin holes. This looks suspiciously a lot like a UART serial port. And we know the chip has UART, so lets probe these pins and see if we can get anything interesting! Luckily for us, in that same GitHub repository with the python scripts to drive it via the computer, i found in the ‘issues’ tab someone had already labeled the UART for us on a picture which is nice. GitHub-Issues page

Uart

Sadly probing it did not find us much exciting stuff. Its not really verbose and there is no way to interact with it. Below is all i managed to capture of this UART port.

Boot start up... 
sUpDatePara.UpDateFlag==0

So it spits out 2 messages and thats it. I also tried throwing random bytes via the serial console, but got no change in behavior. So lets move on to a 3rd way!

SWD (Serial Wire Debug).
#

So last method is via SWD. SWD stands for “Serial Wire Debug” and it is commonly used on some micro controller chips to program/interact with them. Most commonly the ST-microelectronics chips or even the Rp2040, found on the Raspberry PI Pico can often be interfaced over SWD. SWD is a more streamlined and newer alternative as opposed to the classic JTAG (Joint Test Action Group) debug interface. Both JTAG and SWD allow debugging the chip on a very low level, meaning you can mess and interface with registers, memory and other low level stuff that normal UART or USB often dont expose/allow. JTAG is an older standard and also needs far more wires than SWD. SWD is a newer standard and uses just 3 wires, SWDIO (Data), SWCLK (Clock signal) and GND (sometimes 4 for a target reset line on some chips). One of those debug ports is often included in a majority of products as it allows debugging the system at a low level, often done in factory via a bed of probes that test the whole system and debug it in production/quality control.

You can use OpenOCD (Open On Chip Debugger) software to interface via JTAG or SWD to the chip you are testing. OpenOCD allows you to completely have control over the chip. You can do manipulate memory, read memory, write memory, read storage (if not protected), write storage (if not protected), manipulate code/registers and you can halt/freeze the CPU core and can also resume/reset it. In a nutshell: It gives you complete control over the silicon thats being tested. It gives more control than over UART or USB.It is a bit more complex/involved than, lets say, program an ESP32 chip over UART, but it does give more control.

SWD Probe.
#

So just like for UART, for SWD you need an interface device. Something that can talk the protocol and can communicate via USB to the computer. Then on the computer OpenOCD software talks over USB to that probe and thus can interface with the target chip you are testing/debugging. You can buy a dedicated SWD probe or something like a STLINK (ST-microelectronics SWD interface, primarily meant to interface STM32 chips), but there is no must. I used a Raspberry PI Pico i had laying around. Using some software i found online, i managed to turn it into a SWD probe.

Soldering wires to the chip.
#

So i inspected the PCB and unfortunately found out thatt they did not break out the SWD pins of the chip to some location on the PCB. That sucks, as it means i would need to directly solder microscopic wires to the very tiny fragile QFN (Quad Flat No leads) “pins” on the package of the chip. If there is one thing i am not that good at, it is micro soldering…. Anyways lets try it and see if i can do it.

After some trial and error and probably way to much solder flux, i managed to solder hair thin copper wires to the 2 SWD pins on the chip. Then i soldered those copper wires to some dupont wires, to break them out. I put a little bit of tape over the copper wires to hopefully prevent them from being easily torn off, but i might glue it down later.

Soldered_wires

Lets start our adventure!
#

So i talked a bit with Claude AI and it gave me this config file to use with OpenOCD. Download

transport select swd
adapter speed 100

# unknown chip: generic SWD DAP + Cortex-M target
swd newdap chip cpu -enable
dap create chip.dap -chain-position chip.cpu
target create chip.cpu cortex_m -dap chip.dap

# don't assume a reset line is wired
reset_config none

I hooked up the probe to the SWDIO and SWCLK lines on the chip and started OpenOCD with the script by running this command:

openocd -f interface/cmsis-dap.cfg -f yc3121.cfg

The first time i tried it, i accidentally had the wires reversed, so it did not detect anything, but swapping them over gave this:

Open On-Chip Debugger 0.12.0+dev-02429-ge4c49d860 (2026-03-08-17:19)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
none separate
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : Using CMSIS-DAPv2 interface with VID:PID=0x2e8a:0x000c, serial=E660B4404B390C36
Info : CMSIS-DAP: SWD supported
Info : CMSIS-DAP: Atomic commands supported
Info : CMSIS-DAP: Test domain timer supported
Info : CMSIS-DAP: FW Version = 2.1.2
Info : CMSIS-DAP: Serial# = E660B4404B390C36
Info : CMSIS-DAP: Interface Initialised (SWD)
Info : SWCLK/TCK = 0 SWDIO/TMS = 0 TDI = 0 TDO = 0 nTRST = 0 nRESET = 1
Info : CMSIS-DAP: Interface ready
Info : clock speed 100 kHz
Info : SWD DPIDR 0x0bb11477
Info : [chip.cpu] Cortex-M0 r0p0 processor detected
Info : [chip.cpu] target has 4 breakpoints, 2 watchpoints
Info : [chip.cpu] Examination succeed
Info : [chip.cpu] starting gdb server on 3333
Info : Listening on port 3333 for gdb connections

Awesome! It detected an ARM Cortex M0 core, so the chip accepts our debug connection and we can now interface and talk with it. To open the OpenOCD command line, we use telnet to connect to the GDB port, in our case its 3333 as indicated by this bit: Info : Listening on port 3333 for GDB connections. But yours could be different. Use the command below:

telnet localhost {GDB_port_number}

to check if we have full control, i first off tried to halt the CPU core. If we put in the ‘halt’ command and the system freezes, it means we have successfully frozen the CPU core and frozen the system and have full control over the chip.

Open On-Chip Debugger
> halt
[chip.cpu] halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x010290d8 psp: 0x0002f520

And success! The processor is now frozen and we managed to gain full control over the chip. Also the LED stopped blinking due to stopping the CPU core with openOCD ‘halt’ command. Some chips disable debug, but our chip seems to have it enabled. You can unfreeze/unpause the CPU core by issuing the command: resume which should resume all action. If the chip has some form of watchdog onboard, it might cause the chip to restart (due to the watchdog detecting that the system was frozen and thus activates the CPU reset line), but on our device that does not seem to be the case and it just continues operation with no issues. And yes, the led is blinking again and the system continues operation like nothing happened.

Actually dumping the firmware.
#

So now we have full control over the chip, we can go ahead and dump the firmware thats on the chip. The procedure uses the ‘dump_image’ command openocd includes. We do first have to halt the CPU core, to be able to read the flash in peace without any disturbances or barriers. I did it once with the CPU core active and running and it corrupted or did not complete the firmware dumps.

The ROM.
#

So Claude and i first decided to dump the ROM of the device, so we did it by executing these 2 commands in the OpenOCD shell. These will dump from the offset and address of the ROM: 0x0 0x8000.

halt
dump_image rom_dump.bin 0x0 0x8000          

After that, we did it again just to make sure we got a clean dump.

halt
dump_image rom_dump2.bin 0x0 0x8000          

Lets also compare the hashes and make sure both files are identical so we know our dump is good.

sha256sum rom_dump.bin
sha256sum rom_dump2.bin

and then seeing if both hash strings look identical/are the same. If they are, congratulations we dumped the ROM of the device!

The FLASH storage.
#

So lets now dump the flash. Going the same route again, just using the address and offset of the flash memory instead of the ROM address, which is: 0x01000000 0x80000.

halt      
dump_image flash_dump.bin 0x01000000 0x80000

After that, we did it again just to make sure we got a clean dump.

halt
dump_image flash_dump2.bin 0x01000000 0x80000

Lets again also compare the hashes and make sure both files are identical so we know our dump is good.

sha256sum flash_dump.bin
sha256sum flash_dump2.bin

and then seeing if both hash strings look identical/are the same. If they are, congratulations we dumped the flash storage of the device and now have a copy of its firmware!

Full firmware dump on my forgejo server

Signing off.
#

So this completed successfully! The hardest thing was soldering those microscopic thin wires to the microscopic qfn pins of the chip, but in the end it worked out! And its nice that there seemed to be no copy protection enabled on the chip, so we could read its firmware without a hitch. I will continue on this adventure, but in another part. In another part, i will try to reverse engineer the firmware with help and assistance from Claude AI and some tools to see what is possible with the device/firmware and to understand how everything is configured. And maybe in the end be able to get custom firmware running on it. Little spoiler: In the firmware where some interesting strings and there seems to be a custom boot mode which can be activated.

Author
309Electronics