Configurations
Configurations copied to clipboard
[BUG] Unable to build Malyan/M200 v1 example configuration according to its README.md
Bug Description
Exactly following the instructions from the README.md, without any changes to the example configs, I am unable to finish the building process due to the following error:
In file included from C:\Users\User\AppData\Local\Arduino15\packages\STM32\hardware\stm32\1.9.0\cores\arduino/stm32/clock.h:43,
from C:\Users\User\AppData\Local\Arduino15\packages\STM32\hardware\stm32\1.9.0\cores\arduino/wiring_time.h:23,
from C:\Users\User\AppData\Local\Arduino15\packages\STM32\hardware\stm32\1.9.0\cores\arduino/wiring.h:38,
from C:\Users\User\AppData\Local\Arduino15\packages\STM32\hardware\stm32\1.9.0\cores\arduino/Arduino.h:36,
from C:\Users\User\Downloads\Marlin-bugfix-2.1.x\Marlin\src\HAL\shared\Marduino.h:36,
from C:\Users\User\Downloads\Marlin-bugfix-2.1.x\Marlin\src\HAL\STM32\HAL.h:28,
from C:\Users\User\Downloads\Marlin-bugfix-2.1.x\Marlin\src\HAL\HAL.h:30,
from C:\Users\User\Downloads\Marlin-bugfix-2.1.x\Marlin\src\inc\MarlinConfig.h:31,
from C:\Users\User\Downloads\Marlin-bugfix-2.1.x\Marlin\src\HAL\STM32\HAL.cpp:27:
C:\Users\User\Downloads\Marlin-bugfix-2.1.x\Marlin\src\HAL\STM32\HAL.cpp: In static member function 'static void MarlinHAL::init()':
C:\Users\User\AppData\Local\Arduino15\packages\STM32\hardware\stm32\1.9.0\cores\arduino/stm32/stm32_def.h:58:17: error: the value of 'SystemCoreClock' is not usable in a constant expression
58 | #define F_CPU SystemCoreClock
| ^~~~~~~~~~~~~~~
C:\Users\User\Downloads\Marlin-bugfix-2.1.x\Marlin\src\HAL\STM32\HAL.cpp:70:27: note: in expansion of macro 'F_CPU'
70 | constexpr int cpuFreq = F_CPU;
| ^~~~~
In file included from C:\Users\User\AppData\Local\Arduino15\packages\STM32\hardware\stm32\1.9.0\system/Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xb.h:133,
from C:\Users\User\AppData\Local\Arduino15\packages\STM32\hardware\stm32\1.9.0\system/Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h:131,
from C:\Users\User\AppData\Local\Arduino15\packages\STM32\hardware\stm32\1.9.0\cores\arduino/stm32/stm32_def.h:28,
from C:\Users\User\AppData\Local\Arduino15\packages\STM32\hardware\stm32\1.9.0\cores\arduino/stm32/clock.h:43,
from C:\Users\User\AppData\Local\Arduino15\packages\STM32\hardware\stm32\1.9.0\cores\arduino/wiring_time.h:23,
from C:\Users\User\AppData\Local\Arduino15\packages\STM32\hardware\stm32\1.9.0\cores\arduino/wiring.h:38,
from C:\Users\User\AppData\Local\Arduino15\packages\STM32\hardware\stm32\1.9.0\cores\arduino/Arduino.h:36,
from C:\Users\User\Downloads\Marlin-bugfix-2.1.x\Marlin\src\HAL\shared\Marduino.h:36,
from C:\Users\User\Downloads\Marlin-bugfix-2.1.x\Marlin\src\HAL\STM32\HAL.h:28,
from C:\Users\User\Downloads\Marlin-bugfix-2.1.x\Marlin\src\HAL\HAL.h:30,
from C:\Users\User\Downloads\Marlin-bugfix-2.1.x\Marlin\src\inc\MarlinConfig.h:31,
from C:\Users\User\Downloads\Marlin-bugfix-2.1.x\Marlin\src\HAL\STM32\HAL.cpp:27:
C:\Users\User\AppData\Local\Arduino15\packages\STM32\hardware\stm32\1.9.0\system/Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h:51:17: note: 'uint32_t SystemCoreClock' is not const
51 | extern uint32_t SystemCoreClock; /*!< System Clock Frequency (Core Clock) */
| ^~~~~~~~~~~~~~~
This error happens on both the suggested (now deprecated) STM32 Cores versions 1.8 and 1.9 (1.7 fails on a different error) and on the latest STM32 2.4.0.
I have tested both the 2.1 stable and 2.1 bugfix/nightly branches/configs.
Configuration Files
Required: Include a ZIP file containing Configuration.h and Configuration_adv.h.
Unmodified configs straight from the repo, repacked into a zip:
Marlin.zip
Steps to Reproduce
Simply follow the installation instructions from the Maylan/M200 v1 README.md.
Expected behavior: A completed build.
Actual behavior: No completed build.
Additional Information
Full build log: marlinfull.log
EDIT: The same issue also happens in 2.0.9.5 it seems.
add #define F_CPU 72000000 to Your configuration.h file.
This gets past the error, but im only guessing its running the STM32F103CB MPU at 72 MHz
Thanks, I'll give that a go and report back. Is figuring out the correct clockspeed a matter of trial and error, or can I otherwise verify it? Is this actually affecting anything important? As apparently it wasn't necessary to specify in the past?
It something broken/wrong/different in arduino ide.. works fine in platformio, and breaks if you add the define.
so currently you cannot win. You cant add it as that breaks platformio you cant not add it as that breaks arduino ide...
I can confirm adding the line at least completes the build in Arduino IDE (with the deprecated STM32 Cores 1.9.0 at least, 2.4.0 completed the build too but overshoots the flash size), I'll test the resulting build once my brother's awake in a few hours and I can access the printer.
You cant add it as that breaks platformio you cant not add it as that breaks arduino ide...
From what I saw there were attempts to make this build with platformio in the past, but I can't find if they ever ended up fully working.
Since the instructions in the README.md are for Arduino IDE, wouldn't it be enough to just add an instruction "For Arduino IDE, we need to add the line #define F_CPU 72000000 to the configuration.h file." to the README.md?
That is assuming 72000000 is indeed the correct value for this printer of course.
Well, the firmware installs, and beyond that I have no idea. It doesn't show up over serial and it doesn't seem to connect to the LCD over serial either. Could this be related to the CPU frequency being wrong? I have no idea what it is used for.
Interestingly, if I change the board version to v2 (despite the board being a v1 pretty sure, no back fan), the sensors do start working, briefly, before bootlooping.
Either way it seems like there's more not (longer) accurate about this example config, at least for the v1.
I tried both the instructions from the README.md and the ones from @xC0000005's original repo, both with just the unmodified (except for the F_CPU line) config files from this repo, and neither seem to produce a working build for the v1 (anymore).
If you are trying to flash a V1 and not getting USB serial, be absolutely certain the board overrides to toggle that pull-up are present, t’s required to signal USB bus enumeration on the V1.
On Mar 6, 2023, at 9:33 AM, Sebastiaan @.***> wrote:
Well, the firmware installs, and beyond that I have no idea. It doesn't show up over serial and it doesn't seem to connect to the LCD over serial either. Could this be related to the CPU frequency being wrong? I have no idea what it is used for. Interestingly, if I change the board version to v2 (despite the board being a v1 pretty sure, no back fan), the sensors do start working, briefly, before bootlooping. Either way it seems like there's more not (longer) accurate about this example config, at least for the v1.
I tried both the instructions from the README.md and the ones from @xC0000005 https://github.com/xC0000005's original repo, both with just the unmodified (except for the F_CPU line) config files from this repo, and neither seem to produce a working build for the v1 (anymore).
— Reply to this email directly, view it on GitHub https://github.com/MarlinFirmware/Configurations/issues/900#issuecomment-1456594428, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHVGS4IOCB36OUEGUT5UJ6TW2YNWBANCNFSM6AAAAAAVQSRW3U. You are receiving this because you were mentioned.
I... hm. Okay, so I was sure I was working with a V1 here since it matched all exterior descriptions AFAICT, and this especially sounded pretty definitive:
- If there’s no fan in the rear of the base, it’s a V1, period, STM32F103
Well, after I couldn't get v1 firmware working I flashed v2, and as mentioned it bootlooped. Then I came across Marlin#23716, tried the mentioned workaround, and it... just worked? So apparently this printer (a new 2nd hand aquisition) is a v2 despite visually matching the v1.
Anyway, to get back to the actual issue at hand, aside from me picking the wrong version, the example config seems to work, with 2 changes:
- The
F_CPUline needs to be added to the config in order to build with Arduino IDE, as mentioned this could be implemented as a simple "if you're building with Arduino IDE, add this line to your config" in the readme of the example config. - The aforementioned bug needs to be resolved or the workaround manually applied.
Should I create a PR to update the documentation reflecting this?