I am trying to include UART driver files in my project folder and for that I have make appropriate changes in CMAKE file. I have added a custom function in "uart.c" file and it needs to be in that particular file only.
Now this works perfectly in ESP-IDF v5.2.2 but when I import the code any try to build it with versions 5.3+ I am having issues of multiple definitions. These are all the functions of "uart.c" files one from the file I have included locally and one from the original component directory of framework.
I am using ESP IDE
[img]FAILED: 4G_Module.elf [/img]
This is my file structure
Project
->driver
-->uart.c
-->uart.h
-->cmake.txt
->main
-->main.c
-->other files
-->cmake.txt
->cmake.txt
From the online reference I read about migration guide the have changed the structure of driver files and have added linking method but I am unclear about it.
Can somebody guide me through this, am I missing something or it is not possible?
Issue in including driver files in project directory in ESP32C3 using ESP-IDE
-
- Posts: 1954
- Joined: Mon Oct 17, 2022 7:38 pm
- Location: Europe, Germany
Re: Issue in including driver files in project directory in ESP32C3 using ESP-IDE
I tried this method as mentioned here I have shared few snap shots if it helps, still I am not able to resolve error, it seems it cannot find driver files, any suggestions? And cmake for components:MicroController wrote: ↑Thu Jan 23, 2025 10:06 amhttps://esp32.com/viewtopic.php?f=13&t=43944#p143073
Code: Select all
idf_component_register(SRCS "m_uart.c"
INCLUDE_DIRS "include")
Code: Select all
idf_component_register(SRCS "Application/src/main.c" "Application/src/lte_module.c" "Application/src/esp_uart.c"
INCLUDE_DIRS "./Application/include/"
)
target_link_libraries(${COMPONENT_LIB} PRIVATE custom_uart)
Re: Issue in including driver files in project directory in ESP32C3 using ESP-IDE
I found the issue in cmake although I ended up at the same place still I am getting multiple definition error,
I made the following changes in cmake of components directory:
Can anybody help?
I made the following changes in cmake of components directory:
Code: Select all
idf_component_register(SRCS "m_uart.c"
INCLUDE_DIRS "include"
PRIV_REQUIRES "esp_driver_gpio")
-
- Posts: 1954
- Joined: Mon Oct 17, 2022 7:38 pm
- Location: Europe, Germany
Re: Issue in including driver files in project directory in ESP32C3 using ESP-IDE
Because now you have symbols from a component named "custom_uart" colliding with symbols from the component "esp_driver_uart".
"copy the component into your project's "components"" means copying the directory from the IDF, in this case "esp_driver_uart". The name of the component is the name of the directory; if it's different it is seen as a different component and won't 'override' the IDF's "esp_driver_uart".
See also https://esp32.com/viewtopic.php?f=13&t=43585#p142107
Re:[Solved] Issue in including driver files in project directory in ESP32C3 using ESP-IDE
That works Issue solved, Thank you!
Who is online
Users browsing this forum: No registered users and 64 guests