Skip to content

Building from source

Pirata edited this page Sep 20, 2024 · 6 revisions

VS Code

You can open the project folder on Visual Studio Code with PlatformIO extension and click on "PlatformIO: Build" on the bottom. After compiling the project, you need to merge the bootloader, partitions and the actual firmware on a single one, for that you can run the shell scripts "build.sh" or "build.bat", which will use esptool.py to output the binaries. You also need to run the "deauth_setup" to be able to compile. With this you will have 5 .bin files on the project folder, with they being the build for M5Cardputer, M5StickC Plus 1.1, M5StickC Plus 2, M5core and M5Core2.

LINUX BUILD

Requirements

sudo apt update
sudo apt install python3-pip git
pip3 install esptool --user
pip3 install platformio
export PATH=$PATH:~/.local/bin
source ~/.bashrc
echo 'export PATH=$PATH:~/.local/bin' >> ~/.bashrc
source ~/.bashrc
git clone https://github.com/pr3y/Bruce.git
cd Bruce

Fedora based just change to

sudo dnf update
sudo dnf install python3-pip git

After running the first time, a compilation error will occur (multiple definition of ieee80211_raw_frame_sanity_check).

pio run --target clean
pio run -e m5stack-cardputer
pio run -e m5stack-cplus2
pio run -e m5stack-cplus1_1 

To bypass the error we need to run only once

bash deauth_setup.sh

Step by Step to build the project

bash clean.sh
pio run --target clean
pio run -e m5stack-cardputer
pio run -e m5stack-cplus2
pio run -e m5stack-cplus1_1 
# or pio run to all builds
# pio run
bash build.sh

Windows build

  • Install Git
  • Install Python using the Microsoft Store
  • Install VSCode
  • Download the repository and extract it somewhere you want
  • Within VSCode, File>Open Folder... and select the folder of the firmware
  • If it doesn't prompt to install Platformio, click on "Extentions" (4 swares icon on the left) and install Platformio (and restart VsCode)
  • In the Status bar (down on the screen) click where is written Default (Bruce-main)
  • A little Menu will appear in the Search bar (up on screen), select your device "env"
  • Now click in the ✔️ Icon in the Status Bar (beside the cute little House), it will start building your project
  • if you want to upload directly, you can do it clicking in the "->" arrow to upload to your device

At this point you must have Pythons installed, probably PIP is installed too, if not, install it, because now its time to install Esptool

  • Open the Bruce folder with Windows Explorer
  • Click in the address bar, as if to edit it, delete all, type cmd and hit Enter, it´ll open the command prompt (windows terminal?) at the project folder
  • install esptool pip install esptool
  • now run "build.bat" and it will merge the bin files into one, so you can upload to your device with esptool --port COMx write_flash 0x0 Bruce3_<yourboard>.bin or python -m esptool --port COMx write_flash 0x0 Bruce3_<yourboard>.bin

Github

You can also use the Github workflow to build the binaries for you with Actions, the last releases are also available there on the Artefacts, but you can also fork the project and make the changes you want to this, then build on your own Actions also.