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.28k stars 19.23k forks source link

[2.x] compile failure - Teensy ADC lib not compatible with AVR #12216

Closed fiveangle closed 6 years ago

fiveangle commented 6 years ago

12093 broke Teensy AVR platforms due to Teensy ADC library not compatible

Configs: https://github.com/fiveangle/Marlin/tree/bf2bisect1/Marlin

Compiling .pioenvs\at90usb1286_dfu\lib783\ADC\ADC_Module.cpp.o
In file included from C:\Users\djohnson\.platformio\packages\framework-arduinoteensy\libraries\ADC\ADC.cpp:30:0:
C:\Users\djohnson\.platformio\packages\framework-arduinoteensy\libraries\ADC\ADC.h:41:2: error: #error "Sorry, this ADC library only works on ARM-based Teensy boards."
#error "Sorry, this ADC library only works on ARM-based Teensy boards."
^
In file included from C:\Users\djohnson\.platformio\packages\framework-arduinoteensy\libraries\ADC\ADC.h:49:0,
from C:\Users\djohnson\.platformio\packages\framework-arduinoteensy\libraries\ADC\ADC.cpp:30:
C:\Users\djohnson\.platformio\packages\framework-arduinoteensy\libraries\ADC\ADC_Module.h:48:2: error: #error "Board not supported!"
#error "Board not supported!"
^
In file included from C:\Users\djohnson\.platformio\packages\framework-arduinoteensy\libraries\ADC\ADC.h:49:0,
from C:\Users\djohnson\.platformio\packages\framework-arduinoteensy\libraries\ADC\ADC.cpp:30:
C:\Users\djohnson\.platformio\packages\framework-arduinoteensy\libraries\ADC\ADC_Module.h:336:2: error: #error "F_BUS must be 108, 60, 56, 54, 48, 40, 36, 24, 4 or 2 MHz"
#error "F_BUS must be 108, 60, 56, 54, 48, 40, 36, 24, 4 or 2 MHz"
^
C:\Users\djohnson\.platformio\packages\framework-arduinoteensy\libraries\ADC\ADC_Module.h:499:23: error: 'ADC_REFERENCE' has not been declared
void setReference(ADC_REFERENCE ref_type);
^
C:\Users\djohnson\.platformio\packages\framework-arduinoteensy\libraries\ADC\ADC_Module.h:764:20: error: 'ADC_INTERNAL_SOURCE' has not been declared
int analogRead(ADC_INTERNAL_SOURCE pin) __attribute__((always_inline)) {
^
compilation terminated due to -fmax-errors=5.
*** [.pioenvs\at90usb1286_dfu\lib783\ADC\ADC.cpp.o] Error 1
In file included from C:\Users\djohnson\.platformio\packages\framework-arduinoteensy\libraries\ADC\ADC_Module.cpp:32:0:
C:\Users\djohnson\.platformio\packages\framework-arduinoteensy\libraries\ADC\ADC_Module.h:48:2: error: #error "Board not supported!"
#error "Board not supported!"
^
In file included from C:\Users\djohnson\.platformio\packages\framework-arduinoteensy\libraries\ADC\ADC_Module.cpp:32:0:
C:\Users\djohnson\.platformio\packages\framework-arduinoteensy\libraries\ADC\ADC_Module.h:336:2: error: #error "F_BUS must be 108, 60, 56, 54, 48, 40, 36, 24, 4 or 2 MHz"
#error "F_BUS must be 108, 60, 56, 54, 48, 40, 36, 24, 4 or 2 MHz"
^
C:\Users\djohnson\.platformio\packages\framework-arduinoteensy\libraries\ADC\ADC_Module.h:499:23: error: 'ADC_REFERENCE' has not been declared
void setReference(ADC_REFERENCE ref_type);
^
C:\Users\djohnson\.platformio\packages\framework-arduinoteensy\libraries\ADC\ADC_Module.h:764:20: error: 'ADC_INTERNAL_SOURCE' has not been declared
int analogRead(ADC_INTERNAL_SOURCE pin) __attribute__((always_inline)) {
^
C:\Users\djohnson\.platformio\packages\framework-arduinoteensy\libraries\ADC\ADC_Module.h: In member function 'void ADC_Module::continuousMode()':
C:\Users\djohnson\.platformio\packages\framework-arduinoteensy\libraries\ADC\ADC_Module.h:636:41: error: 'setBit' was not declared in this scope
setBit(ADC_SC3, ADC_SC3_ADCO_BIT);
^
compilation terminated due to -fmax-errors=5.
*** [.pioenvs\at90usb1286_dfu\lib783\ADC\ADC_Module.cpp.o] Error 1
 [ERROR] Took 374.01 seconds
p3p commented 6 years ago

There should be nothing in that PR that changes Teensy builds, it was isolated to the LPC176x platform.

p3p commented 6 years ago

so platformio is being "helpful" comment out line 49 (#include <adc.h>) of LPC1768/HAL.h, it fixes the build, you will need to add whatever library it is pulling in to the ignore list for your platform because it spots that header in code it isn't going to build as it's the wrong platform and gets confused.

fiveangle commented 6 years ago

Sounds more like a bug with LDF because the entire src/HAL/HAL_LPC1768 tree is supposed to be categorically ignored from the INI:

[common] default_src_filter = +<src/*> -<src/config> -<src/HAL> +<src/HAL/shared>

p3p commented 6 years ago

indeed the LDF is the helpful part of platformio that is consistently annoying me, along with it trying to build libraries for incompatible envs as long as they were already downloaded for another env

fiveangle commented 6 years ago

12311 implemented to work around PIO LDF issue

fiveangle commented 5 years ago

@p3p - Hey Chris, you may want to recheck to see if it's still worth manually specifying all libraries as a w/a for LDF because it seems there indeed was a bug in the src_filter function resolved in PIO 3.6.3b1

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.