VSCode + ESP-IDF + Component Dev Env
Posted: Wed Dec 18, 2024 11:49 am
Hello!
Can please someone share best practice to develop components as standalone projects to share among multiple projects?
My current approach works (compiles und runs) but some troubles with IntelliSense stuff and some warnings.
I configured multi-root environment: main component and my custom shared components in one ide window.
project-1.code-workspace looks as follows:
Compiling works. I can use my custom components in my main component without problems.
But I have nasty warnings while editing shared component's code like this:
I there any other recommended approach?
Thanks
Can please someone share best practice to develop components as standalone projects to share among multiple projects?
My current approach works (compiles und runs) but some troubles with IntelliSense stuff and some warnings.
I configured multi-root environment: main component and my custom shared components in one ide window.
- project-root/
- ├── project-1/
- │ ├── CMakeLists.txt # Main project CMake configuration
- │ ├── main/ # Application's main component
- │ │ ├── CMakeLists.txt # CMake for main component
- │ │ ├── main.c # Example source file
- │ │ └── (other source files)
- │ ├── build/ # Generated build files (after `idf.py build`)
- │ ├── sdkconfig # Configuration for ESP-IDF project
- │ └── project-1.code-workspace # VSCode workspace file
- ├── my_shared_components/
- │ ├── components/
- │ │ ├── component-1/ # Custom component 1
- │ │ │ ├── CMakeLists.txt # CMake for component-1
- │ │ │ ├── include/ # Public headers for component-1
- │ │ │ │ └── component1.h
- │ │ │ └── src/ # Source files for component-1
- │ │ │ └── component1.c
- │ │ ├── component-2/ # Custom component 2
- │ │ │ ├── CMakeLists.txt # CMake for component-2
- │ │ │ ├── include/ # Public headers for component-2
- │ │ │ │ └── component2.h
- │ │ │ └── src/ # Source files for component-2
- │ │ │ └── component2.c
- │ └── (other custom components)
- {
- "folders": [
- {
- "path": "."
- },
- {
- "path": "../my_shared_components"
- }
- ],
- "settings": {
- }
- }
But I have nasty warnings while editing shared component's code like this:
Code: Select all
#include errors detected. Consider updating your compile_commands.json or includePath. Squiggles are disabled for this translation unit...
Code: Select all
cannot open source file "portmacro.h"
Code: Select all
ESP-IDF Hint: esp_mac.h header file is not included by esp_system.h anymore. It shall then be manually included with #include "esp_mac.h"
Code: Select all
cannot open source file "esp_log.h" (dependency of "component1.h")
Thanks