Skip to content
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

[BUG] Build errors on STM32F103RC_btt when SEGMENT_LEVELED_MOVES disabled #19431

Closed
doctorthompson opened this issue Sep 18, 2020 · 8 comments
Closed
Labels
Bug: Confirmed ! Needs: Patch A patch is needed to fix this

Comments

@doctorthompson
Copy link

Bug Description

A slew of overloading and narrowing errors are produced while compiling abl.cpp when SEGMENT_LEVELED_MOVES is disabled in Configuration.h. Build output is included in the ZIP file with my config files. Target board is STM32F103RC_btt_512K_USB, though similar errors are produced when building for both the non-USB and non-512K variety as well.

My Configurations

Configs_and_Build_Logs.zip

Steps to Reproduce

  1. Comment out SEGMENT_LEVELED_MOVES and LEVELED_SEGMENT_LENGTH in Configuration.h
  2. Build for STM32F103RC_btt_512K_USB

Expected behavior: Build succeeds and produces a valid firmware binary.

Actual behavior: Several screens worth of C++ errors pertaining to overloading and narrowing are output and the build fails.

Additional Information

Branch used: bugfix-2.0.x as of 2020-09-18, commit 648269e

With the two defines uncommented the build succeeds, albeit with a few odd warnings. These have been included at the end of the build output file in the ZIP.

@ellensp
Copy link
Contributor

ellensp commented Sep 18, 2020

Issue is not board dependent
With standard provided ramps config it just needs AUTO_BED_LEVELING_BILINEAR and a probe setup (I used FIX_MOUNTED_PROBE) with SEGMENT_LEVELED_MOVES disabled and it gives this error

only has issues with AUTO_BED_LEVELING_BILINEAR other leveling methods works fine.

@shitcreek
Copy link
Contributor

Removing the & operator in front of &scaled_fr_mm_s in abl.h resolves the overloading error and compiles successfully (with AUTO_BED_LEVELING_BILINEAR enabled and SEGMENT_LEVELED_MOVES disabled). Narrowing conversion warnings still come up.

Changed from:

#if IS_CARTESIAN && DISABLED(SEGMENT_LEVELED_MOVES)
  void bilinear_line_to_destination(const feedRate_t &scaled_fr_mm_s, uint16_t x_splits=0xFFFF, uint16_t y_splits=0xFFFF);
#endif

To:

#if IS_CARTESIAN && DISABLED(SEGMENT_LEVELED_MOVES)
  void bilinear_line_to_destination(const feedRate_t scaled_fr_mm_s, uint16_t x_splits=0xFFFF, uint16_t y_splits=0xFFFF);
#endif

@sjasonsmith sjasonsmith added the Needs: Patch A patch is needed to fix this label Sep 20, 2020
@github-actions
Copy link

This issue has had no activity in the last 30 days. Please add a reply if you want to keep this issue active, otherwise it will be automatically closed within 7 days.

@XBrav
Copy link

XBrav commented Oct 27, 2020

I can confirm the above fix by @shitcreek bypasses the build errors on 2.0.7.1. Do we know exactly what the impact is of removing the pointer?

@doctorthompson
Copy link
Author

Well, it's a reference not a pointer, but looking at the typedef it looks like it's just a simple float.

If we were just running on run-of-the-mill CPUs I'd say passing it by value probably shouldn't be much of an issue.

However, I'm not familiar enough with all the microcontrollers Marlin supports to be able to say whether passing a float by value (possibly many times) is going to result in memory or stack issues on some of the more constrained hardware.

The implications are: Without the ampersand it will need to allocate whatever sizeof(float) is on the underlying platform for each call.

It certainly shouldn't be an issue on any of the beefier boards.

@thinkyhead
Copy link
Member

It's preferred to pass float as a const reference for performance on AVR because on that architecture a float is 4 bytes while a reference or pointer is only 2 bytes. The feedRate_t is a simple alias for float. So, adding the ampersand to the function definition where it's missing should keep the stack smaller on AVR.

