PlatformIO Community

Compile error "variant.h: No such file or directory

Hi guys, I am currently using this board to program a 3D printer (
and i get error like the picture i have described like here.
I have attached the board diagram and the latest Marlin code. and my Config files
I use Platform IO to flash code
Hope you guys can help me with this error and I’m also a non-programmer

here is my code link

Do you want to use this STM32F401CE board to programm / flash another 3D printer or do you want to develop your own 3D printer with that board as the main controller?

To me it looks like you made an attempt to add your own platformio.ini environment into Marlin to compile Marlin for a STM32F401CE chip… Expanding Marlin to work in a new environment definitely requires a good understanding of Marlin and programming.

1 Like

yes I want to use this STM32F401CE to make my own 3D printer board, and also I wonder why the developers don’t use this F401 to develop the board.

I see.

The base problem was the the blackpill_f401ce board definition was referencing a non-existant variant folder within STM32Duino. I created buildroot\share\PlatformIO\boards\marlin_blackpill_f401ce.json with the contents from Further I changed the build_flags and extra_scripts to

build_flags = ${common_stm32.build_flags} -DHSE_VALUE=25000000 -DSTM32F401xE -DDISABLE_GENERIC_SERIALUSB -DUSBD_USE_CDC_COMPOSITE -DUSE_USB_FS
extra_scripts = ${common_stm32.extra_scripts}

because it matches better what other boards in ini/stm32f4.ini have.

I then corrected the double-definition of STRING_CONFIG_H_AUTHOR in Configuration.h and commented out #define DISABLE_JTAG in pins_BLACKPILL_F401CE.h because it threw a compile error (disabling of JTAG mode on pins not needed on STM32F4x).

It now compiles successfully and without warnings except for

Marlin\src\inc\Warnings.cpp:59:4: warning: #warning "Your Configuration provides no method to acquire user feedback!" [-
   59 |   #warning "Your Configuration provides no method to acquire user feedback!"
      |    ^~~~~~~

Whathever that means.

Processing blackpill_f401ce (platform: ststm32@~12.1; board: marlin_blackpill_f401ce; framework: arduino)
Verbose mode can be enabled via `-v, --verbose` option
PLATFORM: ST STM32 (12.1.1) > BlackPill F401CE
HARDWARE: STM32F401CEU6 84MHz, 96KB RAM, 512KB Flash
DEBUG: Current (blackmagic) External (blackmagic, cmsis-dap, jlink, stlink)
 - framework-arduinoststm32 4.10900.200819 (1.9.0) 
 - framework-cmsis 2.50501.200527 (5.5.1) 
 - tool-dfuutil 1.9.200310 
 - toolchain-gccarmnoneeabi 1.90201.191206 (9.2.1)
Converting Marlin.ino
LDF: Library Dependency Finder ->
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 10 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <SPI> 1.0
|-- <Servo> 1.1.2
|-- <EEPROM> 2.0.1
|-- <SoftwareSerial> 1.0
|-- <IWatchdog> 1.0.0
|-- <Wire> 1.0
Building in release mode
Compiling .pio\build\blackpill_f401ce\FrameworkArduinoVariant\PeripheralPins.c.o
Checking size .pio\build\blackpill_f401ce\firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [=         ]   6.9% (used 6828 bytes from 98304 bytes)
Flash: [==        ]  15.8% (used 82860 bytes from 524288 bytes)
Building .pio\build\blackpill_f401ce\firmware.bin
Adding dfu suffix to firmware.bin
dfu-suffix (dfu-util) 0.9

Copyright 2011-2012 Stefan Schmidt, 2013-2014 Tormod Volden
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to

Suffix successfully added to file
========================= [SUCCESS] Took 31.16 seconds =========================

Environment       Status    Duration
----------------  --------  ------------
blackpill_f401ce  SUCCESS   00:00:31.157
========================= 1 succeeded in 00:00:31.157 =========================


1 Like

oh so it is, thank you very much. I will reconfigure the pin out pin for my stepper motors
Thank you so much