Skip to content

Running under Windows (Cygwin)

vintagepc edited this page Nov 23, 2021 · 5 revisions

🚧 Running MK404 with Cygwin (Work-in-progress) 🚧

Preparation

  1. Obtain a copy of MK404. You can opt to compile from source, but for your convenience, our Releases Page contains pre-compiled multiplatform zip files with all binaries ready to go.

  2. Get a copy of the Cygwin installer: https://cygwin.com/setup-x86_64.exe

  3. Obtain a firmware .hex file from either Prusa’s Drivers Page or Prusa’s Github releases

  4. Stock up on some Haribo. There are scary terminals ahead!

Cygwin Installation

  1. Install Cygwin using the installer downloaded above. You may install anywhere you wish, but this guide will assume that you are installing in C:\cygwin64 (the default). You may need to change paths in commands if you choose to change the installation location. Do not worry about choosing any additional packages. We will install them all at once in a subsequent step.

  2. Move or copy the installer to C:\cygwin64\cygwinsetup.exe. You will need it later!

  3. Open a Windows command prompt as Administrator. Open the Start menu, search for cmd, and right click it. Choose "Run as Administrator".

  4. Execute the following command. This will install all of the required packages automatically. If it does not work, double check that the path to cygwinsetup.exe is correct and you have adapted the paths in this command to a different installation location, if appropriate. C:\cygwin64\cygwinsetup.exe -qgnNdO -R C:/cygwin64 -s http://mirrors.kernel.org/sourceware/cygwin/ -P cmake,make,libelf-devel,gcc-core,gcc-g,libstdc-6-devel,git,libglut-devel,libGLEW-devel,libSDL_sound-devel,libSDL-devel,avr-gcc,python2,libpng-devel,xorg-server,xinit

  5. Once the installation is complete, close the command prompt. We are finished with this one.

Preparing MK404 for Use

  1. Locate your cygwin installation directory and then browse into the home\[username]\Documents folder it contains. Extract the contents of the MK404 multiplatform .zip file here. Note: you cannot run this EXE directly; it will complain that it cannot find various cygwin DLLs. It must be launched from the Cygwin shell.

  2. Also, place your firmware file here (either downloaded .hex or a self-compiled .elf/.afx file) for convenience.

  3. Steel yourself and have some Haribo. It’s Cygwin terminal time!

Locating MK404

  1. Locate and run the Cygwin64 Terminal from the Start menu.

  2. Run the following command to start the X11 server (Cygwin/Linux’s GUI system): export LIBGL_ALWAYS_SOFTWARE=1 followed by startxwin. If you are prompted whether to allow xwin.exe through the firewall, click 'Allow', as it uses the TCP protocol to receive connections from other local cygwin applications. LIBGL_ALWAYS_SOFTWARE is required as there are rendering bugs with freeglut’s menus, scaling, and WGL.

  3. You will need to have this running whenever you wish to start MK404. You will probably see a lot of logging output (but no errors) in the terminal. Relax and have a few more Haribo.

  4. Open a second terminal. We will now navigate to the location we placed MK404’s executable. Cygwin is a Linux environment for Windows, so the syntax and paths are different from what you may be used to; you will not be able to use standard Windows command prompt commands here.

  5. the cd command still changes directories, but:

    1. forward slashes (/) are used to separate folders and files

    2. Spaces in folder or filenames must be escaped (preceded) by a backslash (\).

    3. Windows drives appear as folders under /cygdrive/. For example, C:\ is /cygdrive/c/

  6. For example, if you placed MK404 in C:\cygwin64\home\Joe Public\Documents\MK404-v1.0.2, then the command you need to change to this directory is cd /cygdrive/c/cygwin64/home/Joe\ Public/Documents/MK404-v1.0.2/

  7. If you have issues, double check your spelling. Cygwin has tab completion, so use it to your advantage! Type a few letters of what you are looking for and press tab. It will either complete the rest of what you started to type (if there was only one option) or complete as much as it can before you need to type some more to tell it which of the printed choices you want.

  8. Have some more Haribo, you’re almost there!

Launching

  1. One last command must be run to tell the system we wish to use the X11 server for display. Execute the following command: export DISPLAY=:0.0. You only need to do this once per terminal session.

  2. Now you are ready to launch MK404! When you run the following command, you should see the UI appear: ./MK404-cygwin.exe -f firmware_file.hex. This will start MK404 and load firmware_file.hex into the flash memory of the simulated AVR. Be sure to change firmware_file.hex to match the file you wish to use!

    1. If you have issues, make sure the firmware file exists in this directory! Use ls to list the files in the current folder in the terminal.

  3. If everything worked, you should see MK404 appear and start running the firmware! You can close the MK404 window (or press q) to quit. See below for command line options and features you can now tinker with!

  4. Have some more Haribo. Maybe refill your supply, you’ll probably be tinkering for a while and will need to keep your energy up!

Command Line Options and Further Reading

  1. See Command Line for the available command line options, including printer models, 3D graphics and extrusion, SD card options, and more!

  2. See Key Controls for what key functions are available.

  3. See Mouse Functions for using the mouse to drive a few aspects of MK404

  4. See Main Window Reference for a quick overview of what is what in the main MK404 window and what all the indicators mean.

Clone this wiki locally