The Complete macOS CLI Guide - FujiNetWIFI/fujinet-firmware GitHub Wiki

Build FujiNet Firmware on your Macintosh using just the terminal.

Tested on macOS Sonoma (14) with Intel Core i5 and Apple Silicon M3 chip, and Sequoia (15) with Apple Silicon M3 chip.

Install required packages

Install brew - will install xcode command line tools (build-env) and allow easier package installation and management.

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Make sure brew is in your path. Then use it to install these packages:

brew install python
brew install virtualenv
brew install cmake
brew install mbedtls

Install Rosetta2 (if on Apple Silicon)

/usr/sbin/softwareupdate --install-rosetta --agree-to-license

[!TIP] You must install Rosetta2 in order to build with Cmake, as there is no Apple Silicon cmake target as of 2024.

Install PIO (Platform IO)

cd ~

curl -fsSL -o get-platformio.py https://raw.githubusercontent.com/platformio/platformio-core-installer/master/get-platformio.py

python ./get-platformio.py

export PATH=$PATH:~/.platformio/penv/bin

pio platform install espressif32

source ./.platformio/penv/bin/activate

python -m pip install Jinja2

python -m pip install --upgrade pip setuptools

Ensure the pio command is in your PATH every time you start a shell - for next time you want to build:

echo 'export PATH=$PATH:~/.platformio/penv/bin' >> ~/.bashrc

Pull the FujiNet Firmware repo and get ready to build it

mkdir -p ~/code

cd ~/code

git clone https://github.com/FujiNetWIFI/fujinet-firmware.git

cd fujinet-firmware/

Find your local FujiNet device on USB

Ensure you have connected the FujiNet via USB and it's powered on so the Mac can see it.

$ ls -l /dev | grep tty.usb

/dev/tty.usbserial-1140

Save the output for the ini file.

[!NOTE] This number may change across connections and reboots - check this each time you connect your FujiNet to your Mac.

Edit the platformio.local.ini

Setup a target platform with build.sh

 cd ~/code/fujinet-firmware
 ./build.sh -s fujinet-atari-v1

or

 cd ~/code/fujinet-firmware
 ./build.sh -s fujiapple-rev0

depending on your platform target. Just run ./build.sh by itself and it will list all the targets at the end of its output. You must not use the platformio- or the .ini in the parameter above to create the platform build files.

[!TIP] Refer to this guide to targets to aid selection of the target to use for your FujiNet.

Now edit platform.local.ini that was created in the directory by adding:

[env]
upload_speed = 460800 ;921600
upload_port = /dev/tty.usbserial-1140
monitor_speed = 460800 ;921600
monitor_port = /dev/tty.usbserial-1140

Change your device to match the output of your system found above.

Build the Target

c will clean, b will build.

./build.sh -cb

[builds for the platform....]

If there are no errors you must flash the firmware:

./build.sh -u

You can and should also monitor the output, you can also combine the options - this builds, flashes and monitors the output:

./build.sh -bum

Debugging and Troubleshooting

$ pio system info
--------------------------  ----------------------------------------------
PlatformIO Core             6.1.15
Python                      3.12.3-final.0
System Type                 darwin_arm64
Platform                    macOS-14.5
File System Encoding        utf-8
Locale Encoding             UTF-8
PlatformIO Core Directory   /Users/dillera/.platformio
PlatformIO Core Executable  /Users/dillera/.platformio/penv/bin/platformio
Python Executable           /Users/dillera/.platformio/penv/bin/python
Global Libraries            0
Development Platforms       2
Tools & Toolchains          8
--------------------------  ----------------------------------------------

This works just as well on x86 Systems, you just don't need to install Rosetta.

Benchmarks:

Xeon E5 3.5Ghz (Trashcan MacPro):

Retrieving maximum program size .pio/build/fujinet-atari-v1/firmware.elf
...
==== [SUCCESS] Took 65.36 seconds ======


Quad Core i5 3.4Ghz 27" iMac:

Retrieving maximum program size .pio/build/fujiapple-d32pro/firmware.elf
...
==== [SUCCESS] Took 321.98 seconds ======


Apple Mac15,6 - ARM aka M3 MacBookPro:

Retrieving maximum program size .pio/build/fujinet-atari-v1/firmware.elf
...
==== [SUCCESS] Took 11.92 seconds =========


Intel(R) Core(TM) i5-5250U CPU @ 1.60GHz
(Macbook Air 11" running Ubuntu 24.04.1 LTS
 
Retrieving maximum program size .pio/build/fujiapple-rev0/firmware.elf
...
====== [SUCCESS] Took 68.92 seconds =======