MarlinFirmware / Marlin

Marlin is an optimized firmware for RepRap 3D printers based on the Arduino platform. Many commercial 3D printers come with Marlin installed. Check with your vendor if you need source code for your specific machine.
https://marlinfw.org
GNU General Public License v3.0
16.34k stars 19.26k forks source link

[BUG] 393e186 fixes one problem, but exposes another on LPC1768 #15281

Closed salfter closed 5 years ago

salfter commented 5 years ago

Description

I've been having problems building for the Re-ARM...see #15277. I undid my fix, applied the most recent commit in its place, and now I'm getting this:

Compiling .pio\build\LPC1768\src\src\HAL\HAL_LPC1768\persistent_store_flash.cpp.o
In file included from C:\users\salfter\.platformio\packages\framework-arduino-lpc176x\cores\arduino/Arduino.h:33,
                 from e:\tmp\marlin\marlin\src\hal\shared\marduino.h:36,
                 from e:\tmp\marlin\marlin\src\inc\marlinconfigpre.h:33,
                 from Marlin\src\HAL\HAL_LPC1768\include\digipot_mcp4451_I2C_routines.c:28:
C:\users\salfter\.platformio\packages\framework-arduino-lpc176x\cores\arduino/const_functions.h:3:10: fatal error: cstdint: No such file or directory
 #include <cstdint>
          ^~~~~~~~~
compilation terminated.

An AtMEGA2560 build for another printer completed without issue, which suggests there's still something off in the LPC1768-specific code.

I think I've narrowed it down to src/HAL/HAL_LPC1768/include/digipot_mcp4451_I2C_routines.c. AFAICT, this hardware is used by the MKS SBASE, but I'm using a RAMPS on an Re-ARM. #ifdef TARGET_LPC1768 causes inc/MarlinConfigPre.h to get loaded here, but maybe some files somewhere either aren't getting included or are included in the wrong order as it's complaining that a standard header is missing. If I change the #ifdef to an #ifndef (not a production-grade fix, but this is only for testing) so that the entire file is essentially skipped, the firmware builds without issue.

One possibility: is a C++ header, but digipot_mcp4451_I2C_routines.c is a C file. My skills with C vs. C++ are sufficiently rusty that I'm not sure how to untangle this and get it building right, other than with the #ifndef hack described above.

Steps to Reproduce

  1. build Marlin for an LPC1768 platform

Expected behavior: [What you expect to happen]

successful build

Actual behavior: [What actually happens]

Compiling .pio\build\LPC1768\src\src\HAL\HAL_LPC1768\persistent_store_flash.cpp.o
In file included from C:\users\salfter\.platformio\packages\framework-arduino-lpc176x\cores\arduino/Arduino.h:33,
                 from e:\tmp\marlin\marlin\src\hal\shared\marduino.h:36,
                 from e:\tmp\marlin\marlin\src\inc\marlinconfigpre.h:33,
                 from Marlin\src\HAL\HAL_LPC1768\include\digipot_mcp4451_I2C_routines.c:28:
C:\users\salfter\.platformio\packages\framework-arduino-lpc176x\cores\arduino/const_functions.h:3:10: fatal error: cstdint: No such file or directory
 #include <cstdint>
          ^~~~~~~~~
compilation terminated.
thinkyhead commented 5 years ago

The mixture of C and C++ is a bit of a pitfall, not to mention the order of includes is sometimes very fiddly. We'll get this worked out during the process of shuffling core headers around.

github-actions[bot] commented 4 years ago

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.