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

PIO core not honoring src_filter directives #1905

Closed
fiveangle opened this Issue Oct 30, 2018 · 2 comments

Comments

Projects
None yet
2 participants
@fiveangle

fiveangle commented Oct 30, 2018

PIO core not honoring src_filter directives

On investigating a compile issue on the Marlin project (MarlinFirmware/Marlin#12216), I discovered that pio core is not honoring the src_filter directives, allowing LDF to pick up library inclusions from HAL platforms that it should never ever see for this env.

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

PIO INI:
https://github.com/fiveangle/Marlin/blob/bf2bisect1/platformio.ini

Relevant env:

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

[env:at90usb1286_dfu]
platform      = teensy
framework     = arduino
board         = at90usb1286
build_flags   = ${common.build_flags}
lib_deps      = ${common.lib_deps}
lib_ldf_mode  = deep+
src_filter    = ${common.default_src_filter} +<src/HAL/HAL_AVR>
extra_scripts = pre:buildroot/share/atom/create_custom_upload_command_DFU.py
monitor_speed = 250000

Result is it attempts to compile <Teensy_ADC> library included in src/HAL/HAL_LPC1768/HAL.h which should have been excluded based on the INI src_filter rules that excludes the src/HAL tree. I simplified the src_filter config for env:at90usb1286_dfu to omit the use of the "common.default_src_filter" so filters were listed in expected precidence order on single line within the env, but got identical results:

[ Deviot 2.3.0.dev7 ] Starting...


Processing at90usb1286_dfu (platform: teensy; board: at90usb1286; framework: arduino)

Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/teensy/at90usb1286.html
PLATFORM: Teensy > Atmel AT90USB1286 based
SYSTEM: AT90USB1286 16MHz 8KB RAM (120KB Flash)
Converting Marlin.ino
Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF MODES: FINDER(deep+) COMPATIBILITY(soft)
Collected 115 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <U8glib-HAL> 0.4
|-- <LiquidCrystal> 1.3.4
|   |-- <Wire> 1.0
|-- <TMCStepper> 0.2.2 #cefefbe
|   |-- <SPI> 1.0
|   |-- <SoftwareSerial> 1.0
|-- <Adafruit NeoPixel> 1.1.3
|-- <30aa480>
|   |-- <Wire> 1.0
|-- <Arduino-L6470> 0.6.1
|-- <c1921b4>
|   |-- <SPI> 1.0
|-- <Wire> 1.0
|-- <Servo> 1.1.2
|-- <Teensy_ADC>
|-- <SPI> 1.0
Compiling .pioenvs\at90usb1286_dfu\src\src\HAL\HAL_AVR\HAL.cpp.o
Compiling .pioenvs\at90usb1286_dfu\src\src\HAL\HAL_AVR\HAL_spi_AVR.cpp.o
Compiling .pioenvs\at90usb1286_dfu\src\src\HAL\HAL_AVR\MarlinSerial.cpp.o
[...]
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

Thanks !

-=dave


Configuration

Fails on both Windows 10 and Mac OS Mojave

$ pio --version
PlatformIO, version 3.6.1rc6

fiveangle added a commit to fiveangle/Marlin that referenced this issue Nov 3, 2018

fiveangle added a commit to fiveangle/Marlin that referenced this issue Nov 3, 2018

Add comment with reminder to remove in future
The hope is someone will eventually remove the ignore once resolved: platformio/platformio-core#1905 is resolved.

Feel free to omit this commit if you don't want to leave awareness of this future clean-up task reminder in the PIO INI file

fiveangle added a commit to fiveangle/Marlin that referenced this issue Nov 3, 2018

thinkyhead added a commit to MarlinFirmware/Marlin that referenced this issue Nov 3, 2018

@ivankravets ivankravets added the bug label Nov 19, 2018

@ivankravets ivankravets added this to the 3.6.2 milestone Nov 19, 2018

@ivankravets

This comment has been minimized.

Member

ivankravets commented Nov 19, 2018

Thank you so much for the report! It's a very interesting bug which has been just fixed. Please re-test with the latest dev/version via $ pio upgrade --dev.

fiveangle added a commit to fiveangle/Marlin that referenced this issue Nov 19, 2018

@fiveangle

This comment has been minimized.

fiveangle commented Nov 19, 2018

Works like a charm.

Thanks !

-=dave

ivankravets added a commit that referenced this issue Nov 24, 2018

Merge branch 'develop' into feature/py3
* develop: (31 commits)
  Document "erase" target
  Docs: Grammar fixes
  Bump version to 3.6.2b5
  Improved IntelliSense for PlatformIO IDE for VSCode via passing extra compiler information for C/C++ Code Parser
  Bump version to 3.6.2b4
  LDF: Stop handling "define" and "undef" when condition fails; handle CPP files in "chain+" and "deep+" modes // Resolve #1930
  Bump version to 3.6.2b3
  Handle CWD when searching for a file // Resolve #1930
  Document in `library.json` how to pass flags to a global build environment
  Bump version to 3.6.2b2
  Fix an issue when Library Dependency Finder (LDF) finds spurious dependencies in ``chain+`` and ``deep+`` modes // Resolve #1930
  Fix an issue when Library Dependency Finder (LDF) does not handle project `src_filter ` // Resolve #1905
  Bump version to 3.6.2b1
  Prepend CPPATH of library dependencies instead of appending // Resolve #1914
  Bump version to 3.6.2a3
  Go over 8010-8100 TCP ports when shutting down PIO Home server
  Docs: Add support for OLIMEX ESP32-PRO
  Rename "System" to "Hardware" for board spec
  Add info about "EN" pin for ESP32 and debug probes
  Fix pinouts for oddWires IOT-Bus JTAG
  ...

# Conflicts:
#	platformio/__init__.py
#	platformio/managers/core.py

@ivankravets ivankravets referenced this issue Nov 29, 2018

Closed

platformio 3.6.2 #34596

4 of 4 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment