Directory Restructure - ESPNOW-example

akhan@eleappower.com
Posts: 4
Joined: Fri Aug 22, 2025 6:05 pm

Directory Restructure - ESPNOW-example

Postby akhan@eleappower.com » Fri Aug 22, 2025 6:54 pm

I am looking to restructure the project to an AUTOSAR formatted version as shown below:

GA_Restructure/
├─ target/ <-- main component
│ ├─ source/
│ │ ├─ GA_main.c <-- contains app_main()
│ │ └─ wifi.c
│ ├─ include/
│ │ └─ wifi.h
│ └─ CMakeLists.txt <-- component CMakeLists
├─ CMakeLists.txt <-- root project CMakeLists
└─ sdkconfig

So I've been having issues with building this. It seems it cannot find app_main.
In the root CMake list I set IDF_MAIN_COMPONENT to look at the target folder.

In the component CMakelist I defined idf_component_register to look at source/GA_main.c for app_main.
Attachments
GA_main.c
(534 Bytes) Downloaded 6 times

Sprite
Espressif staff
Espressif staff
Posts: 10612
Joined: Thu Nov 26, 2015 4:08 am

Re: Directory Restructure - ESPNOW-example

Postby Sprite » Mon Aug 25, 2025 2:31 am

Can you post both CMakeFiles.txt files?

akhan@eleappower.com
Posts: 4
Joined: Fri Aug 22, 2025 6:05 pm

Re: Directory Restructure - ESPNOW-example

Postby akhan@eleappower.com » Mon Aug 25, 2025 2:34 pm

Oh sorry attached root and components CMAKElists
Attachments
CMakeLists.txt
(158 Bytes) Downloaded 24 times
CMakeLists.txt
(427 Bytes) Downloaded 22 times

nopnop2002
Posts: 347
Joined: Thu Oct 03, 2019 10:52 pm
Contact:

Re: Directory Restructure - ESPNOW-example

Postby nopnop2002 » Tue Aug 26, 2025 4:13 am

Code: Select all

# The following lines of boilerplate have to be in your project's
# CMakeLists in this exact order for cmake to work correctly
cmake_minimum_required(VERSION 3.5)

set(EXTRA_COMPONENT_DIRS ${CMAKE_CURRENT_LIST_DIR}/target)
#set(EXTRA_COMPONENTS_DIRS ${PROJECT_SOURCE_DIR}/target)

include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(test)

MicroController
Posts: 2669
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

Re: Directory Restructure - ESPNOW-example

Postby MicroController » Tue Aug 26, 2025 8:05 am

Guess that's not going to work. There are no component directories inside "target".

akhan@eleappower.com
Posts: 4
Joined: Fri Aug 22, 2025 6:05 pm

Re: Directory Restructure - ESPNOW-example

Postby akhan@eleappower.com » Tue Aug 26, 2025 3:20 pm

Hi

Actually this line:

set(EXTRA_COMPONENT_DIRS "${CMAKE_CURRENT_LIST_DIR}/target")

worked for me. As in I was able to build it without seeing any issues.

For context my directory structure did change a bit

target
|
||---esp32
|||---Include
|||---Source

Thank you.

Who is online

Users browsing this forum: Bing [Bot], Google [Bot], Semrush [Bot] and 5 guests