Ender 3 Marlin compile error

Im new to platformio i need to compile ender 3 pro firmware for filament runout.

I downloaded and installed VS code, platformio & auto build marlin extensions.
open my project and click the checkmark after making changes get error.

Error: Please setup environments in platformio.ini file

here is contents of my platformio.ini file as suggested by a youtube tutorial for the creality 4.2.7 32bit board.

[platformio]
src_dir = Marlin
boards_dir = buildroot/share/PlatformIO/boards
default_envs = STM32F103RET6_creality
include_dir = Marlin

Where exactly did you download Marlin from, in which branch?

What video are you refering to?

Teching techs video: Beginner guide to editing Marlin firmware - step by step - UPDATE IN DESCRIPTION - YouTube

i got firmware to compile for mega2560 but thats it, its 8bit and the default one the environment setup. i need the board microcontroller for the creality 4.2.7 board thats 32bit, i made a .hex firmware but i need .bin 32bit. guess i cant figure out what controller the board uses.

i got the marlin and marlin configs from the official marlin github 2.0.x newest stable firmware repo.

Can you upload the complete project folder that is currently non-working so I can get an idea of what you’re trying to do and what the exact error is? Google drive or github or whatever will work fine.

here is the folder with marlin and the config files for ender 3 pro.
https://drive.google.com/file/d/1p8MpzcQrceEIa4C-xqcnag3zQcQSYTCh/view?usp=sharing

it will compile a firmware.hex using mega2560 that works on the 1.1.4 melzi board. but i have the new 4.2.7 32bit board and cant find the controller to compile under… on chip it says STM32F103 on the physical chip and googling it shows (STM32F103RET6 creality) but compiling under that throws error and wont work.

here is the project loaded in arduino ide with the STM32F103RET6 (Maple) board. clicking compile i get this error output:

Arduino: 1.8.13 (Windows 10), Board: “Maple (RET6), 72Mhz (Normal), Smallest (default)”

WARNING: library U8glib claims to run on avr, sam architecture(s) and may be incompatible with your current board which runs on STM32F1 architecture(s).

sketch\src\HAL\AVR\u8g_com_HAL_AVR_sw_spi.cpp: In function ‘void u8g_com_arduino_init_shift_out(uint8_t, uint8_t)’:

sketch\src\HAL\AVR\u8g_com_HAL_AVR_sw_spi.cpp:71:15: error: cannot convert ‘volatile uint32* {aka volatile long unsigned int*}’ to ‘volatile uint8_t* {aka volatile unsigned char*}’ in assignment

u8g_outData = portOutputRegister(digitalPinToPort(dataPin));

           ^

sketch\src\HAL\AVR\u8g_com_HAL_AVR_sw_spi.cpp:72:16: error: cannot convert ‘volatile uint32* {aka volatile long unsigned int*}’ to ‘volatile uint8_t* {aka volatile unsigned char*}’ in assignment

u8g_outClock = portOutputRegister(digitalPinToPort(clockPin));

            ^

exit status 1

Error compiling for board Maple (RET6).

This report would have more information with
“Show verbose output during compilation”
option enabled in File → Preferences.

When I use your project and try to run it I get

