Skip to content

Commit

Permalink
chore: Add release-v4.4 to CI build
Browse files Browse the repository at this point in the history
  • Loading branch information
peter-marcisovsky committed Feb 22, 2024
1 parent 18009fa commit 36f26fd
Show file tree
Hide file tree
Showing 10 changed files with 103 additions and 22 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build_and_run_test_app_usb.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
strategy:
fail-fast: false
matrix:
idf_ver: ["release-v5.0", "release-v5.1", "release-v5.2", "latest"]
idf_ver: ["release-v4.4", "release-v5.0", "release-v5.1", "release-v5.2", "latest"]
runs-on: ubuntu-20.04
container: espressif/idf:${{ matrix.idf_ver }}
steps:
Expand Down
10 changes: 10 additions & 0 deletions device/esp_tinyusb/test_app/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,14 @@
# CMakeLists in this exact order for cmake to work correctly
cmake_minimum_required(VERSION 3.16)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)

# Set the components to include the tests for.
set(TEST_COMPONENTS)
set(EXTRA_COMPONENT_DIRS)

if("${IDF_VERSION_MAJOR}.${IDF_VERSION_MINOR}" VERSION_GREATER_EQUAL "5.0")
list(APPEND EXTRA_COMPONENT_DIRS ../)
list(APPEND TEST_COMPONENTS "esp_tinyusb")
endif()

project(test_app_usb_device_esp_tinyusb)
26 changes: 24 additions & 2 deletions device/esp_tinyusb/test_app/main/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,26 @@
include($ENV{IDF_PATH}/tools/cmake/version.cmake)
set (TINYUSB_LIB)
if("${IDF_VERSION_MAJOR}.${IDF_VERSION_MINOR}" VERSION_GREATER_EQUAL "5.0")
set(TINYUSB_LIB "esp_tinyusb")
else()
set(TINYUSB_LIB "tinyusb")
endif()

# TODO: once IDF_v4.4 is at the EOL support, use WHOLE_ARCHIVE
idf_component_register(SRCS "test_esp_tinyusb.c" "test_bvalid_sig.c" "test_app_main.c"
INCLUDE_DIRS "."
REQUIRES unity esp_tinyusb
WHOLE_ARCHIVE)
REQUIRES unity ${TINYUSB_LIB})

# In order for the cases defined by `TEST_CASE` to be linked into the final elf,
# the component can be registered as WHOLE_ARCHIVE

# Due to the backward compatibility to IDFv4.4 (in which WHOLE_ARCHIVE is not implemented) we use following approach:
# Any non-static function from test_app/main/*.c (apart from test_app_main.c) file is added as an undefined symbol
# because otherwise the linker will ignore test_app/main/*.c as it has no other files depending on any
# symbols in it.

# force-link test_bvalid_sig.c
set_property(TARGET ${COMPONENT_LIB} APPEND PROPERTY INTERFACE_LINK_LIBRARIES "-u tud_mount_cb")
# force-link test_esp_tinyusb.c - void function linker_hook created because:
# no non-static function, no dependency to already force-linked test_bvalid_sig.c
set_property(TARGET ${COMPONENT_LIB} APPEND PROPERTY INTERFACE_LINK_LIBRARIES "-u linker_hook")
5 changes: 4 additions & 1 deletion device/esp_tinyusb/test_app/main/test_esp_tinyusb.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
Expand All @@ -22,6 +22,9 @@

#define VFS_PATH "/dev/usb-cdc1"

// idf_component_register(WHOLE_ARCHIVE) backward compatibility to IDF_v4.4
void linker_hook(void) {};

static const tusb_desc_device_t cdc_device_descriptor = {
.bLength = sizeof(cdc_device_descriptor),
.bDescriptorType = TUSB_DESC_DEVICE,
Expand Down
17 changes: 13 additions & 4 deletions host/class/cdc/usb_host_cdc_acm/test_app/main/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,18 @@ else()
set(TINYUSB_LIB "tinyusb")
endif()

# In order for the cases defined by `TEST_CASE` to be linked into the final elf,
# the component can be registered as WHOLE_ARCHIVE
# TODO: once IDF_v4.4 is at the EOL support, use WHOLE_ARCHIVE
idf_component_register(SRCS "test_cdc_acm_host.c" "usb_device.c" "test_app_main.c"
INCLUDE_DIRS "."
REQUIRES usb_host_cdc_acm unity ${TINYUSB_LIB}
WHOLE_ARCHIVE)
REQUIRES usb_host_cdc_acm unity ${TINYUSB_LIB})

# In order for the cases defined by `TEST_CASE` to be linked into the final elf,
# the component can be registered as WHOLE_ARCHIVE

# Due to the backward compatibility to IDFv4.4 (in which WHOLE_ARCHIVE is not implemented) we use following approach:
# Any non-static function test_app/main/*.c (apart from test_app_main.c) file is added as an undefined symbol
# because otherwise the linker will ignore test_app/main/*.c as it has no other files depending on any
# symbols in it.

# force-link test_cdc_acm_host.c
set_property(TARGET ${COMPONENT_LIB} APPEND PROPERTY INTERFACE_LINK_LIBRARIES "-u usb_lib_task")
19 changes: 15 additions & 4 deletions host/class/hid/usb_host_hid/test_app/main/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,20 @@ else()
set(TINYUSB_LIB "tinyusb")
endif()