I have been considering adding a new type, if needed, to pass float in the most optimal way according to the platform. The platforms declare integer types with least_ and fast_ in their names, so I might follow that naming pattern.

@sjasonsmith
Copy link
Contributor

This appears to be resolved. After updating the original configs enough to build against bugfix the only warnings came from external libraries. Closing.

Nushio pushed a commit to CR6Community/Marlin that referenced this issue Nov 29, 2020
vgadreau pushed a commit to vgadreau/Marlin that referenced this issue Dec 9, 2020
DuncanLHS pushed a commit to DuncanLHS/Marlin-Sunlu-S8 that referenced this issue Dec 29, 2020
TheMichalcinOfficial added a commit to TheMichalcinOfficial/Marlin that referenced this issue Dec 30, 2020
* Don't define IS_ULTIPANEL empty

* Fix HAL/STM32 FastIO for analog pins (MarlinFirmware#19735)

* Fix SAMD Serial name macro (MarlinFirmware#19765)

* Marlin 2.0.7.2

* Update "Bug Report" template (MarlinFirmware#19906)

* Fix bilinear_line_to_destination definition

See MarlinFirmware#19431

* Fix extraneous Linear Advance DIR change (MarlinFirmware#20131)

* Fix bad SET_FAST_PWM_FREQ calls (MarlinFirmware#20227)

* Set "lcd_move_e" index to fix the label (MarlinFirmware#20263)

* Help hosts when password-locked (MarlinFirmware#20348)

* Fix TMC_HOME_PHASE divide by zero (MarlinFirmware#20368)

* Fix TEMP_0_TR_ENABLE

Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
Co-authored-by: Serhiy-K <52166448+Serhiy-K@users.noreply.github.com>
Co-authored-by: Jason Smith <jason.inet@gmail.com>
Co-authored-by: Scott Lahteine <github@thinkyhead.com>
Co-authored-by: phcay <58492957+phcay@users.noreply.github.com>
Co-authored-by: Simone Primarosa <simonepri@outlook.com>
Co-authored-by: ellensp <ellensp@hotmail.com>
Co-authored-by: Luu Lac <45380455+shitcreek@users.noreply.github.com>
TheMichalcinOfficial added a commit to TheMichalcinOfficial/Marlin that referenced this issue Dec 30, 2020
* Don't define IS_ULTIPANEL empty

* Fix HAL/STM32 FastIO for analog pins (MarlinFirmware#19735)

* Fix SAMD Serial name macro (MarlinFirmware#19765)

* Marlin 2.0.7.2

* Update "Bug Report" template (MarlinFirmware#19906)

* Fix bilinear_line_to_destination definition

See MarlinFirmware#19431

* Fix extraneous Linear Advance DIR change (MarlinFirmware#20131)

* Fix bad SET_FAST_PWM_FREQ calls (MarlinFirmware#20227)

* Set "lcd_move_e" index to fix the label (MarlinFirmware#20263)

* Help hosts when password-locked (MarlinFirmware#20348)

* Fix TMC_HOME_PHASE divide by zero (MarlinFirmware#20368)

* Fix TEMP_0_TR_ENABLE

Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
Co-authored-by: Serhiy-K <52166448+Serhiy-K@users.noreply.github.com>
Co-authored-by: Jason Smith <jason.inet@gmail.com>
Co-authored-by: Scott Lahteine <github@thinkyhead.com>
Co-authored-by: phcay <58492957+phcay@users.noreply.github.com>
Co-authored-by: Simone Primarosa <simonepri@outlook.com>
Co-authored-by: ellensp <ellensp@hotmail.com>
Co-authored-by: Luu Lac <45380455+shitcreek@users.noreply.github.com>
tharts pushed a commit to tharts/Marlin that referenced this issue Jan 6, 2021
@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked and limited conversation to collaborators Jan 15, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug: Confirmed ! Needs: Patch A patch is needed to fix this
Projects
None yet
Development

No branches or pull requests

6 participants