Error compiling Marlin 3D printer software

I am trying to compile the Marlin 1.1 package for an Anet A6 3D printer using the platformio.ini file included in the download from GitHub. I get the following error message:

#error “Oops! Make sure you have ‘Anet V1.0’, ‘Anet V1.0 (Optiboot)’ or ‘Sanguino’ selected in the ‘Tools -> Boards’ menu and ATmega1284P selected in ‘Tools -> Processor’ menu.”

I cannot find a Tools menu in VSCode and when I try using the Arduino IDE to do this, I get a Tools -> Boards option, but not Tools -> Processor. Within Tools -> Boards I can either select Anet V1.0 (Optiboot) or ATmega1284P but not both. Selecting either one of these does not remove the error message.

What am I doing wrong?

What Github repo are you using and how did you the modify the platformio.ini?

Thanks for your reply. I downloaded Marlin1.1.x from here:

I replaced the Configuration.h and Configuration_adv.h files with the corresponding files in the Marlin/example_configurations/Anet/A6 folder and edited the Configuration.h file to enable auto bed levelling. I did not change platformio.ini, but I did try moving the env for the “Sanguinololu (ATmega1284p)” to the head of the env list, as this is what the Anet A6 control board uses, but that made no difference.

In PlatformIO platforms section in VSCode, the only entry is Atmel AVR and in the boards section I didn’t see anything that I recognised.

I should say that I am new to PlatformIO and am trying it because I (and several others) have previously failed to get the Marlin code to compile on the Arduino IDE.

The used environment is not determined by the order of the environments in this case, but by what env_default is set to.

So you need to change it to

env_default = sanguino_atmega1284p

Refer to the documentation.

Thanks again for your prompt reply and the advice about the env_default definition, also the link to the documentation.

After setting env_default = sanguino_atmega1284p, and installing the U8glib library, the package seems to have compiled successfully, but didn’t load because of text overflow:

Compiling .pioenvs/sanguino_atmega1284p/src/Marlin.ino.cpp.o
Linking .pioenvs/sanguino_atmega1284p/firmware.elf
/Users/HAJM/.platformio/packages/toolchain-atmelavr/bin/…/lib/gcc/avr/5.4.0/…/…/…/…/avr/bin/ld: .pioenvs/sanguino_atmega1284p/firmware.elf section .data' will not fit in regiontext’
/Users/HAJM/.platformio/packages/toolchain-atmelavr/bin/…/lib/gcc/avr/5.4.0/…/…/…/…/avr/bin/ld: region `text’ overflowed by 298 bytes

Have you any idea what .data consists of in a C/C++ program? Obviously, I either need to reduce it, or perhaps make more space by specifying the Optiboot bootloader, if that is not already the default. In the Arduino IDE, I can choose whether or not to specify it or an older larger bootloader. Do you know if this can be done in PlatformIO?

Well with the default config the program is already at

DATA:    [===       ]  27.6% (used 4515 bytes from 16384 bytes)
PROGRAM: [========= ]  87.1% (used 113258 bytes from 130048 bytes)

So that feature you added doesn’t fit in 17KB of .text? Which macro was it exactly?

I had another look at the changes I had made to Configuration.h and saw that I had enabled a feature that I didn’t need. When I disabled this feature the program compiled and loaded ok.

I got a few compilation warnings which I hope are not critical and will try to upload the modified software later today.

Thanks again for all your help. I really appreciated it.

1 Like