Best Practise for adding files to IDF standard component

tjirsch
Posts: 1
Joined: Mon Nov 04, 2019 5:14 pm

Best Practise for adding files to IDF standard component

Postby tjirsch » Mon Nov 04, 2019 6:06 pm

Hi,

I have ported the AWS IoT SDK as an ESP32 IDF component.
I am using the mbedtls component of IDF, but have to add one header file (threading_alt.h) and change some options in /esp32/idf/components/mbedtls/port/include/mbedtls/esp_config.h.

My question is, what is the "best" way of doing this ?
Should I place the threading_alt.h file in the idf component dirs ?
Change esp_config.h in place ?
Copy the whole mbedtls dir to my projects component dir ?

I can't figure out a way to provide the additional include paths / settings to the mbedtls component due to my lack of knowledge in CMake.
Changing the components files will render them non functional if the code referenced in threading_alt.h is not provided by the app.
The threading_alt.h file is dependent on existing #ifdefs in mbedtls, but I don't know how to place the file in my apps / the sdks component dir and reference it from the mbedtls' build.
To me it seems, that I can only define the require of mbedtls by my app, but how do I tell the medtls components build about the location of the threading_alt.h file ?

Any guidance helps.

pablomartinez
Posts: 5
Joined: Thu Jul 29, 2021 7:57 am

Re: Best Practise for adding files to IDF standard component

Postby pablomartinez » Sat Jul 31, 2021 10:18 pm

Hi,

I'm in the same point as you. Could you share how did you solved this issue?

Many thanks!

pablomartinez
Posts: 5
Joined: Thu Jul 29, 2021 7:57 am

Re: Best Practise for adding files to IDF standard component

Postby pablomartinez » Sun Aug 01, 2021 6:41 pm

Ok, I found out.

You need first to enable the alternative threading from the sdkconfig (idf.py menuconfig)
Component config > mbedTLS > Enable the threading abstraction layer > Enable threading alternate implementation

And afterwads, add the following line to your project's CMakeLists.txt

include_directories(BEFORE {path_to_the_directory_contaning_threading_alt_h} )

It worked for me.

Who is online

Users browsing this forum: Baidu [Spider], Majestic-12 [Bot] and 71 guests