C:\Users\Max\Downloads\Marlin>pio run
Error: Unknown environment names ‘STM32F103RET6_Creality’. Valid names are ‘BIGTREE_GTR_V1_0, DUE, STM32F103RC, FLY_MINI, STM32F103RE_btt, STM32F103VE_longer, esp32, DUE_archim_debug, jgaurora_a5s_a1, include_tree, DUE_USB, mks_robin_lite3, chitu_v5_gpio_init, STM32F7, mks_robin_stm32, at90usb1286_dfu, STM32F103RC_btt_512K, FYSETC_F6_14, sanguino1284p, STM32F103RC_btt_512K_USB, STM32F103RE, mks_robin, FLYF407ZG, rumba32, MightyBoard2560, teensy36, STM32F103RE_btt_USB, rambo, teensy41, DUE_debug, melzi, STM32F103RC_btt, SAMD51_grandcentral_m4, LPC1768, mega2560, trigorilla_pro, teensy31, ARMED, STM32F103RC_btt_USB, melzi_optiboot, mks_robin_pro, STM32F103RC_fysetc, mks_robin_e3p, melzi_optimized, FYSETC_S6, mks_robin_mini, MightyBoard1280, STM32F407VE_black, at90usb1286_cdc, mks_robin_e3, mks_robin_lite, BIGTREE_SKR_PRO, LERDGES, LERDGEK, LERDGEX, STM32F103VE_GTM32, DUE_archim, mega2560ext, sanguino644p, STM32F103RC_meeb, NUCLEO_F767ZI, LPC1769, malyan_M300, chitu_f103, STM32F4, mks_robin_nano35, STM32F103RET6_creality, teensy35, linux_native, STM32F103CB_malyan, STM32F070CB_malyan, STM32F401VE_STEVAL, BIGTREE_BTT002, STM32F070RB_malyan, mega1280, FYSETC_F6_13’

The error is correct since the environment is defined as

[env:STM32F103RET6_creality]

and not STM32F103RET6_Creality (mind the lower-uppercase).

After that, compilation starts but quickly runs into errors.

c:\users\max\downloads\marlin\marlin\src\pins\ramps/pins_RAMPS.h:51:4: error: #error “Oops! Set MOTHERBOARD to an STM32F1-based board when building for STM32F1.”

Looking at your Marlin\Marlin folder, the Configuration.h etc. files are for a #define MOTHERBOARD BOARD_RAMPS_14_EFB board. You seem to have placed the configuration files which you want to use in the Marlin/config folder, where they are completely ignored. They must be in the Marlin\Marlin folder.

Copying those over and re-running compilation gives me

Building .pio\build\STM32F103RET6_creality\firmware-20210321-193519.bin
Checking size .pio\build\STM32F103RET6_creality\firmware-20210321-193519.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [==        ]  16.0% (used 10480 bytes from 65536 bytes)
Flash: [====      ]  37.9% (used 198940 bytes from 524288 bytes)
============== [SUCCESS] Took 26.03 seconds ==============

Environment             Status    Duration
----------------------  --------  ------------
STM32F103RET6_creality  SUCCESS   00:00:26.030
=============== 1 succeeded in 00:00:26.030 ===============

So, all is well.

corrected the Creality to creality…
moved config/configuration.h and others to the correct folder of marlin.
checked the board is:
#define MOTHERBOARD BOARD_CREALITY_V427

thats what i need, im new to trying to compile as i said. but i get error when running. Fixed C to c and moved the config files to marlin folder gets me error.

Processing STM32F103RET6_creality (platform: ststm32@~6.1; board: genericSTM32F103RE; framework: arduino)
-------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/ststm32/genericSTM32F103RE.html
PLATFORM: ST STM32 (6.1.1) > STM32F103RE (64k RAM. 512k Flash)
HARDWARE: STM32F103RET6 72MHz, 64KB RAM, 512KB Flash
DEBUG: Current (jlink) External (blackmagic, jlink, stlink)
PACKAGES:
 - framework-arduinoststm32-maple 2.10000.200103 (1.0.0)
 - toolchain-gccarmnoneeabi 1.70201.0 (7.2.1)
Converting Marlin.ino
Error: stm32f1 family is not supported by maple core
==================================================== [FAILED] Took 4.25 seconds ==================================================== 

Environment             Status    Duration
----------------------  --------  ------------
STM32F103RET6_creality  FAILED    00:00:04.254
=============================================== 1 failed, 0 succeeded in 00:00:04.254 ===============================================

The terminal process "C:\Users\User\.platformio\penv\Scripts\platformio.exe 'run', '--environment', 'STM32F103RET6_creality'" terminated with exit code: 1.

