Skip to content

The Complete OSX CLI Guide

andy diller edited this page Jun 13, 2024 · 3 revisions

Build Fujinet Firmware on your Macintosh using just the terminal

Tested on OSX Sonoma, 14.5, 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

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

Note: 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

python3 ./get-platformio.py

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

pio platform install espressif32

source ./.platformio/penv/bin/activate

python3 -m pip install Jinja2

python3 -m pip install --upgrade pip setuptools

Pull the FujiNet Firmware repo and get ready to build it

cd ~/code

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

cd fujinet-firmware/

Find your local FN device on USB

Ensure you have connected the FN 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.

Edit the local.ini

Setup a target platform with build.sh

 ~/code/fujinet-firmware (master) $ ./build.sh -s fujinet-atari-v1

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

[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 you system.

Build the Target

./build.sh -cb

[builds for the platform....]

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:

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


ARM - M3 Pro:

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