@@ -32,8 +32,12 @@ set(CORE_SRCS
3232 cores/esp32/stdlib_noniso.c
3333 cores/esp32/Stream.cpp
3434 cores/esp32/StreamString.cpp
35+ cores/esp32/HWCDC.cpp
3536 cores/esp32/USB.cpp
3637 cores/esp32/USBCDC.cpp
38+ cores/esp32/USBMSC.cpp
39+ cores/esp32/FirmwareMSC.cpp
40+ cores/esp32/firmware_msc_fat.c
3741 cores/esp32/wiring_pulse.c
3842 cores/esp32/wiring_shift.c
3943 cores/esp32/WMath.cpp
@@ -55,7 +59,7 @@ set(LIBRARY_SRCS
5559 libraries/FS/src/vfs_api.cpp
5660 libraries/HTTPClient/src/HTTPClient.cpp
5761 libraries/HTTPUpdate/src/HTTPUpdate.cpp
58- libraries/LITTLEFS /src/LITTLEFS .cpp
62+ libraries/LittleFS /src/LittleFS .cpp
5963 libraries/NetBIOS/src/NetBIOS.cpp
6064 libraries/Preferences/src/Preferences.cpp
6165 libraries/RainMaker/src/RMaker.cpp
@@ -73,6 +77,14 @@ set(LIBRARY_SRCS
7377 libraries/Ticker/src/Ticker.cpp
7478 libraries/Update/src/Updater.cpp
7579 libraries/Update/src/HttpsOTAUpdate.cpp
80+ libraries/USB/src/USBHID.cpp
81+ libraries/USB/src/USBHIDMouse.cpp
82+ libraries/USB/src/USBHIDKeyboard.cpp
83+ libraries/USB/src/USBHIDGamepad.cpp
84+ libraries/USB/src/USBHIDConsumerControl.cpp
85+ libraries/USB/src/USBHIDSystemControl.cpp
86+ libraries/USB/src/USBHIDVendor.cpp
87+ libraries/USB/src/USBVendor.cpp
7688 libraries/WebServer/src/WebServer.cpp
7789 libraries/WebServer/src/Parsing.cpp
7890 libraries/WebServer/src/detail/mimetable.cpp
@@ -140,7 +152,7 @@ set(includedirs
140152 libraries/FS/src
141153 libraries/HTTPClient/src
142154 libraries/HTTPUpdate/src
143- libraries/LITTLEFS /src
155+ libraries/LittleFS /src
144156 libraries/NetBIOS/src
145157 libraries/Preferences/src
146158 libraries/RainMaker/src
@@ -151,6 +163,7 @@ set(includedirs
151163 libraries/SPI/src
152164 libraries/Ticker/src
153165 libraries/Update/src
166+ libraries/USB/src
154167 libraries/WebServer/src
155168 libraries/WiFiClientSecure/src
156169 libraries/WiFi/src
@@ -161,25 +174,50 @@ set(includedirs
161174set (srcs ${CORE_SRCS} ${LIBRARY_SRCS} ${BLE_SRCS} )
162175set (priv_includes cores/esp32/libb64)
163176set (requires spi_flash mbedtls mdns esp_adc_cal wifi_provisioning nghttp)
164- set (priv_requires fatfs nvs_flash app_update spiffs bootloader_support openssl bt main )
177+ set (priv_requires fatfs nvs_flash app_update spiffs bootloader_support openssl bt esp_ipc esp_hid )
165178
179+ idf_component_register(INCLUDE_DIRS ${includedirs} PRIV_INCLUDE_DIRS ${priv_includes} SRCS ${srcs} REQUIRES ${requires} PRIV_REQUIRES ${priv_requires} )
180+
181+ string (TOUPPER ${CONFIG_IDF_TARGET} idf_target_caps)
182+ target_compile_options (${COMPONENT_TARGET} PUBLIC
183+ -DARDUINO=10812
184+ -DARDUINO_${idf_target_caps} _DEV
185+ -DARDUINO_ARCH_ESP32
186+ -DARDUINO_BOARD="${idf_target_caps} _DEV"
187+ -DARDUINO_VARIANT="${CONFIG_IDF_TARGET} "
188+ -DESP32)
189+
190+ if (CONFIG_AUTOSTART_ARDUINO)
191+ # in autostart mode, arduino-esp32 contains app_main() function and needs to
192+ # reference setup() and loop() in the main component. If we add main
193+ # component to priv_requires then we create a large circular dependency
194+ # (arduino-esp32 -> main -> arduino-esp32) and can get linker errors, so
195+ # instead we add setup() and loop() to the undefined symbols list so the
196+ # linker will always include them.
197+ #
198+ # (As they are C++ symbol, we need to add the C++ mangled names.)
199+ target_link_libraries (${COMPONENT_LIB} INTERFACE "-u _Z5setupv -u _Z4loopv" )
200+ endif ()
201+
202+ # This function adds a dependency on the given component if the component is included into the build.
203+ function (maybe_add_component component_name)
204+ idf_build_get_property(components BUILD_COMPONENTS)
205+ if (${component_name} IN_LIST components)
206+ idf_component_get_property(lib_name ${component_name} COMPONENT_LIB)
207+ target_link_libraries (${COMPONENT_LIB} PUBLIC ${lib_name} )
208+ endif ()
209+ endfunction ()
210+
211+ if (IDF_TARGET MATCHES "esp32" AND CONFIG_ESP_RMAKER_TASK_STACK)
212+ maybe_add_component(esp_rainmaker)
213+ maybe_add_component(qrcode)
214+ endif ()
166215if (IDF_TARGET MATCHES "esp32s2|esp32s3" AND CONFIG_TINYUSB_ENABLED)
167- list ( APPEND priv_requires arduino_tinyusb)
216+ maybe_add_component( arduino_tinyusb)
168217endif ()
169218if (NOT CONFIG_ARDUINO_SELECTIVE_COMPILATION OR CONFIG_ARDUINO_SELECTIVE_ArduinoOTA)
170- list ( APPEND priv_requires esp_https_ota)
219+ maybe_add_component( esp_https_ota)
171220endif ()
172221if (NOT CONFIG_ARDUINO_SELECTIVE_COMPILATION OR CONFIG_ARDUINO_SELECTIVE_LITTLEFS)
173- if (CONFIG_LITTLEFS_PAGE_SIZE)
174- list (APPEND priv_requires esp_littlefs)
175- endif ()
176- endif ()
177-
178- idf_component_register(INCLUDE_DIRS ${includedirs} PRIV_INCLUDE_DIRS ${priv_includes} SRCS ${srcs} REQUIRES ${requires} PRIV_REQUIRES ${priv_requires} )
179-
180- if (IDF_TARGET STREQUAL "esp32" )
181- target_compile_options (${COMPONENT_TARGET} PUBLIC -DARDUINO=10812 -DARDUINO_ESP32_DEV -DARDUINO_ARCH_ESP32 -DARDUINO_BOARD="ESP32_DEV" -DARDUINO_VARIANT="esp32" -DESP32)
182- endif ()
183- if (IDF_TARGET STREQUAL "esp32s2" )
184- target_compile_options (${COMPONENT_TARGET} PUBLIC -DARDUINO=10812 -DARDUINO_ESP32S2_DEV -DARDUINO_ARCH_ESP32 -DARDUINO_BOARD="ESP32S2_DEV" -DARDUINO_VARIANT="esp32s2" -DESP32)
222+ maybe_add_component(esp_littlefs)
185223endif ()
0 commit comments