Building a specific file

Hi ,

I want to build a specific file on the src folder apart from the main.cpp and create the binary in pio build folder.
If the specific file is abc.cpp ,

I tried to use the method mentioned in -

my .ini is ;

[env]
platform = ststm32
board = nucleo_f767zi
framework = arduino
upload_protocol = serial
monitor_speed = 921600
test_framework = unity
board_build.ldscript = ldscript.ld

build_flags =
  -DARDUINOJSON_USE_DOUBLE=1
  -DMBEDTLS_CONFIG_FILE=\"include\\mbedtls_config.h\"
  -DFLASH_BASE_ADDRESS=0x08018000
  -DFLASH_DATA_SECTOR=3
  -I.
  -Iinclude
  -DWOLFBOOT_HASH_SHA256=1
  -DHSE_VALUE=12000000U
lib_deps =
  bblanchon/ArduinoJson@^6.17.2
  densaugeo/base64@^1.2.0
  arduino-libraries/ArduinoECCX08@^1.3.5
  SparkFun u-blox GNSS Arduino Library@^2.0.15
  SPI
extra_scripts =
  pre:scripts/firmware-name.py

[development]
build_flags =
  -DABC_PROJECT_ID=\"abc-dev\"
test_filter = test_eng

[production]
build_flags =
  -w
  -DABC_PROJECT_ID=\"abcproj-208715\"
test_filter = test_mfg

[env:abc]
platform = ststm32
board = nucleo_f767zi
framework = arduino
         
build_src_filter = "+<abc.cpp>"

and I used “pio run -e abc”
Doesn’t seems like compiling the specific file, also compiles all the libraries in lib_deps which use in main.cpp and not necessary for abc.cpp and giving errors .

My abc.cpp file that I want to build is -

# include <Arduino.h>
# define BOOT_MODE PB12
void setup()
{
  // Setup and Initialize serial for debug
  Serial.begin(115200);
  // Initializing the bootloader pin
  pinMode(BOOT_MODE, OUTPUT);
  digitalWrite(BOOT_MODE, LOW);
}

void loop()
{
  
  if (Serial.available() > 0)
  {
    String incomingData = Serial.readString();
    if (incomingData == "boot")
    {
      digitalWrite(BOOT_MODE, HIGH);
      delay(250);
      NVIC_SystemReset();
    }
  }
}

Appreciate if someone can help me with this issue .

Thank,
Sam.