about to just sell my printer and give up on this junk.

here is my new Marlin folder thats not working for me
https://drive.google.com/file/d/1R8xA30E9wX4Wgr6C1lBiT6h0EZw_w-m7/view?usp=sharing

something wrong with my enviroment setup in vs code? i have no idea what or if it even is. once i can get it to compile i need to figure out how to add filament runout, but i cant even get to compile yet.

EDIT: something in my enviroment is wrong on that one computer, i installed vs code on a new pc and ran the same marlin folder that i linked above after making the changes. creality 427 compiled. it says success but havnt tried to flash to printer yet

Weird, I do not get that error.

Processing STM32F103RET6_creality (platform: ststm32@~6.1; board: genericSTM32F103RE; framework: arduino)
------------------------------------------------------------------------------------------------------------------------Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/ststm32/genericSTM32F103RE.html
PLATFORM: ST STM32 (6.1.1) > STM32F103RE (64k RAM. 512k Flash)
HARDWARE: STM32F103RET6 72MHz, 64KB RAM, 512KB Flash
DEBUG: Current (jlink) External (blackmagic, jlink, stlink)
PACKAGES:
 - framework-arduinoststm32-maple 2.10000.200103 (1.0.0)
 - toolchain-gccarmnoneeabi 1.70201.0 (7.2.1)
Converting Marlin.ino
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Library Manager: Installing U8glib-HAL @ ~0.4.1
Library Manager: Warning! More than one package has been found by U8glib-HAL @ ~0.4.1 requirements:
 - marlinfirmware/U8glib-HAL @ 0.4.3
 - thinkyhead/U8glib-HAL @ 0.4.3
Library Manager: Please specify detailed REQUIREMENTS using package owner and version (showed above) to avoid name conflicts
Library Manager: U8glib-HAL @ 0.4.3 has been installed!
Found 30 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <SoftwareSerialM> 1.0.0
|-- <U8glib-HAL> 0.4.3
|   |-- <Wire> 1.0
|-- <STM32ADC> 1.0
|-- <EEPROM>
|-- <USBComposite for STM32F1> 0.91
|-- <Wire> 1.0
|-- <FreeRTOS701>
|-- <Servo(STM32F1)> 1.1.2
Building in release mode

Our versions are the same.

Try and use the CLI to execute the command pio upgrade --dev to get the latest core version – maybe something has changed.

i got it working on a new pc so ill just blow it away and reinstall the software on that pc. but i have a new issue haha. i compiled marlin 2.0.x and used the ender 3 pro example configs for 2.0.x. when bed is heating the screen constantly “click” as if button was pressed and makes a clicking sound from speaker. making the printer useless if bed is heating. and thats without me changing anything in the example config.

Maybe the people at Marlin can help you with that if you provide your exact configuration and branches information: Issues · MarlinFirmware/Marlin · GitHub

I’ll mark this thread as solved since you’re able to compile now.

I see for the v4.2.7 Creality board the default_envs to use is “STM32F103RET6_creality” however I’m trying to find out where I could confirm that myself? Is there a Marlin list of these settings per board somewhere?

(i.e. for the moment I’m just seeing in posts/videos that people are using “STM32F103RET6_creality”)

Hi @mixedup ,

Does this help? Boards | Marlin Firmware :wink:

Cheers,
Norm.

I don’t see the string “ STM32F103RET6_creality” here?

Hi @mixedup,

Interesting! And correct! My apologies. I thought that Marlin, at least, would have a board list! Last time I compiled Marlin software there was a lot more in the platformio.ini file than there is now. Looking around, I see that there’s an [extra_configs] section referencing a pile of *.ini files in the ini directory.

As your board has an STM32F103, I suspect you can find the correct default_envs setting in the file ini/stm32f1.ini file?

The “STM32F103RE” stuff begins on line 197. (At least, in the latest download of Marlin, version 2.0.8.2.)

HTH

Cheers,
Norm.