Wrong board used for compiling

Hi, I’m using:

    platform_packages = framework-arduinoespressif32 @ https://github.com/marcovannoord/arduino-esp32.git#idf-release/v4.0
    platform = espressif32
    framework = espidf, arduino
    board = ttgo-lora32-v2
    build_flags = 
            -D ESP32=1
            -D ARDUINO=200
    monitor_speed = 115200
    monitor_filters = esp32_exception_decoder

As config, however the build process uses /home/libor/.platformio/packages/framework-arduinoespressif32-src-a8a830ef46fb935b080bfdf62a3092dd/variants/esp32/pins_arduino.h

not what I would expect: /home/libor/.platformio/packages/framework-arduinoespressif32-src-a8a830ef46fb935b080bfdf62a3092dd/variants/ttgo-lora32-v2/pins_arduino.h

How to force platformio to use a proper board header? With framework = arduino it’s working fine.

Part of the build output:

CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/ttgo-lora32-v2.html
PLATFORM: Espressif 32 (3.2.0+sha.b9530d3) (git+https://github.com/platformio/platform-espressif32.git) > TTGO LoRa32-OLED V2
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash

Also, the board definition is read properly, “just” the #include "pins_arduino.h" uses wrong file.

Please file a bug in Issues · platformio/platform-espressif32 · GitHub.

Created bug 541