For an assignment I will need to create a lot of custom components that I will use in different IDF projects, so I wanted to create a template for this. The thing is, I also want to be able to open these components as a project and be runnable with a main.c to test/develop functionalities.
Via the documentation I figured out how to create and add new components to a project, but I cant manage to create a component that can be run by a main.c in the same component folder.
Making component:
idf.py -C x:/.../custom_components create-component cus_twai
I get:
components/ // idf components
custom_components/ // custom components
____cus_twai/ // custom implementation of twai
________include/
____________cus_twai.h
________cus_twai.c
I would also like:
________main.c // includes cus_twai
I tried adding a main to make it runnable but this didn't work and I couldn't figure out why (inexperienced with CMake etc).
Should I maybe try to make a working project into a component? Or am I maybe approaching this all wrong?
Any advice is greatly appreciated, thank you!
Runnable component template
Re: Runnable component template
For testing and example applications, you could simply add a project inside your component. This is done for many IDF components which have a "test_apps" directory containing test apps. Similarly, you can add examples like this. You need to make sure to correctly use the enclosing component then, e.g. by something like in your test app's CMakeLists.txt.
Would that work for you?
Code: Select all
list(APPEND EXTRA_COMPONENT_DIRS "../")
Would that work for you?
-
- Posts: 13
- Joined: Mon Jul 31, 2023 4:53 pm
Re: Runnable component template
Thank you! That helped a lot, stupid of me that I never noticed the test_apps folders
Who is online
Users browsing this forum: No registered users and 228 guests