# In order for the cases defined by `TEST_CASE` to be linked into the final elf,
# the component can be registered as WHOLE_ARCHIVE
# TODO: once IDF_v4.4 is at the EOL support, use WHOLE_ARCHIVE
idf_component_register(SRC_DIRS .
INCLUDE_DIRS .
REQUIRES unity usb usb_host_hid ${TINYUSB_LIB}
WHOLE_ARCHIVE)
REQUIRES unity usb usb_host_hid ${TINYUSB_LIB})

# In order for the cases defined by `TEST_CASE` to be linked into the final elf,
# the component can be registered as WHOLE_ARCHIVE

# Due to the backward compatibility to IDFv4.4 (in which WHOLE_ARCHIVE is not implemented) we use following approach:
# Any non-static function test_app/main/*.c (apart from test_app_main.c) file is added as an undefined symbol
# because otherwise the linker will ignore test_app/main/*.c as it has no other files depending on any
# symbols in it.

# force-link test_hid_basic.c
set_property(TARGET ${COMPONENT_LIB} APPEND PROPERTY INTERFACE_LINK_LIBRARIES "-u test_hid_setup")
# force-link test_hid_err_handling.c
set_property(TARGET ${COMPONENT_LIB} APPEND PROPERTY INTERFACE_LINK_LIBRARIES "-u test_interface_callback_handler")
18 changes: 14 additions & 4 deletions host/class/msc/usb_host_msc/test_app/main/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,19 @@ else()
set(TINYUSB_LIB "tinyusb")
endif()

# In order for the cases defined by `TEST_CASE` to be linked into the final elf,
# the component can be registered as WHOLE_ARCHIVE
# TODO: once IDF_v4.4 is at the EOL support, use WHOLE_ARCHIVE
idf_component_register(SRC_DIRS .
INCLUDE_DIRS .
REQUIRES unity usb usb_host_msc ${TINYUSB_LIB}
WHOLE_ARCHIVE)
REQUIRES unity usb usb_host_msc ${TINYUSB_LIB})

# In order for the cases defined by `TEST_CASE` to be linked into the final elf,
# the component can be registered as WHOLE_ARCHIVE

# Due to the backward compatibility to IDFv4.4 (in which WHOLE_ARCHIVE is not implemented) we use following approach:
# Any non-static function test_app/main/*.c (apart from test_app_main.c) file is added as an undefined symbol
# because otherwise the linker will ignore test_app/main/*.c as it has no other files depending on any
# symbols in it.

# force-link test_msc.c - void function linker_hook created because:
# no non-static function
set_property(TARGET ${COMPONENT_LIB} APPEND PROPERTY INTERFACE_LINK_LIBRARIES "-u linker_hook")
5 changes: 4 additions & 1 deletion host/class/msc/usb_host_msc/test_app/main/test_msc.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

/*
* SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
Expand All @@ -19,6 +19,9 @@

#if SOC_USB_OTG_SUPPORTED

// idf_component_register(WHOLE_ARCHIVE) backward compatibility to IDF_v4.4
void linker_hook(void) {};

static const char *TAG = "APP";

#define ESP_OK_ASSERT(exp) TEST_ASSERT_EQUAL(ESP_OK, exp)
Expand Down
18 changes: 14 additions & 4 deletions host/class/uvc/usb_host_uvc/test_app/main/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,19 @@ else()
set(TINYUSB_LIB "tinyusb")
endif()

# In order for the cases defined by `TEST_CASE` to be linked into the final elf,
# the component can be registered as WHOLE_ARCHIVE
# TODO: once IDF_v4.4 is at the EOL support, use WHOLE_ARCHIVE
idf_component_register(SRCS "test_uvc.c" "libusb_parse.c" "test_app_main.c"
INCLUDE_DIRS "." "../../private_include"
REQUIRES usb_host_uvc usb unity
WHOLE_ARCHIVE)
REQUIRES usb_host_uvc usb unity)

# In order for the cases defined by `TEST_CASE` to be linked into the final elf,
# the component can be registered as WHOLE_ARCHIVE

# Due to the backward compatibility to IDFv4.4 (in which WHOLE_ARCHIVE is not implemented) we use following approach:
# Any non-static function from test_app/main/*.c (apart from test_app_main.c) file is added as an undefined symbol
# because otherwise the linker will ignore test_app/main/*.c as it has no other files depending on any
# symbols in it.

# force-link test_uvc.c - void function linker_hook created because:
# no non-static function
set_property(TARGET ${COMPONENT_LIB} APPEND PROPERTY INTERFACE_LINK_LIBRARIES "-u linker_hook")
5 changes: 4 additions & 1 deletion host/class/uvc/usb_host_uvc/test_app/main/test_uvc.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
Expand Down Expand Up @@ -28,6 +28,9 @@
int libusb_parse_configuration(struct libusb_config_descriptor *config, const uint8_t *buffer, int size);
void libusb_clear_config_descriptor(struct libusb_config_descriptor *config);

// idf_component_register(WHOLE_ARCHIVE) backward compatibility to IDF_v4.4
void linker_hook(void) {};

const uint8_t CANYON_CNE_CWC2[] = {
0x09, 0x02, 0x7d, 0x02, 0x04, 0x01, 0x00, 0x80, 0xfa, 0x08, 0x0b, 0x00, 0x02, 0x0e, 0x03, 0x00,
0x05, 0x09, 0x04, 0x00, 0x00, 0x01, 0x0e, 0x01, 0x00, 0x05, 0x0d, 0x24, 0x01, 0x00, 0x01, 0x4d,
Expand Down

0 comments on commit 36f26fd

Please sign in to comment.