change(usb/examples): Trim the USB example builds

Include minimal set of components: main and everything it depends on
This commit is contained in:
Tomas Rezucha 2023-07-24 14:25:42 +02:00
parent 8fc8f3f479
commit b4c387f9f3
28 changed files with 54 additions and 21 deletions

View File

@ -4,5 +4,7 @@
# CMakeLists in this exact order for cmake to work correctly
cmake_minimum_required(VERSION 3.16)
# "Trim" the build. Include the minimal set of components, main, and anything it depends on.
set(COMPONENTS main)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(tusb_composite)

View File

@ -1,8 +1,5 @@
set(srcs "tusb_composite_main.c")
set(requires fatfs wear_levelling)
idf_component_register(
SRCS "${srcs}"
SRCS tusb_composite_main.c
INCLUDE_DIRS .
REQUIRES "${requires}"
PRIV_REQUIRES fatfs wear_levelling esp_partition
)

View File

@ -7,6 +7,7 @@
#include <errno.h>
#include <dirent.h>
#include <sys/stat.h>
#include "esp_partition.h"
#include "esp_check.h"
#include "tinyusb.h"
#include "tusb_msc_storage.h"

View File

@ -2,5 +2,7 @@
# CMakeLists in this exact order for cmake to work correctly
cmake_minimum_required(VERSION 3.16)
# "Trim" the build. Include the minimal set of components, main, and anything it depends on.
set(COMPONENTS main)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(tusb_console)

View File

@ -13,7 +13,6 @@
#include <stdlib.h>
#include <sys/reent.h>
#include "esp_log.h"
#include "esp_vfs.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "tinyusb.h"

View File

@ -4,5 +4,7 @@
# CMakeLists in this exact order for cmake to work correctly
cmake_minimum_required(VERSION 3.16)
# "Trim" the build. Include the minimal set of components, main, and anything it depends on.
set(COMPONENTS main)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(tusb_hid)

View File

@ -1,5 +1,5 @@
idf_component_register(
SRCS "tusb_hid_example_main.c"
INCLUDE_DIRS "."
REQUIRES driver
PRIV_REQUIRES driver
)

View File

@ -2,5 +2,7 @@
# CMakeLists in this exact order for cmake to work correctly
cmake_minimum_required(VERSION 3.16)
# "Trim" the build. Include the minimal set of components, main, and anything it depends on.
set(COMPONENTS main)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(tusb_midi)

View File

@ -1,3 +1,4 @@
idf_component_register(SRCS "tusb_midi_main.c"
INCLUDE_DIRS "."
PRIV_REQUIRES esp_timer
)

View File

@ -4,5 +4,7 @@
# CMakeLists in this exact order for cmake to work correctly
cmake_minimum_required(VERSION 3.16)
# "Trim" the build. Include the minimal set of components, main, and anything it depends on.
set(COMPONENTS main)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(tusb_msc)

View File

@ -1,12 +1,11 @@
set(srcs "tusb_msc_main.c")
set(requires fatfs console)
set(priv_requires fatfs console)
if(CONFIG_EXAMPLE_STORAGE_MEDIA_SPIFLASH)
list(APPEND requires wear_levelling)
list(APPEND priv_requires wear_levelling esp_partition)
endif()
idf_component_register(
SRCS "${srcs}"
SRCS "tusb_msc_main.c"
INCLUDE_DIRS .
REQUIRES "${requires}"
PRIV_REQUIRES "${priv_requires}"
)

View File

@ -15,6 +15,7 @@
#include <dirent.h>
#include "esp_console.h"
#include "esp_check.h"
#include "esp_partition.h"
#include "driver/gpio.h"
#include "tinyusb.h"
#include "tusb_msc_storage.h"

View File

@ -2,5 +2,7 @@
# CMakeLists in this exact order for cmake to work correctly
cmake_minimum_required(VERSION 3.16)
# "Trim" the build. Include the minimal set of components, main, and anything it depends on.
set(COMPONENTS main)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(tusb_ncm)

View File

@ -1,2 +1,4 @@
idf_component_register(SRCS "tusb_ncm_main.c"
INCLUDE_DIRS "")
INCLUDE_DIRS ""
PRIV_REQUIRES esp_wifi nvs_flash
)

