Open maxgerhardt opened 2 years ago
or an extra script with
Did you use pre:
extra script?
Okay with pre:
the env.AddBuildMiddleware()
script works, the env["SRC_FILTER"]
one not. Still, someone trying to just port a STM32Cube project to PlatformIO as their first task will have difficulties coming up with that one.
Thanks! I'll think about how to implement this.
Configuration
Operating system: Win10 x64
PlatformIO Version (
platformio --version
):6.0.2
Description of problem
Source filters can be applied to folders within
src
by usingbuild_src_filter
and in self-controlled libraries throughsrcFilter
in thelibrary.json
, as discussed in https://github.com/platformio/platformio-core/issues/3801#issuecomment-762383421.However, sometimes, especially in STM32Cube projects though, this is not sufficient and a global source filter that applies to every source file in the build system would be helpful.
Take for example this official STM32Cube H7 ADC example. It uses the Drivers\BSP\STM32H747I-DISCO library, but only a single source file from it:
stm32h747i_discovery.c
. When telling PlatformIO to use that BSP variant with(and the
stm32h747i_discovery_conf.h
is copied from the official example), still a ton of include errors occur from source files likestm32h747i_discovery_audio.c
which were never supposed to be compiled in the first place.Since the library is added by the builder script and not in the user's control (if he wants to use what's in
framework-stm32cubeh7
), the user cannot easily exclude these source files. Things likeor an extra script with
or
have no effect. Only remedies are a manual copy of the needed files are adding all missing configuration files which were never supposed to be used + compiled in the first place.
This is not nice and discourages people from going using PlatformIO with STM32Cube projects, all which do similiar things with their selective source code selection.
Thus, a e.g.
build_global_src_filter
option or similiar would be nice.Steps to Reproduce
include/
folderActual Results
6 fatal inlude errors.
Expected Results
Successfull compilation given the usage of a mechanism that excludes the non-needed files.
If problems with PlatformIO Build System:
The content of
platformio.ini
:Source file to reproduce issue:
Additional info