PlatformIO is an open-source ecosystem for embedded development that we'll use to compile and manage our Marlin firmware for the Ender 3 printer. It integrates seamlessly with Visual Studio Code and provides all necessary tools and dependencies for building Marlin firmware.
- Visual Studio Code installed
- Open VS Code
- Click the Extensions icon in the sidebar (or press
Ctrl+Shift+X
) - Search for "PlatformIO"
- Install "PlatformIO IDE" extension
- Restart VS Code when prompted
Open the Marlin-2.1.x
directory in VS Code using:
- File -> Open Folder
- Select the
Marlin-2.1.x
directory
The project includes a platformio.ini
configuration:
Add the following to platformio.ini
:
[platformio]
default_envs = STM32F103RET6_creality
[env:STM32F103RET6_creality]
platform = ststm32
board = genericSTM32F103RE
framework = arduino
build_flags =
-DCONFIG_FILE=ender3/ender3-crtouch.ini
-DUSE_CONFIG_OVERRIDE
board_build.offset = 0x8000
The PlatformIO interface appears in the VS Code sidebar with several useful buttons:
- Home (House icon): Opens PlatformIO home screen
- Build (Checkmark icon): Compiles the firmware
- Upload (Right arrow icon): Not used for Ender 3 (we use SD card flashing)
- Clean (Trash icon): Cleans build files
- Click the PlatformIO Build button (checkmark icon)
- Wait for compilation to complete
- Find the compiled firmware at:
.pio/build/STM32F103RET6_creality/firmware.bin
After successful compilation, follow the flashing instructions in flashing-instructions.md to upload the firmware to your printer.
- Make changes to your configuration files in the
configs/ender3
directory - Clean the project using the PlatformIO Clean button
- Rebuild using the Build button
- Flash the new firmware following the flashing instructions
- If build fails, check the Terminal panel in VS Code for error messages
- Ensure all configuration values in your INI files are valid
- Verify the correct environment is selected in
platformio.ini
- Make sure all symbolic links are correctly set up as shown in the project structure
For more detailed configuration management, refer to the managing-configurations.md file in the project documentation.
- For flashing instructions, see flashing-instructions.md
- For configuration management, see managing-configurations.md