Undefined references in compile

Hi I am trying to build a creality ender 3 4.2.7 + BL Touch firmware using VSCode on an M1 MAC I get the following at link stage.
/Users/reg/.platformio/packages/toolchain-gccarmnoneeabi/bin/…/lib/gcc/arm-none-eabi/9.2.1/…/…/…/…/arm-none-eabi/bin/ld: .pio/build/STM32F103RET6_creality/FrameworkArduino/main.cpp.o: in function main': /Users/reg/.platformio/packages/framework-arduinoststm32/cores/arduino/main.cpp:52: undefined reference to setup’
/Users/reg/.platformio/packages/toolchain-gccarmnoneeabi/bin/…/lib/gcc/arm-none-eabi/9.2.1/…/…/…/…/arm-none-eabi/bin/ld: /Users/reg/.platformio/packages/framework-arduinoststm32/cores/arduino/main.cpp:58: undefined reference to `loop’

and basically it then fails any ideas how I can fix this? as an interim I have searched for pre-compiled software but no luck other than creality which doesn’t work.

Where did you download your Marlin and configuration files?

From Marlin the main site I didn’t download Bugfix used version 2.0.x

So, https://github.com/MarlinFirmware/Marlin/archive/2.0.x.zip? Are you using the PlatformIO build button or Auto Build Marlin for build? And you’re using Configurations/config/examples/Creality/Ender-3/CrealityV427 at release-2.0.9.3 · MarlinFirmware/Configurations · GitHub as the config files?

Tried both I get the same result I’ll downloaded 2.0.9.3
I got the config files from the main site as well

Can’t reproduce on Windows 10. I downloaded the 2.0.x (=2.0.9.3) release from the link above, toko the config files from the link above and put them into Marlin/, I had to add #define FAN_SOFT_PWM as a bugfix as noted by [BUG] Ender 5 Pro v4.2.2 - STM32F103RET6 Visual Studio Fail · Issue #23588 · MarlinFirmware/Marlin · GitHub, then when running in the STM32F103RET6_creality environment (pio run -e STM32F103RET6_creality), it all compiles.

Linking .pio\build\STM32F103RET6_creality\firmware-20220210-153238.elf
Checking size .pio\build\STM32F103RET6_creality\firmware-20220210-153238.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [=         ]  11.1% (used 7300 bytes from 65536 bytes)
Flash: [===       ]  27.6% (used 144456 bytes from 524288 bytes)
Building .pio\build\STM32F103RET6_creality\firmware-20220210-153238.bin
=================[SUCCESS] Took 37.33 seconds =================

Did you delete your Marlin\Marlin.ino file?

No haven’t deleted that I will give that a go.

No no, the file is required, it has setup() and loop() in it. No actually Marlin/src/MarlinCore.cpp has it.

I’ll build a VSCode setup on my Windows 10 Machine later and give that a go as well.
Tried without ino file same although it could be vscode caching files.

I’ve uplaoded my prepared Marlin version at https://drive.google.com/file/d/15iolKzi4b4Tx617MGrUHcEt3BRbMf1wc/view?usp=sharing.

Please download and extract, Open VSCode, PIO Home should open automatically → Open Project → The extracted folder → Ok → Trust Workspace → Build button at the bottom toolbar (checkmark icon).

If there are multiple projects in the workspace, you have to use the project environment switcher to the env:STM32F103RET6_creality environment before building of course.

Thanks for that that proves it’s something on the MAC Platform IO as the result is the same, I edit the source in platform.ini so I can keep each separate and close each folder before opening a new one.

As a test I copied one to the Marlin directory and adjusted the source in platform.ini and it compiled fine, at a later time I am going to investigate where it is search for other source files so I can run multiple builds.

There is no reason why it should not work on Mac o_O. Do you see this file and function?

Also, open a CLI and execute pio upgrade --dev. Does it still not link after that?

Thanks very much for your help it has been invaluable.