Skip to content

[BUG] GD32 MFL cannot build with BINARY_FILE_TRANSFER #27798

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
1 task done
Lazar0v opened this issue Apr 16, 2025 · 7 comments · Fixed by #27799
Closed
1 task done

[BUG] GD32 MFL cannot build with BINARY_FILE_TRANSFER #27798

Lazar0v opened this issue Apr 16, 2025 · 7 comments · Fixed by #27799

Comments

@Lazar0v
Copy link

Lazar0v commented Apr 16, 2025

Did you test the latest bugfix-2.1.x code?

Yes, and the problem still exists.

Bug Description

Marlin GD32 MFL doesn't compile with my configuration files.

Bug Timeline

No response

Expected behavior

Successful build

Actual behavior

Errors with build in various files.

Steps to Reproduce

No response

Version of Marlin Firmware

bugfix-2.1.x

Printer model

Ender-3

Electronics

GD32

LCD/Controller

Stock

Other add-ons

No response

Bed Leveling

UBL Bilinear mesh

Your Slicer

None

Host Software

None

Don't forget to include

  • A ZIP file containing your Configuration.h and Configuration_adv.h.

Additional information & file uploads

CrealityV422MFL-PRO.zip

@ellensp
Copy link
Contributor

ellensp commented Apr 16, 2025

I have it building with UBL without issues.

@ellensp
Copy link
Contributor

ellensp commented Apr 16, 2025

How about some error messages, something to go on?

Provided configs after disabling BINARY_FILE_TRANSFER builds fine. no errors, so not related to UBL

@ellensp
Copy link
Contributor

ellensp commented Apr 16, 2025

GD32 support is very new... and is being updated alot.

You have to build with very latest Marlin bugfix 2.1.x code. (or servo support will not build)

And the very latest arduino mfl code Ie delete .platformio/packages/framework-arduino-mfl to force platformio to grab the latest one or the board wont boot.

And the very latest U8glib-HAL library
Update this line in features.ini
HAS_MARLINUI_U8GLIB = U8glib-HAL=https://github.com/MarlinFirmware/U8glib-HAL/archive/refs/heads/master.zip

@ellensp
Copy link
Contributor

ellensp commented Apr 16, 2025

Issue with BINARY_FILE_TRANSFER is Marlin/src/feature/binary_stream.h uses variables
VERSION_MAJOR = 0, VERSION_MINOR = 1, VERSION_PATCH = 0

While mfl has https://github.com/bmourit/ArduinoCore-MFL/blob/main/cores/arduino/CoreHandler.h#L10-L12

// Arduino core version number
#define VERSION_MAJOR   1	// Major version
#define VERSION_MINOR   0	// Minor version
#define VERSION_PATCH   3	// Patch version

So the compiler tries to use the macros and the code becomes
1 = 0, 0 = 1, 3 =0, which doesn't make sense and the compiler barfs.

a quick fix, Search and replace in Marlin on those 3 defines and adding a BS_ prefix (for binary stream) and it also builds.
These should probably be changed to lowercase in Marlin (I have added a pr to do this)

@ellensp ellensp changed the title [BUG] GD32 MFL cannot build with UBL [BUG] GD32 MFL cannot build with BINARY_FILE_TRANSFER Apr 16, 2025
@thisiskeithb thisiskeithb linked a pull request Apr 16, 2025 that will close this issue
@Lazar0v
Copy link
Author

Lazar0v commented Apr 18, 2025

