iTranslated by AI

The content below is an AI-generated translation. This is an experimental feature, and may contain errors. View original article
🫥

Developed a Tool to Help TinyGo Identify FAT Volumes on macOS Sequoia

に公開

Introduction

When using TinyGo on macOS Sequoia (15.0+), you may encounter an issue where tinygo flash reports that it "cannot find the board's FAT volume."

I previously wrote an article summarizing the cause of this issue:
https://zenn.dev/senoue/articles/92d043a07e4423

To help address this problem, I have created a small CLI tool called tinygo-flash-helper.

https://github.com/senoue/tinygo-flash-helper


Why this issue occurs (Changes in Sequoia)

In macOS Sequoia, the handling of /Volumes and the output specifications of diskutil have changed, causing TinyGo's findFATMounts to stop functioning correctly.

The main causes are as follows:

  1. The number of symbolic links in /Volumes has increased, causing diskutil info to fail.
  2. The key names in diskutil have changed (e.g., "File System Personality" → "Type (Bundle)").
  3. FAT might be reported as "MSDOS" instead of "FAT".

As a result, mounting for RP2040 and SAMD-based UF2 boards becomes invisible to tinygo flash.


What tinygo-flash-helper does

This tool does not modify TinyGo itself; instead, it provides "assistance to run the current version of TinyGo on Sequoia."

Specifically, it provides the following functions:

1. Listing FAT volumes

tinygo-flash-helper list

Internally, it performs the following:

  • Excludes symbolic links using Lstat.
  • Determines the FS type by checking multiple diskutil keys (FAT / MSDOS).
  • Lists all discoverable volume names.

This is also useful for confirming if the board is recognized as "NO NAME" instead of "RPI-RP2".


2. Adding volume names to TinyGo target JSON

If the volume name of an RP2040-based board appears as "NO NAME" on Sequoia, TinyGo may fail to recognize it.

You can correct the target file with the following command:

tinygo-flash-helper add-volume -volume "NO NAME"
tinygo-flash-helper add-volume -target xiao-rp2040 -volume “NO NAME”

This makes it easier for tinygo flash to work on Sequoia.

(It adds "volumes": ["RPI-RP2", "NO NAME"] to the TinyGo target JSON.)


Installation

go install github.com/senoue/tinygo-flash-helper@latest

Alternatively, clone and build:

git clone https://github.com/senoue/tinygo-flash-helper.git
cd tinygo-flash-helper
go build

Supported Environments

  • macOS Sonoma / Sequoia
  • TinyGo 0.39.0+
  • Go 1.23+
  • FAT/UF2 based boards (RP2040, SAMD21/51, nRF52, etc.)

The beauty of being able to create such tools easily with Go

While tinygo-flash-helper is a very small CLI, Go allows you to easily implement:

  • File attribute checks (os.Lstat)
  • External command execution (exec.Command)
  • JSON read/write
  • Cross-platform builds

all using only the standard library. The fact that you can quickly build "tools that immediately assist with field issues" is a great point. Creating your own improvement tools for the TinyGo ecosystem is one of the joys of using Go.


Conclusion

Although tinygo-flash-helper is strictly a "helper tool for using TinyGo on Sequoia," I hope it proves useful to those struggling with issues related to FAT volumes.

PRs and improvement suggestions are welcome!

https://github.com/senoue/tinygo-flash-helper

Discussion