Arduino as a component with idf as lib

majsman
Posts: 1
Joined: Tue Sep 06, 2022 8:55 am

Arduino as a component with idf as lib

Postby majsman » Thu Dec 01, 2022 3:26 pm

Hi all,

I have a large, quite complex codebase for the ESP32 that is based on Arduino and I'm trying to migrate away from platformio since it doesn't allow the flexibility that I need.

I have setup the project as a regular cmake project with the idf as a lib (following the general concepts here: https://github.com/espressif/esp-idf/tr ... idf_as_lib. I would ideally like to do it this way as, again, it lets me control

I have now got to the part where I need to include Arduino as a component, following the instructions here: https://docs.espressif.com/projects/ard ... onent.html. The issue is that the CMakeLists.txt in the Arduino component expects to be called from a registered component directory:

Code: Select all

CMake Error at /home/user/esp/esp-idf/tools/cmake/component.cmake:431 (message):
  Called idf_component_register from a non-component directory.
Call Stack (most recent call first):
  components/arduino/CMakeLists.txt:211 (idf_component_register)
 
I think I have two options, either re-write the Arduino CMakeLists.txt and have to maintain it (a bit annoying) or, try to make the Arduino CMakeLists.txt think that everything is fine and pass everything required into it while still just using the rest as vanilla CMake. I think the second option is a bit easier though, does anyone have any resources that can explain how to do this?

Thanks in advance

User avatar
gtjoseph
Posts: 92
Joined: Fri Oct 15, 2021 10:55 pm

Re: Arduino as a component with idf as lib

Postby gtjoseph » Tue Dec 06, 2022 2:01 pm

Do you really need to go down the idf-as-lib route? I'd think moving your current stuff into a regular esp-idf project and adding the ESP Arduino Core as a regular component would be the easiest route. That's what I did when moving from platformio.

ESP_igrr
Posts: 2072
Joined: Tue Dec 01, 2015 8:37 am

Re: Arduino as a component with idf as lib

Postby ESP_igrr » Tue Dec 06, 2022 3:48 pm

Hi majsman,

Could you please post more details about how you have set up the project? If you could upload some simple example which shows this issue it would probably be the best option. Otherwise, please attach your project CMakeLists.txt file and show your project structure.

Who is online

Users browsing this forum: stvlaa and 139 guests