View File

@ -2,5 +2,7 @@
# CMakeLists in this exact order for cmake to work correctly
cmake_minimum_required(VERSION 3.16)
# "Trim" the build. Include the minimal set of components, main, and anything it depends on.
set(COMPONENTS main)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(tusb_serial_device)

View File

@ -4,5 +4,7 @@
# CMakeLists in this exact order for cmake to work correctly
cmake_minimum_required(VERSION 3.16)
# "Trim" the build. Include the minimal set of components, main, and anything it depends on.
set(COMPONENTS main)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(cdc_acm_host)

View File

@ -1,2 +1,4 @@
idf_component_register(SRCS "usb_cdc_example_main.c"
INCLUDE_DIRS ".")
INCLUDE_DIRS "."
PRIV_REQUIRES usb
)

View File

@ -4,5 +4,7 @@
# CMakeLists in this exact order for cmake to work correctly
cmake_minimum_required(VERSION 3.16)
# "Trim" the build. Include the minimal set of components, main, and anything it depends on.
set(COMPONENTS main)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(cdc_acm_vcp)

View File

@ -1,4 +1,5 @@
idf_component_register(
SRCS "cdc_acm_vcp_example_main.cpp"
INCLUDE_DIRS "."
PRIV_REQUIRES usb
)

View File

@ -2,6 +2,8 @@
# CMakeLists in this exact order for cmake to work correctly
cmake_minimum_required(VERSION 3.5)
# "Trim" the build. Include the minimal set of components, main, and anything it depends on.
set(COMPONENTS main)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
get_filename_component(ProjectId ${CMAKE_CURRENT_LIST_DIR} NAME)
string(REPLACE " " "_" ProjectId ${ProjectId})

View File

@ -1,2 +1,4 @@
idf_component_register(SRCS "hid_host_example.c"
INCLUDE_DIRS ".")
INCLUDE_DIRS "."
PRIV_REQUIRES usb driver
)

View File

@ -2,5 +2,7 @@
# CMakeLists in this exact order for cmake to work correctly
cmake_minimum_required(VERSION 3.16)
# "Trim" the build. Include the minimal set of components, main, and anything it depends on.
set(COMPONENTS main)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(usb-msc)

View File

@ -1,3 +1,4 @@
idf_component_register(SRCS "msc_example_main.c"
INCLUDE_DIRS ""
REQUIRES usb vfs)
PRIV_REQUIRES usb fatfs driver esp_timer
)

View File

@ -7,6 +7,7 @@
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <sys/stat.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "freertos/event_groups.h"
@ -16,11 +17,9 @@
#include "msc_host.h"
#include "msc_host_vfs.h"
#include "ffconf.h"
#include "esp_vfs.h"
#include "errno.h"
#include "hal/usb_hal.h"
#include "driver/gpio.h"
#include <esp_vfs_fat.h>
#include "esp_vfs_fat.h"
#define USB_DISCONNECT_PIN GPIO_NUM_10

View File

@ -2,5 +2,7 @@
# in this exact order for cmake to work correctly
cmake_minimum_required(VERSION 3.16)
# "Trim" the build. Include the minimal set of components, main, and anything it depends on.
set(COMPONENTS main)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(usb_host_lib_example)

View File

@ -1,2 +1,4 @@
idf_component_register(SRCS "usb_host_lib_main.c" "class_driver.c"
INCLUDE_DIRS ".")
INCLUDE_DIRS "."
PRIV_REQUIRES usb
)

View File

@ -2,5 +2,7 @@
# CMakeLists in this exact order for cmake to work correctly
cmake_minimum_required(VERSION 3.16)
# "Trim" the build. Include the minimal set of components, main, and anything it depends on.
set(COMPONENTS main)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(usb-uvc)

View File

@ -1,3 +1,3 @@
idf_component_register(SRCS "main.c" "tcp_server.c"
INCLUDE_DIRS ""
REQUIRES protocol_examples_common nvs_flash usb mdns esp_ringbuf esp_timer esp_wifi driver)
PRIV_REQUIRES protocol_examples_common nvs_flash usb mdns esp_ringbuf esp_timer esp_wifi driver)