This is a log when compiling with modified Configuration.h , Configuration_adv.h
With base files it compiles without problems
...............
Compiling .pio\build\GD32F303RE_creality_mfl\src\src\gcode\bedlevel\G26.cpp.o
Compiling .pio\build\GD32F303RE_creality_mfl\src\src\gcode\bedlevel\G42.cpp.o
Marlin\src\feature\babystep.cpp: In static member function 'static void Babystep::step_axis(AxisEnum)':
Marlin\src\feature\babystep.cpp:53:45: warning: '--' expression of 'volatile'-qualified type is deprecated [-Wvolatile]
53 | if (curTodo > 0) steps[BS_AXIS_IND(axis)]--; else steps[BS_AXIS_IND(axis)]++;
| ~~~~~~~~~~~~~~~~~~~~~~~^
Marlin\src\feature\babystep.cpp:53:78: warning: '++' expression of 'volatile'-qualified type is deprecated [-Wvolatile]
53 | if (curTodo > 0) steps[BS_AXIS_IND(axis)]--; else steps[BS_AXIS_IND(axis)]++;
| ~~~~~~~~~~~~~~~~~~~~~~~^
In file included from C:\Users\Lazarov.platformio\packages\framework-arduino-mfl\cores\arduino/Arduino.h:7,
from Marlin\src\feature../sd/../inc/../HAL/../HAL/GD32_MFL/../shared/Marduino.h:36,
from Marlin\src\feature../sd/../inc/../HAL/../HAL/GD32_MFL/HAL.h:27,
from Marlin\src\feature../sd/../inc/../HAL/HAL.h:30,
from Marlin\src\feature../sd/../inc/MarlinConfigPre-5-post.h:29,
from Marlin\src\feature../sd/../inc/MarlinConfigPre-6-type.h:24,
from Marlin\src\feature../sd/../inc/MarlinConfig.h:28,
from Marlin\src\feature../sd/cardreader.h:28,
from Marlin\src\feature\binary_stream.cpp:27:
C:\Users\Lazarov.platformio\packages\framework-arduino-mfl\cores\arduino/CoreHandler.h:10:25: error: expected unqualified-id before numeric constant 10 | #define VERSION_MAJOR 1 // Major version
| ^
Marlin\src\feature\binary_stream.h:197:25: note: in expansion of macro 'VERSION_MAJOR'
197 | static const uint16_t VERSION_MAJOR = 0, VERSION_MINOR = 1, VERSION_PATCH = 0, TIMEOUT = 10000, IDLE_PERIOD = 1000;
| ^~~~~~~~~~~~~
In file included from Marlin\src\feature\binary_stream.cpp:28:
Marlin\src\feature\binary_stream.h: In static member function 'static void SDFileTransferProtocol::idle()':
Marlin\src\feature\binary_stream.h:140:27: error: 'IDLE_PERIOD' was not declared in this scope
140 | idle_timeout = ms + IDLE_PERIOD;
| ^~~~~~~~~~~
Marlin\src\feature\binary_stream.h: In static member function 'static void SDFileTransferProtocol::process(uint8_t, char*, uint16_t)':
Marlin\src\feature\binary_stream.h:146:35: error: 'TIMEOUT' was not declared in this scope
146 | transfer_timeout = millis() + TIMEOUT;
| ^~~~~~~
Marlin\src\feature\binary_stream.h:146:35: note: suggested alternatives:
In file included from C:\Users\Lazarov.platformio\packages\framework-arduino-mfl\system\MFL\MFL\Source\FMC/FMC.hpp:24,
from C:\Users\Lazarov.platformio\packages\framework-arduino-mfl\cores\arduino/mfl_api.h:47,
from C:\Users\Lazarov.platformio\packages\framework-arduino-mfl\cores\arduino/Arduino.h:10:
C:\Users\Lazarov.platformio\packages\framework-arduino-mfl\system\MFL\MFL\Source\FMC/fmc_config.hpp:280:5: note: 'fmc::FMC_Error_Type::TIMEOUT'
280 | TIMEOUT
| ^~~~~~~
In file included from C:\Users\Lazarov.platformio\packages\framework-arduino-mfl\system\MFL\MFL\Source\I2C/I2C.hpp:25,
from C:\Users\Lazarov.platformio\packages\framework-arduino-mfl\cores\arduino/mfl_api.h:53:
C:\Users\Lazarov.platformio\packages\framework-arduino-mfl\system\MFL\MFL\Source\I2C/i2c_config.hpp:318:5: note: 'i2c::I2C_Error_Type::TIMEOUT'
318 | TIMEOUT,
| ^~~~~~~
In file included from C:\Users\Lazarov.platformio\packages\framework-arduino-mfl\system\MFL\MFL\Source\USART/USART.hpp:25,
from C:\Users\Lazarov.platformio\packages\framework-arduino-mfl\cores\arduino/mfl_api.h:68:
C:\Users\Lazarov.platformio\packages\framework-arduino-mfl\system\MFL\MFL\Source\USART/usart_config.hpp:315:5: note: 'usart::USART_Error_Type::TIMEOUT'
| ^~~~~~~
Marlin\src\feature\binary_stream.h: At global scope:
C:\Users\Lazarov.platformio\packages\framework-arduino-mfl\cores\arduino/CoreHandler.h:10:25: error: expected unqualified-id before numeric constant 10 | #define VERSION_MAJOR 1 // Major version
| ^
Marlin\src\feature\binary_stream.h:449:84: note: in expansion of macro 'VERSION_MAJOR'
449 | static const uint16_t PACKET_MAX_WAIT = 500, RX_TIMESLICE = 20, MAX_RETRIES = 0, VERSION_MAJOR = 0, VERSION_MINOR = 1, VERSION_PATCH = 0;
| ^~~~~~~~~~~~~
Compiling .pio\build\GD32F303RE_creality_mfl\src\src\gcode\bedlevel\M420.cpp.o
Compiling .pio\build\GD32F303RE_creality_mfl\src\src\gcode\bedlevel\ubl\G29.cpp.o
Compiling .pio\build\GD32F303RE_creality_mfl\src\src\gcode\bedlevel\ubl\M421.cpp.o
Compiling .pio\build\GD32F303RE_creality_mfl\src\src\gcode\calibrate\G28.cpp.o
Compiling .pio\build\GD32F303RE_creality_mfl\src\src\gcode\config\M200-M205.cpp.o
Compiling .pio\build\GD32F303RE_creality_mfl\src\src\gcode\config\M220.cpp.o
*** [.pio\build\GD32F303RE_creality_mfl\src\src\feature\binary_stream.cpp.o] Error 1
============================================================ [FAILED] Took 21.58 seconds ============================================================

Environment Status Duration

GD32F303RE_creality_mfl FAILED 00:00:21.577
======================================================= 1 failed, 0 succeeded in 00:00:21.577 =======================================================

@ellensp
Copy link
Contributor

ellensp commented Apr 18, 2025

@Lazar0v you didn't read a word of my replies did you.

Please scroll up and read my replies.

To recap:
This is a conflict with BINARY_FILE_TRANSFER and ArduinoCore-MFL both using the same keywords VERSION_MAJOR, VERSION_MINOR and VERSION_PATCH for different things.

You need to wait for #27799 to be merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants