The mm-sdk contains everything you need to build a MadMachine project, either a library or an executable.
A MadMachine project is structured the same as a Swift package.
Download the latest release depending on your OS on the Releases page.
What is inside the SDK
- Board abstraction libraries based on Zephyr
- Python script to help to build the project
- usr (This directory is only contained in the release package, not in the git repo)
- Clang, Swift compiler, SwiftPM tools, etc.
- Standard library and arch related libraries
- Compiled Python build tool
Usage (macOS and Linux)
Install required dependencies:
Install XCode and open it so it can install any necessary components.
sudo apt-get install \
sudo apt-get install \
Download the mm-sdk
Download and unzip the sdk to the directory
~/mm-sdk/usr/mm/mm -h command for quick help.
~/mm-sdk/usr/mm/mm init -h command for quick help about initializing a project.
~/mm-sdk/usr/mm build -h command for quick help about building a project.
Initialize an executable
~/mm-sdk/usr/mm/mm init -b SwiftIOFeather
python3 ~/mm-sdk/mm/src/mm.py init -b SwiftIOFeather
Package.swift should look like below
// The swift-tools-version declares the minimum version of Swift required to build this package.
let package = Package(
// Dependencies declare other packages that this package depends on.
.package(url: "https://github.com/madmachineio/SwiftIO.git", .upToNextMajor(from: "0.0.1")),
.package(url: "https://github.com/madmachineio/MadBoards.git", .upToNextMajor(from: "0.0.1")),
.package(url: "https://github.com/madmachineio/MadDrivers.git", .upToNextMajor(from: "0.0.1")),
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages this package depends on.
// use specific library would speed up the compile procedure
.product(name: "MadDrivers", package: "MadDrivers")
Build an executable
python3 ~/mm-sdk/mm/src/mm.py build
Download an executable to the board
After building your project successfully, there would be
.build/release/feather.bin in your project directory. Note that the
.build directory is hidden by default.
Follow those steps to download the executable:
- Insert an SD card into the board and connect it to your computer through USB cable
- Press the Download button and wait until the onboard RGB LED turns to static green)
- A USB disk drive should be mounted on your computer
- Copy the
feather.binto the SD card root directory
- Eject the USB drive and the program would run automatically
Download an executable to the board using command (Only on macOS now)
After mounting the SD card:
python3 ~/mm-sdk/mm/src/mm.py download
This command will find the corresponding bin file, copy it to the SD card and eject the SD card automatically.