在 macOS 上构建
安装 Homebrew
Homebrew 是 macOS 和 Linux 的流行包管理器,可以从命令行高效安装和管理软件。我们将用它来安装构建 Matrix OS 所需的依 赖项。
- 访问 https://brew.sh/ 并按照说明安装最新版本的 Homebrew
- 安装后,可能需要按照屏幕上的说明将 Homebrew 添加到系统 PATH。安装完成后,运行以下命令验证:
brew --version
安装依赖项
Matrix OS 代码库托管在 Git 仓库中,它还使用 Espressif IoT 开发框架来构建和上传到魔矩设备。通过运行以下命令安装依赖项:
brew install git cmake ninja dfu-util python3 psutil
克隆 Matrix OS 仓库
-
克隆 Matrix OS 仓库:
git clone https://github.com/203-Systems/MatrixOS.git -
进入克隆的仓库:
cd MatrixOS -
初始化 Matrix OS 仓库中的子模块:
git submodule update --init
安装 ESP IDF v5.3.1
运行以下命令设置 ESP IDF
mkdir -p ~/esp
cd ~/esp
git clone -b v5.3.1 --recursive https://github.com/espressif/esp-idf.git
cd ~/esp/esp-idf
./install.sh esp32
python3 $HOME/esp/esp-idf/tools/idf_tools.py install riscv32-esp-elf
构建 Matrix OS
-
Load ESP-IDF by sourcing it in your terminal session. You can run this command to set up ESP-IDF for the session:
source ~/esp/esp-idf/export.shIn the long run, you will want to automate this. You could add this line to your shell's configuration file (e.g.,
.zshrcor.bash_profile) or if you are using VS Code, you can modify the MatrixOS.code-workspace file and adapt it to run it on new terminal. You can also use.zshrcand addalias get_idf='. $HOME/esp/esp-idf/export.sh'. Then you can runget_idfto get esp idf in your environment. -
Go to the root folder of Matrix OS if your terminal isn’t already there.
-
Run this command to build Matrix OS:
make DEVICE=Mystrix build -
Prepare to upload to your Mystrix device. Make sure your Mystrix is in upload mode already.
-
Upload the compiled Matrix OS to Mystrix:
make DEVICE=Mystrix uf2-upload