How to install platformio on an existing rtos project using esp32-wroom?

Hi guys!
First, I used “pio init -b esp32dev --ide=vscode” in an existing project with this command, but there was a problem that the framework property of the .ini file was entered into the arduino.

Then I modified it with espidf, and I tried to hit build and this error came up.

Processing esp32dev (platform: https://github.com/platformio/platform-espressif32.git; board: esp32dev; framework: espidf)
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32dev.html
PLATFORM: Espressif 32 (3.0.0+sha.55f50dc) > Espressif ESP32 Dev Module
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (esp-prog) External (esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES:
 - framework-espidf 3.40200.210118 (4.2.0)
 - tool-cmake 3.16.4
 - tool-esptoolpy 1.30000.201119 (3.0.0)
 - tool-idf 1.0.1
 - tool-mconf 1.4060000.20190628 (406.0.0)
 - tool-ninja 1.9.0
 - tool-openocd-esp32 2.1000.20201202 (10.0)
 - toolchain-esp32ulp 1.22851.191205 (2.28.51)
 - toolchain-xtensa32 2.80400.210211 (8.4.0)
Reading CMake configuration...
KeyError: 'compileGroups':
  File "C:\Users\Jay_Kim\.platformio\penv\lib\site-packages\platformio\builder\main.py", line 177:
    env.SConscript("$BUILD_SCRIPT")
  File "C:\Users\Jay_Kim\.platformio\packages\tool-scons\scons-local-4.1.0\SCons\Script\SConscript.py", line 591:
    return _SConscript(self.fs, *files, **subst_kw)
  File "C:\Users\Jay_Kim\.platformio\packages\tool-scons\scons-local-4.1.0\SCons\Script\SConscript.py", line 280:
    exec(compile(scriptdata, scriptname, 'exec'), call_stack[-1].globals)
  File "C:\Users\Jay_Kim\.platformio\platforms\espressif32@src-5f117260f75b328038ec9d3fd0e14a68\builder\main.py", line 225:
    target_elf = env.BuildProgram()
  File "C:\Users\Jay_Kim\.platformio\packages\tool-scons\scons-local-4.1.0\SCons\Util.py", line 658:
    return self.method(*nargs, **kwargs)
  File "C:\Users\Jay_Kim\.platformio\penv\lib\site-packages\platformio\builder\tools\platformio.py", line 61:
    env.ProcessProgramDeps()
  File "C:\Users\Jay_Kim\.platformio\packages\tool-scons\scons-local-4.1.0\SCons\Util.py", line 658:
    return self.method(*nargs, **kwargs)
  File "C:\Users\Jay_Kim\.platformio\penv\lib\site-packages\platformio\builder\tools\platformio.py", line 127:
    env.BuildFrameworks(env.get("PIOFRAMEWORK"))
  File "C:\Users\Jay_Kim\.platformio\packages\tool-scons\scons-local-4.1.0\SCons\Util.py", line 658:
    return self.method(*nargs, **kwargs)
  File "C:\Users\Jay_Kim\.platformio\penv\lib\site-packages\platformio\builder\tools\platformio.py", line 342:
    SConscript(env.GetFrameworkScript(f), exports="env")
  File "C:\Users\Jay_Kim\.platformio\packages\tool-scons\scons-local-4.1.0\SCons\Script\SConscript.py", line 654:
    return method(*args, **kw)
  File "C:\Users\Jay_Kim\.platformio\packages\tool-scons\scons-local-4.1.0\SCons\Script\SConscript.py", line 591:
    return _SConscript(self.fs, *files, **subst_kw)
  File "C:\Users\Jay_Kim\.platformio\packages\tool-scons\scons-local-4.1.0\SCons\Script\SConscript.py", line 280:
    exec(compile(scriptdata, scriptname, 'exec'), call_stack[-1].globals)
  File "C:\Users\Jay_Kim\.platformio\platforms\espressif32@src-5f117260f75b328038ec9d3fd0e14a68\builder\frameworks\espidf.py", line 1170:
    project_flags = get_app_flags(project_config, default_config)
  File "C:\Users\Jay_Kim\.platformio\platforms\espressif32@src-5f117260f75b328038ec9d3fd0e14a68\builder\frameworks\espidf.py", line 400:
    default_flags = _extract_flags(default_config)
  File "C:\Users\Jay_Kim\.platformio\platforms\espressif32@src-5f117260f75b328038ec9d3fd0e14a68\builder\frameworks\espidf.py", line 387:
    for cg in config["compileGroups"]:
========================================================================================================================================================================= [FAILED] Took 1.39 seconds

How can I fix it…?

And now my code can’t find esp_ble_mesh_defs.h.

It’s good at Espressif IDF…

Help…

Seems like the CMake info extraction logic is failing for your project / CMakeLists.txt with the very latest ESP32 platform. Please report this bug to Issues · platformio/platform-espressif32 · GitHub with the CMakeLists.txt files that you’re using.

As a sanity check that PlatformIO works in general, you can also try and build the standard blink example first to rule out a general error.

With your help, I found that the framework was misconnected. I think I should give an option in the pio init, so I posted a new question. Thank you.!