Build Log MKS Gen L

I didn’t find a writeup that I could follow well, so I’m going to start one here.

I had originally thought to use some Arduino Uno and CNC shields to drive my CNC projects, but they only support 4 steppers, and MPCNC needs 5, so, I purchased a Makerbase MKS Gen L V2.0 Control Board/Mother Board from Zyltech ($25 as of September 2020). I already had a dozen A4988 driver modules from my playing around with the CNC shield, so I didn’t need any more.

I wasn’t sure what firmware to use. Poking around the forums pointed me to this page on github:

which points to this page for getting Marlin compiled:

More to come once I work on it a little more, but I wanted to get my thoughts in order before stepping away from the computer.

You can use three driver boards. You just need to wire the double motors in serial.

Looking good though.

So, IDE downloaded and installed. I changed the motherboard line as follows:

// Choose the name from boards.h that matches your setup

When I tried to compile I got an error that said:

Arduino: 1.8.13 (Windows 10), Board: “Arduino Mega or Mega 2560, ATmega2560 (Mega 2560)”

sketch\src\HAL\AVR\u8g_com_HAL_AVR_sw_spi.cpp:65:10: fatal error: U8glib.h: No such file or directory

#include <U8glib.h>


compilation terminated.

exit status 1

Error compiling for board Arduino Mega or Mega 2560.

Quick google search found the solution in reply #1 at:
which says to:

Do this:

Sketch > Include Library > Manage libraries
Wait for download to finish
In the "Filter your search" box, type "u8glib".
Scroll down until you see "U8glib by oliver". Click on it.
Click "Install"
Wait for installation to finish
Click "Close"

Which got me to a new error:

Arduino: 1.8.13 (Windows 10), Board: “Arduino Mega or Mega 2560, ATmega2560 (Mega 2560)”

fork/exec C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-gcc.exe: The filename or extension is too long.

Error compiling for board Arduino Mega or Mega 2560.

I’ve tried several fixes so far, but haven’t had any luck. I’ll keep looking.

That looks a little bit different than the error I was expecting to see. Arduino includes every file in Marlin, and there’s no way to separate them. The result is an enormous command line. The only two solutions I’ve seen are to remove files you don’t need from the HAL or to use platformio instead.

I’m using an MKS Gen L v1.0.

I’m using pretty much default setup that I got downloading Marlin for the MPCNC. The motherboard is defined as a Mega2560/RAMPS 1.4. I did have to install the U8glib library, which went off smoothly.

Filename too long is usually Windows griping about some path that’s more than 256 characters. This sometimes happens when you’ve got folder redirection turned on, and something has a longer name than it should. For libraries like that, sometimes it happens if your username is longer than normal. C:\Users\JohnJacobJingleheimerSchmidtHisNameIsMyNameToo\AppData\Local\ makes for a long home directory name, lol. (I think Windows does truncate this sometimes) but it also sometimes appends the domain name in some circumstances. I have one machine that insisted on Dan.DMGCONSULTING.LOCAL as a directory name that had some issues with “path too long”

Check the version of u8glib. I had that problem. I had version 1.18.0 and couldn’t compile with it. I am now using version 1.19.1 and it worked for me.

Yeah, looks like the current command is 37,602 characters long (I enabled verbose debugging, and used notepad++ to get a count). I guess I’ll start deleting files from the HAL.

Got it to compile. I deleted the folders ESP32, LPC1768, STM32, STM32F1, STM32_F4_F7, TEENSY31_32, and TEENSY35_36. This left me with only AVR, DUE, LINUX, SAMD51, and shared.

Upload worked, and M503 using pronterface shows the values I’d expect. Time to power down and do a little wiring.


I do have builds in the MarlinBuilder releases that deletes extra HAL folders so it will compile in windows. The builds are all in linux on the server.

What microstepping do you recommend?


MKS Gen L 2.0 and MKS Gen L 1.0 are quite different. The 2.0 has headers to support the UART/SPI (or something) for the smarter TMC style drivers, while the MKS Gen L 1.0 assumes only step/dir interface is being used. With the MKS Gen L 1.0, wiring UART or SPI is probably possible but takes extra jumper wires and redefining pins.

Try MOTHERBOARD of MKS_GEN_L_V2. I think that will make a big difference.

The default driver type is set to DRV8825. I changed this to A4988 in configuration.h per the video from makerbase at:

I installed one driver, and power from my 24V PSU, and checked that the motor turned. Looks good! Now to wait for my last XYZ part to finish printing before I can go any further.

Thanks, I missed that when I read through the boards.h header file.