How to compile and modify Prusa firmware: Part I setting up the environment
There are some occasions where you want to be able to edit and customize the firmware of your 3D printer. One reason is to update the configuration (measures, sensors, extruders etc), another is tweaking of some of the menu entries (like options for pre-heating), and finally you may want to edit / add functionality (add linear advance mode etc). In two tutorials I will describe how to set-up an environment on your computer in order to be able to edit and compile Prusa firmware. The first part will cover the set-up, the second part will cover the editing and tweaking. There are a some places on the internet where partial information of this guide is available as well. For credits check the end of this tutorial.
You should strictly follow this tutorial to minimize risks and damage. Only change settings that you fully understand, otherwise you risk damaging your printer in the worst case. We have carefully tested the changes to the firmware but we cannot take responsibilities for any damage.
In the following I limit the description to the Windows 10 operating system. This is especially true for the automated set-up. Linux enthusiasts will easily be able to adapt the manual part for their operating system as well.
- Install Arduino Software
As of this writing, Prusa firmware uses Arduino IDE 1.6.8 for firmware development. This is an integrated development environment (IDE) which includes a text editor and a compiler for the source code. We will modify the source code at certain places and the compile the firmware. Download the Windows version of 1.6.8 of the ArduinoIDE from:
When the download has finished, unzip the file into a directory of your choice. Here I used “W:\Zaribo\ZariboFirmware”. In the following I will refer to this as my “root” directory of the installation.
- Download PRUSA i3 MK2 Firmware
It is not recommended to use the latest source code version which may not even be released as a stable version. Instead I recommend to use a specific, relased (tagged) version like, 3.0.12, 3.0.11, etc. To download a zip file of the Prusa MK2 firmware, follow the link
In the link above please replace the number at the with the desired version number you want. Then extract the zip file into the “root” directory.
- Download the bootloader
This step is not really needed and is given here for completeness and to prevent one warning during the compilation process. Download the bootloader from the link
After the page opens save it into the following locations
Make sure the file is not save saved as .txt but as .hex. Rename the file if necessary.
- Install required libraries
In order to compile the firmware, we have to make a couple of changes to the installed libraries. First, goto the “libraries” folder in your installation folder and remove the “LiquidCrystal” library.Second copy the two directories “hardware” and “libraries” from the directory “Prusa-Firmware-MK2\ArduinoAddons\Arduino_1.6.x” into “Prusa-Firmware-MK2”. There are already two directories with these names. There will be some additional libraries added to these folders.
- Install the configuration file
In the directory “Prusa-Firmware-MK2\Firmware\variants” copy the file “1_75mm_MK2-RAMBo13a-E3Dv6full.h” to the directory “Prusa-Firmware-MK2\” and rename into “Configuration_prusa.h”
- Open the Arduino IDE
Now we can open the Arduino IDE by double-clicking “arduino.exe” in the directory “arduino-1.6.8”. This will open a window for the development environment. Now choose
File -> Openand load the file “firmware.ino” from the Prusa-Firmware\Prusa-Firmware-3.0.12\Firmware directory starting from your “root” directory. This will load all required files into different tabs in the IDE. Note the tab “Configuration_prusa.h” which we are going to modify later.
- Choose the Rambo board as target system
The Arduino IDE can compile code for different platforms / boards. Yow need to specify the Rambo board as target. Choose
Tools -> Board
- Test set-up for compilation
Now we can compile* the firmware with
Sketch -> Build (CTRL-R).
In order to create a .hex file for export the compiled binary use
Sketch -> Export compiled sketch (CTRL-ALT-S). When everything works properly, you should get only two warniung during the compilation process. At the end should see a message
The second way to install the environment is to use a script which does all the work. There is an existing script by aderusha which sets-up up the environment properly. The downside using this script is that it downloads the most recent version of the firmware source code that is still under development and not released as a working version yet. I have modified this script in order to download a specific, officially released version of the firmware. Please download the two files
Copy the two files to your “root” directory from where you want to execute the script and which serves as the base directory for further operations. In my case, I choose “w:\Zaribo\ZariboFirmware”
Currently, the script downloads version 3.0.12. If you want to use a different version instead please edit the file “Get-PrusaFwDevEnvMOD.ps1″. There are two ways for that. The first is edit with an ASCII editor, second is right click on the file and select edit which open the Windows Powershell ISE.
Line 42 contains the line $PrusaVersion=”3.0.12″ which is the version number. Change this number to the desired version you want to use. Then save the file and close the editor or the Powershell ISE.
Click “Windows button” and type “power”. Select “Windows Powershell”. This will open a Windows Powershell window, here change your working directory to your “root directory”, In my case “cd w:\Zaribo\ZariboFirmware” and execute the command “Get-PrusaFwDevEnvMod.cmd”. The script will start, download required files (Prusa firmware and Arduino IDE), extract files, copy and remove libraries, and set-up the correct configuration. The whole process will take a couple of minutes. While running the script informs on its current tasks. Ultimately confirm to “Run” the Arduino IDE. It will automatically load al required file. In the “Prusa-Firmware” directory a link (icon) is created that you can execute in future sessions. It will start the IDE and load the files.
Again you should verify our set-up by compiling (CTRL-R) the firmware, use
Sketch -> Build (CTRL-R). Besides two warnings, that we can ignore, the compile process should be executed smoothly.
The final step is to produce a .hex file that can be produced by exporting the compiled library. Use
Sketch -> Export compiled sketch (CTRL-ALT-S).
Uploading the firmware
After exporting the compiled binary two files are created in the directory “Prusa-Firmware\Prusa-Firmware-3.012\Firmware”
The Rambo board has an installed bootloader already, so we only need the first file. It’s a good practice to rename it to a more speaking name. Since we have not changed anything in the source code a good name could be “Prusa-MK2-3.0.12.hex”
Follow the official Prusa guide to upload the compiled .hex file: http://manual.prusa3d.com/Guide/Upgrading+firmware/66
Congratulations, when you successfully arrived here. You have set-up a working environment for compiling the firmware. In the second part of this tutorial, we will discuss how to change the firmware for Zaribo and also we will discuss some useful tweaks.
- Original script for automated downloading and setting up the environment by aderusha can be found under:
- Prusa firmware and a description on how to setup the environment by pboschi can be found under: