Fail to compile Marlin 2.0.x from for SKR mini e3 v2.0. missing Arduino.h file?

I have been trying to compile Marlin 2.0.x for Bigtreetech SKR mini e3 v2.0 board from Bigtreetech github repo: GitHub - bigtreetech/BIGTREETECH-SKR-mini-E3: BIGTREETECH SKR-mini-E3 motherboard is a ultra-quiet, low-power, high-quality 3D printing machine control board. It is launched by the 3D printing team of Shenzhen BIGTREE technology co., LTD. This board is specially tailored for Ender 3 printer, perfectly replacing the original Ender3 printer motherboard.
I am running on Windows 10, and have installed Visual Studio and PlatformIO (using the Extensions menu). I have git installed as well as python 3.8.5.

I tried to compile the folder as is without changing any parameter and get an error saying there is no arduino.h file (Log below).
I am not too sure what to do about it as I am new to VS and PlatformIO. I would just mention that I tried using PlatformIO before on a MacOS with a previous Marlin, and failed.
At this step its just becoming frustrating…
I would appericiate your assistance.


Processing STM32F103RC_btt_512K (platform: ststm32; board: genericSTM32F103RC; framework: arduino)
-------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/ststm32/genericSTM32F103RC.html
PLATFORM: ST STM32 8.0.0 > STM32F103RC (48k RAM. 256k Flash)
HARDWARE: STM32F103RCT6 72MHz, 48KB RAM, 512KB Flash
DEBUG: Current (blackmagic) External (blackmagic, jlink, stlink)
PACKAGES:
 - framework-arduinoststm32 4.10900.200602 (1.9.0)
 - framework-cmsis 2.50501.200527 (5.5.1)
 - tool-stm32duino 1.0.2
 - toolchain-gccarmnoneeabi 1.90201.191206 (9.2.1)
Converting Marlin.ino

warning: Ignoring missing SConscript 'C:\users\lavik\.platformio\packages\framework-arduinoststm32\tools\platformio-build.py'
File "C:\users\lavik\.platformio\platforms\ststm32\builder\frameworks\arduino.py", line 50, in <module>
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Looking for LiquidCrystal library in registry
Conflict: More than one library has been found by request {"requirements": null, "name": "LiquidCrystal"}:
LiquidCrystal
=============
#ID: 136
Automatically chose the first available library (use `--interactive` option to make a choice)
LiquidCrystal Library is faster and extensable, compatible with the original LiquidCrystal library

Keywords: lcd, hd44780
Compatible frameworks: Arduino
Compatible platforms: Atmel AVR, Espressif 8266, Espressif 32
Authors: F Malpartida

LiquidCrystal
=============
#ID: 887
Allows communication with alphanumerical liquid crystal displays (LCDs). This library allows an Arduino/Genuino board to control LiquidCrystal displays (LCDs) based on the Hitachi HD44780 (or a compatible) chipset, which is found on most text-based LCDs. The library works with in either 4 or 8 bit mode (i.e. using 4 or 8 data lines in addition to the rs, enable, and, optionally, the rw control lines).

Keywords: display
Compatible frameworks: Arduino
Compatible platforms: Infineon XMC, Kendryte K210, GigaDevice GD32V, ASR Microelectronics ASR605x, Atmel AVR, Atmel SAM, Espressif 8266, Intel ARC32, Microchip PIC32, Nordic nRF51, ST STM32, Teensy, TI MSP430, TI TIVA, Espressif 32, Nordic nRF52, ST STM8, Atmel megaAVR
Authors: Arduino, Adafruit

Found: https://platformio.org/lib/show/136/LiquidCrystal
LibraryManager: Installing id=136
Using cache: C:\Users\Lavik\.platformio\.cache\60\e03e4834837c5ab0829c748f08d95060
LiquidCrystal @ 1.5.0 has been successfully installed!
Looking for TMCStepper library in registry
Found: https://platformio.org/lib/show/5513/TMCStepper
LibraryManager: Installing id=5513 @ >=0.6.2,<1.0.0
Using cache: C:\Users\Lavik\.platformio\.cache\6b\892065df0a1fff8b39bce1802a2be26b
Unpacking  [####################################]  100%
TMCStepper @ 0.7.1 has been successfully installed!
LibraryManager: Installing Adafruit_NeoPixel
git version 2.28.0.windows.1
Cloning into 'C:\temp\BIGTREETECH-SKR-mini-E3-master\firmware\V2.0\Marlin-2.0.x-SKR-mini-E3-V2.0\.pio\libdeps\STM32F103RC_btt_512K\_tmp_installing-grs9o6-package'...
Adafruit NeoPixel @ b72627a has been successfully installed!
LibraryManager: Installing U8glib-HAL
Using cache: C:\Users\Lavik\.platformio\.cache\a7\b7a9b473d1c239d9843ca943887cd0a7
U8glib-HAL @ 0.4.1 has been successfully installed!
LibraryManager: Installing Adafruit_MAX31865
Using cache: C:\Users\Lavik\.platformio\.cache\5d\a6fd8b43e097a553fc05466edc357e5d
Adafruit_MAX31865 @ 1.1.0 has been successfully installed!
LibraryManager: Installing LiquidTWI2
Using cache: C:\Users\Lavik\.platformio\.cache\85\8b02db3fff9254d346da3ee4646b5f85
Unpacking  [####################################]  100%
LiquidTWI2 @ 1.2.7 has been successfully installed!
LibraryManager: Installing Arduino-L6470
Using cache: C:\Users\Lavik\.platformio\.cache\07\12d08ea66c13f5976fdaab4c52dfcf07
Arduino-L6470 @ 0.8.0 has been successfully installed!
LibraryManager: Installing SailfishLCD
Using cache: C:\Users\Lavik\.platformio\.cache\e1\f7005198ad8e3a4b619768bbbcd33ae1
SailfishLCD @ 0.0.0 has been successfully installed!
LibraryManager: Installing SailfishRGB_LED
Using cache: C:\Users\Lavik\.platformio\.cache\ae\92268909fe23d8d88d696e4077aa46ae
SailfishRGB_LED @ 0.0.0 has been successfully installed!
LibraryManager: Installing SlowSoftI2CMaster
Using cache: C:\Users\Lavik\.platformio\.cache\57\ba98e6910d02720ff6cc39cb62b43957
SlowSoftI2CMaster @ 0.0.0 has been successfully installed!
LibraryManager: Installing SoftwareSerialM
Using cache: C:\Users\Lavik\.platformio\.cache\36\5b7d8e4c43fbe7dee68737c754562636
SoftwareSerialM @ 1.0.0 has been successfully installed!
Looking for USBComposite_stm32f1 library in registry
Warning! Library `{'requirements': '==0.91', 'name': 'USBComposite_stm32f1'}` has not been found in PlatformIO Registry.
You can ignore this message, if `{'requirements': '==0.91', 'name': 'USBComposite_stm32f1'}` is a built-in library (included in framework, SDK). E.g., SPI, Wire, etc.
Found 12 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <LiquidCrystal> 1.5.0
|-- <TMCStepper> 0.7.1
|   |-- <SoftwareSerialM> 1.0.0
|-- <Adafruit NeoPixel> 1.2.4 #b72627a
|-- <U8glib-HAL> 0.4.1
|-- <Adafruit MAX31865 library> 1.1.0
|-- <LiquidTWI2> 1.2.7
|-- <Arduino-L6470> 0.8.0
|-- <SailfishLCD>
|-- <SailfishRGB_LED>
|-- <SlowSoftI2CMaster>
|-- <SoftwareSerialM> 1.0.0
Building in release mode
Compiling .pio\build\STM32F103RC_btt_512K\src\src\HAL\STM32F1\HAL.cpp.o
Compiling .pio\build\STM32F103RC_btt_512K\src\src\HAL\STM32F1\HAL_SPI.cpp.o
Compiling .pio\build\STM32F103RC_btt_512K\src\src\HAL\STM32F1\SPI.cpp.o
Compiling .pio\build\STM32F103RC_btt_512K\src\src\HAL\STM32F1\Servo.cpp.o
Compiling .pio\build\STM32F103RC_btt_512K\src\src\HAL\STM32F1\SoftwareSerial.cpp.o
Compiling .pio\build\STM32F103RC_btt_512K\src\src\HAL\STM32F1\dogm\u8g_com_stm32duino_fsmc.cpp.o
Compiling .pio\build\STM32F103RC_btt_512K\src\src\HAL\STM32F1\dogm\u8g_com_stm32duino_swspi.cpp.o
Compiling .pio\build\STM32F103RC_btt_512K\src\src\HAL\STM32F1\msc_sd.cpp.o
Compiling .pio\build\STM32F103RC_btt_512K\src\src\HAL\STM32F1\onboard_sd.cpp.o
Compiling .pio\build\STM32F103RC_btt_512K\src\src\HAL\STM32F1\persistent_store_eeprom.cpp.o
Compiling .pio\build\STM32F103RC_btt_512K\src\src\HAL\STM32F1\persistent_store_flash.cpp.o
Compiling .pio\build\STM32F103RC_btt_512K\src\src\HAL\STM32F1\persistent_store_sdcard.cpp.o
Compiling .pio\build\STM32F103RC_btt_512K\src\src\HAL\STM32F1\sdio.cpp.o
Compiling .pio\build\STM32F103RC_btt_512K\src\src\HAL\STM32F1\timers.cpp.o
Compiling .pio\build\STM32F103RC_btt_512K\src\src\HAL\STM32F1\watchdog.cpp.o
Compiling .pio\build\STM32F103RC_btt_512K\src\src\HAL\shared\HAL_spi_L6470.cpp.o
Compiling .pio\build\STM32F103RC_btt_512K\src\src\HAL\shared\backtrace\backtrace.cpp.o
In file included from Marlin\src\HAL\STM32F1\../../inc/../HAL/./STM32F1/HAL.h:32,
                 from Marlin\src\HAL\STM32F1\../../inc/../HAL/HAL.h:26,
                 from Marlin\src\HAL\STM32F1\../../inc/MarlinConfig.h:30,
                 from Marlin\src\HAL\STM32F1\onboard_sd.cpp:15:
Marlin\src\HAL\STM32F1\../../inc/../HAL/./STM32F1/../shared/Marduino.h:36:10: fatal error: Arduino.h: No such file or directory

*****************************************************************
* Looking for Arduino.h dependency? Check our library registry!
*
* CLI  > platformio lib search "header:Arduino.h"
* Web  > https://platformio.org/lib/search?query=header:Arduino.h
*
*****************************************************************

   36 | #include <Arduino.h>  // NOTE: If included earlier then this line is a NOOP
      |          ^~~~~~~~~~~
In file included from Marlin\src\HAL\STM32F1\dogm\../../../inc/../HAL/./STM32F1/HAL.h:32,
                 from Marlin\src\HAL\STM32F1\dogm\../../../inc/../HAL/HAL.h:26,
                 from Marlin\src\HAL\STM32F1\dogm\../../../inc/MarlinConfig.h:30,
                 from Marlin\src\HAL\STM32F1\dogm\u8g_com_stm32duino_fsmc.cpp:29:
Marlin\src\HAL\STM32F1\dogm\../../../inc/../HAL/./STM32F1/../shared/Marduino.h:36:10: fatal error: Arduino.h: No such file or directory

*****************************************************************
* Looking for Arduino.h dependency? Check our library registry!
*
* CLI  > platformio lib search "header:Arduino.h"
* Web  > https://platformio.org/lib/search?query=header:Arduino.h
*
*****************************************************************

   36 | #include <Arduino.h>  // NOTE: If included earlier then this line is a NOOP
      |          ^~~~~~~~~~~
compilation terminated.
compilation terminated.
*** [.pio\build\STM32F103RC_btt_512K\src\src\HAL\STM32F1\onboard_sd.cpp.o] Error 1
*** [.pio\build\STM32F103RC_btt_512K\src\src\HAL\STM32F1\dogm\u8g_com_stm32duino_fsmc.cpp.o] Error 1
In file included from Marlin\src\HAL\shared\../../inc/../HAL/./STM32F1/HAL.h:32,
                 from Marlin\src\HAL\shared\../../inc/../HAL/HAL.h:26,
                 from Marlin\src\HAL\shared\../../inc/MarlinConfig.h:30,
                 from Marlin\src\HAL\shared\HAL_spi_L6470.cpp:28:
Marlin\src\HAL\shared\../../inc/../HAL/./STM32F1/../shared/Marduino.h:36:10: fatal error: Arduino.h: No such file or directory

*****************************************************************
* Looking for Arduino.h dependency? Check our library registry!
*
* CLI  > platformio lib search "header:Arduino.h"
* Web  > https://platformio.org/lib/search?query=header:Arduino.h
*
*****************************************************************

   36 | #include <Arduino.h>  // NOTE: If included earlier then this line is a NOOP
      |          ^~~~~~~~~~~
compilation terminated.
*** [.pio\build\STM32F103RC_btt_512K\src\src\HAL\shared\HAL_spi_L6470.cpp.o] Error 1
In file included from Marlin\src\HAL\shared\backtrace\../../../core/../inc/../HAL/./STM32F1/HAL.h:32,
                 from Marlin\src\HAL\shared\backtrace\../../../core/../inc/../HAL/HAL.h:26,
                 from Marlin\src\HAL\shared\backtrace\../../../core/../inc/MarlinConfig.h:30,
                 from Marlin\src\HAL\shared\backtrace\../../../core/serial.h:24,
                 from Marlin\src\HAL\shared\backtrace\backtrace.cpp:29:
Marlin\src\HAL\shared\backtrace\../../../core/../inc/../HAL/./STM32F1/../shared/Marduino.h:36:10: fatal error: Arduino.h: No such file or directory

*****************************************************************
* Looking for Arduino.h dependency? Check our library registry!
*
* CLI  > platformio lib search "header:Arduino.h"
* Web  > https://platformio.org/lib/search?query=header:Arduino.h
*
*****************************************************************

   36 | #include <Arduino.h>  // NOTE: If included earlier then this line is a NOOP
      |          ^~~~~~~~~~~
compilation terminated.
*** [.pio\build\STM32F103RC_btt_512K\src\src\HAL\shared\backtrace\backtrace.cpp.o] Error 1
========================================================= [FAILED] Took 299.82 seconds =========================================================

Environment               Status    Duration
------------------------  --------  ------------
mega2560                  IGNORED
mega1280                  IGNORED
rambo                     IGNORED
FYSETC_F6_13              IGNORED
FYSETC_F6_14              IGNORED
sanguino644p              IGNORED
sanguino1284p             IGNORED
melzi                     IGNORED
melzi_optiboot            IGNORED
at90usb1286_cdc           IGNORED
at90usb1286_dfu           IGNORED
DUE                       IGNORED
DUE_USB                   IGNORED
DUE_debug                 IGNORED
LPC1768                   IGNORED
LPC1769                   IGNORED
STM32F103RC               IGNORED
STM32F103RC_fysetc        IGNORED
STM32F103RC_btt           IGNORED
STM32F103RC_btt_USB       IGNORED
STM32F103RC_btt_512K      FAILED    00:04:59.823
STM32F103RC_btt_512K_USB  IGNORED
STM32F103RE               IGNORED
STM32F103RE_btt           IGNORED
STM32F103RE_btt_USB       IGNORED
STM32F4                   IGNORED
STM32F7                   IGNORED
ARMED                     IGNORED
STM32F103VE_GTM32         IGNORED
STM32F103VE_longer        IGNORED
mks_robin_mini            IGNORED
mks_robin_nano            IGNORED
mks_robin                 IGNORED
mks_robin_pro             IGNORED
mks_robin_lite            IGNORED
mks_robin_lite3           IGNORED
jgaurora_a5s_a1           IGNORED
STM32F103CB_malyan        IGNORED
chitu_f103                IGNORED
STM32F401VE_STEVAL        IGNORED
FLYF407ZG                 IGNORED
FYSETC_S6                 IGNORED
STM32F407VE_black         IGNORED
BIGTREE_SKR_PRO           IGNORED
BIGTREE_GTR_V1_0          IGNORED
BIGTREE_BTT002            IGNORED
teensy31                  IGNORED
teensy35                  IGNORED
esp32                     IGNORED
linux_native              IGNORED
SAMD51_grandcentral_m4    IGNORED
rumba32_f446ve            IGNORED
rumba32_mks               IGNORED
include_tree              IGNORED
===================================================== 1 failed, 0 succeeded in 00:04:59.823 =====================================================
The terminal process "C:\Users\Lavik\.platformio\penv\Scripts\platformio.exe 'run'" terminated with exit code: 1.

Terminal will be reused by tasks, press any key to close it.```

The issue starts much earlier than that… with

… making it seem like the STM32 framework didn’t install properly.

Now to fix that issue, goto %userprofile%\.platformio\packages and delete the framework-arduinoststm32 folder. This will force PlatformIO to re-download if it is needed.

Therein lies the other issue - I don’t think the stm32duino core is the right one of this - it should be using the Maple core. If you scroll down to the [env:STM32F103RC_btt_512K] block in the platformio.ini file and add board_build.core = maple in there somewhere, e.g.

image

… and try build the project again, it should be successful this time. You may have to two builds, it failed the first time for me, but I could have made it break, so it may work the first time for you.

This is due to bigtreetech not locking version of the platform used, and consequently run afoul of breaking changes in v7.0.0 of the ststm32 platform, where almost all boards now default to the stm32duino core, rather than the maple core. This means the other way to fix this would be to change the platform line (#325 above) to read platform = ststm32@6.1.0 which was the latest version at the time they last made changes. I only mention this in case the code compiles, but doesn’t actually work properly. :open_mouth:

Thank you for your help! I really appreciate it!

As you suggested, I’ve deleted the folder and made the changes in the ini file.
When I start Visual Studio, it initializes PlatformIO but I see a message at the bottom of the screen that says

PlatformIO: IntelliSense Index Rebuild

And when I click on it for more details it says:

The extension 'PlatformIO IDE' took a very long time to complete its last operation and it has prevented other extensions from running.

I ignored it and tried to compile Marlin.

The build was successful !!!

I did get 44 warnings of a type:
function call is not allowed in a constant expression
followed by square barckets and two values

and also two of the type
Cannot find \"c:\\temp\\BIGTREETECH-SKR-mini-E3-master\\firmware\\V2.0\\Marlin-2.0.x-SKR-mini-E3-V2.0\\include\"

Should I worry about these?

Thank you again for all your help !!!

That is normal. Since you deleted the folder, PlatformIO identified when parsing the platformio.ini upon reopening the project that it the framework files were needed, and set about downloading and installing it, so that IntelliSense wouldn’t spit the dummy over missing files.

If the build was successful, I would ignore the warnings. It’s normal for there to be a load of them in bigger projects like Marlin, particularly when libraries from all different authors and sources are involved. Make sure you have a backup you can revert to, and see if it works! :slight_smile:

Thanks pfeerick!
The build was successful and I tried both ststm32 and ststm32@6.1.0. However something seems to be off with the settings. I am not sure that this is the right thread for this but I will appreciate any help that you could provide.
After the bin file is loaded onto the printer, the homing option takes the printer’s head to the wrong coordinates (both on x,y, and z).
I’ve been using the Marlin config files from BigtreeTech github so it should be pre-configured with the right settings. I have also tried their pre-built bin file which worked fine (but doesn’t have mesh-bed leveling enabled, which is why I am trying to build it from scratch).
I am not sure how to proceed from here …

Glad progress is being made! :slight_smile:

Not sure what is going on there - I’m not familiar with self-compiling marlin or that particular printer/controller combo. All I can suggest is are you using the right version for your board? As it seems the versions are for the different hardware revisions of the board?