Skip to content

Commit

Permalink
CMake: use idf_component_register
Browse files Browse the repository at this point in the history
Documentation for ESP-IDF versions 4.4, 4.5, 5.0 and 5.1 do not contain
any references to register_component(). This seems to be the way how
things where done in ESP-IDF version 3.x.

For some reason this picks up a bunch of components we don't use.
Exclude those. The net result is more lines of CMake code, but if at
some point Espressif drops support for register_component() we are
prepared.

Total sizes before:

Used stat D/IRAM:  180122 bytes ( 165734 remain, 52.1% used)
      .data size:   30524 bytes
      .bss  size:   25760 bytes
      .text size:  122811 bytes
   .vectors size:    1027 bytes
Used Flash size : 2061331 bytes
           .text: 1497211 bytes
         .rodata:  563864 bytes
Total image size: 2215693 bytes (.bin may be padded larger)

Total sizes after:

Total sizes:
Used stat D/IRAM:  180122 bytes ( 165734 remain, 52.1% used)
      .data size:   30524 bytes
      .bss  size:   25760 bytes
      .text size:  122811 bytes
   .vectors size:    1027 bytes
Used Flash size : 2061335 bytes
           .text: 1497215 bytes
         .rodata:  563864 bytes
Total image size: 2215697 bytes (.bin may be padded larger)
  • Loading branch information
stintel committed Jan 23, 2025
1 parent c48ed9d commit 4d14cec
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 41 deletions.
35 changes: 33 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
# CMakeLists in this exact order for cmake to work correctly
cmake_minimum_required(VERSION 3.5)

set(COMPONENTS main)

if($ENV{CI})
message("CI detected, disabling MultiNet support")
else()
Expand All @@ -16,6 +14,39 @@ else()
add_definitions(-DWILLOW_USER_AGENT="Willow/0.1")
endif()

set(EXCLUDE_COMPONENTS
"adf_utils"
"app_trace"
"battery_service"
"bluetooth_service"
"cmock"
"coredump_upload_service"
"esp_codec_dev"
"esp_eth"
"esp_event_cast"
"esp_gdbstub"
"esp_hid"
"esp_http_server"
"esp_https_ota"
"esp_https_server"
"esp_local_ctrl"
"espcoredump"
"idf_test"
"ieee802154"
"mqtt"
"openthread"
"ota_service"
"perfmon"
"playlist"
"protobuf-c"
"protocomm"
"touch_element"
"ulp"
"unity"
"usb"
"wifi_provisioning"
)

include($ENV{ADF_PATH}/CMakeLists.txt)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)

Expand Down
62 changes: 23 additions & 39 deletions main/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,45 +1,29 @@
set(COMPONENT_SRCS
"audio.c"
"config.c"
"display.c"
"endpoint/hass.c"
"endpoint/openhab.c"
"endpoint/rest.c"
"http.c"
"input.c"
"log.c"
"lv_img_hand_left.c"
"network.c"
"ota.c"
"slvgl.c"
"system.c"
"tasks.c"
"timer.c"
"ui.c"
"was.c"
"main.c"
)
set(COMPONENT_ADD_INCLUDEDIRS .)
set(COMPONENT_PRIV_REQUIRES
app_update
audio_board
audio_hal
audio_pipeline
audio_recorder
audio_sal
audio_stream
esp_http_client
esp_peripherals
esp_websocket_client
input_key_service
spiffs
)

if(CONFIG_WILLOW_ETHERNET)
set(COMPONENT_SRCS ${COMPONENT_SRCS} "net/ethernet.c")
set(WILLOW_ETHERNET_SRC_DIRS "net")
endif()

register_component()
idf_component_register(
SRC_DIRS
"."
"endpoint"
"${WILLOW_ETHERNET_SRC_DIRS}"
INCLUDE_DIRS
"."
"${WILLOW_ETHERNET_SRC_DIRS}"
PRIV_REQUIRES
app_update
audio_board
audio_hal
audio_pipeline
audio_recorder
audio_sal
audio_stream
esp_http_client
esp_peripherals
esp_websocket_client
input_key_service
spiffs
)

spiffs_create_partition_image(user ../spiffs/user FLASH_IN_PROJECT)

Expand Down

0 comments on commit 4d14cec

Please sign in to comment.