diff --git a/.gitignore b/.gitignore index 4d9511e9d..3128aa229 100644 --- a/.gitignore +++ b/.gitignore @@ -18,3 +18,4 @@ sdkconfig sdkconfig.old version.txt dependencies.lock +managed_components/ diff --git a/build.sh b/build.sh index 2ef451734..3a3cbadfa 100755 --- a/build.sh +++ b/build.sh @@ -17,7 +17,7 @@ COPY_OUT=0 DEPLOY_OUT=0 function print_help() { - echo "Usage: build.sh [-s] [-A ] [-I ] [-i ] [-c ] [-t ] [-b ] [config ...]" + echo "Usage: build.sh [-s] [-A ] [-I ] [-i ] [-c ] [-t ] [-b ] [config ...]" echo " -s Skip installing/updating of ESP-IDF and all components" echo " -A Set which branch of arduino-esp32 to be used for compilation" echo " -I Set which branch of ESP-IDF to be used for compilation" @@ -58,6 +58,7 @@ while getopts ":A:I:i:c:t:b:sd" opt; do b=$OPTARG if [ "$b" != "build" ] && [ "$b" != "menuconfig" ] && + [ "$b" != "reconfigure" ] && [ "$b" != "idf_libs" ] && [ "$b" != "copy_bootloader" ] && [ "$b" != "mem_variant" ]; then @@ -121,6 +122,9 @@ if [ "$BUILD_TYPE" != "all" ]; then fi rm -rf build sdkconfig out +echo "* Reconfigure Project" +idf.py reconfigure +rm -rf build sdkconfig # Add components version info mkdir -p "$AR_TOOLS/sdk" && rm -rf version.txt && rm -rf "$AR_TOOLS/sdk/versions.txt" @@ -187,6 +191,12 @@ for target_json in `jq -c '.targets[]' configs/builds.json`; do done done +# update package_esp32_index.template.json +if [ "$BUILD_TYPE" = "all" ]; then + python3 ./tools/gen_tools_json.py -i "$IDF_PATH" -j "$AR_COMPS/arduino/package/package_esp32_index.template.json" -o "$AR_OUT/" + if [ $? -ne 0 ]; then exit 1; fi +fi + # archive the build if [ "$BUILD_TYPE" = "all" ]; then ./tools/archive-build.sh diff --git a/components/arduino_tinyusb/CMakeLists.txt b/components/arduino_tinyusb/CMakeLists.txt index 041eeec0f..0872021eb 100755 --- a/components/arduino_tinyusb/CMakeLists.txt +++ b/components/arduino_tinyusb/CMakeLists.txt @@ -1,37 +1,22 @@ -idf_component_register(REQUIRES esp_rom freertos soc PRIV_REQUIRES arduino main) - if(CONFIG_TINYUSB_ENABLED) ### variables ### ################# - # if(IDF_TARGET STREQUAL "esp32s2") + + if(IDF_TARGET STREQUAL "esp32s2") set(compile_options "-DCFG_TUSB_MCU=OPT_MCU_ESP32S2" "-DCFG_TUSB_DEBUG=${CONFIG_TINYUSB_DEBUG_LEVEL}" "-Wno-type-limits" # needed for the vanila tinyusb with turned off classes ) - # elseif(IDF_TARGET STREQUAL "esp32s3") - # set(compile_options - # "-DCFG_TUSB_MCU=OPT_MCU_ESP32S2" - # "-DCFG_TUSB_DEBUG=${CONFIG_TINYUSB_DEBUG_LEVEL}" - # "-Wno-type-limits" # needed for the vanila tinyusb with turned off classes - # ) - # endif() - idf_component_get_property(FREERTOS_ORIG_INCLUDE_PATH freertos - ORIG_INCLUDE_PATH) - set(includes_private - # tusb: - "${COMPONENT_DIR}/tinyusb/hw/bsp/" - "${COMPONENT_DIR}/tinyusb/src/" - "${COMPONENT_DIR}/tinyusb/src/device" - ) + elseif(IDF_TARGET STREQUAL "esp32s3") + set(compile_options + "-DCFG_TUSB_MCU=OPT_MCU_ESP32S3" + "-DCFG_TUSB_DEBUG=${CONFIG_TINYUSB_DEBUG_LEVEL}" + "-Wno-type-limits" # needed for the vanila tinyusb with turned off classes + ) + endif() - set(includes_public - # tusb: - "${FREERTOS_ORIG_INCLUDE_PATH}" - "${COMPONENT_DIR}/tinyusb/src/" - # espressif: - "${COMPONENT_DIR}/include") set(srcs # espressif: "${COMPONENT_DIR}/src/dcd_esp32sx.c" @@ -49,14 +34,37 @@ if(CONFIG_TINYUSB_ENABLED) "${COMPONENT_DIR}/tinyusb/src/device/usbd.c" "${COMPONENT_DIR}/tinyusb/src/tusb.c") + set(includes_private + # tusb: + "${COMPONENT_DIR}/tinyusb/hw/bsp/" + "${COMPONENT_DIR}/tinyusb/src/" + "${COMPONENT_DIR}/tinyusb/src/device" + ) + + idf_component_get_property(FREERTOS_ORIG_INCLUDE_PATH freertos + ORIG_INCLUDE_PATH) + set(includes_public + # tusb: + "${FREERTOS_ORIG_INCLUDE_PATH}" + "${COMPONENT_DIR}/tinyusb/src/" + # espressif: + "${COMPONENT_DIR}/include") + + set(requires esp_rom freertos soc) + set(priv_requires arduino main) ### tinyusb lib ### ################### - add_library(arduino_tinyusb STATIC ${srcs}) - target_include_directories( - arduino_tinyusb - PUBLIC ${includes_public} - PRIVATE ${includes_private}) - target_compile_options(arduino_tinyusb PRIVATE ${compile_options}) - target_link_libraries(${COMPONENT_TARGET} INTERFACE arduino_tinyusb) + idf_component_register(INCLUDE_DIRS ${includes_public} PRIV_INCLUDE_DIRS ${includes_private} SRCS ${srcs} REQUIRES ${requires} PRIV_REQUIRES ${priv_requires}) + # add_library(${COMPONENT_TARGET} STATIC ${srcs}) + # target_include_directories( + # ${COMPONENT_TARGET} + # PUBLIC ${includes_public} + # PRIVATE ${includes_private}) + target_compile_options(${COMPONENT_TARGET} PRIVATE ${compile_options}) + #target_link_libraries(${COMPONENT_TARGET} INTERFACE ${COMPONENT_TARGET}) + +else() + + idf_component_register() endif() diff --git a/components/arduino_tinyusb/src/dcd_esp32sx.c b/components/arduino_tinyusb/src/dcd_esp32sx.c index 048b44e61..29fbe99cb 100755 --- a/components/arduino_tinyusb/src/dcd_esp32sx.c +++ b/components/arduino_tinyusb/src/dcd_esp32sx.c @@ -28,17 +28,16 @@ #include "tusb_option.h" -#if (((CFG_TUSB_MCU == OPT_MCU_ESP32S2) || (CFG_TUSB_MCU == OPT_MCU_ESP32S3)) && TUSB_OPT_DEVICE_ENABLED) +#if (((CFG_TUSB_MCU == OPT_MCU_ESP32S2) || (CFG_TUSB_MCU == OPT_MCU_ESP32S3)) && CFG_TUD_ENABLED) // Espressif -#include "driver/periph_ctrl.h" #include "freertos/xtensa_api.h" #include "esp_intr_alloc.h" #include "esp_log.h" -#include "driver/gpio.h" #include "soc/dport_reg.h" #include "soc/gpio_sig_map.h" #include "soc/usb_periph.h" +#include "soc/periph_defs.h" // for interrupt source #include "device/dcd.h" @@ -60,6 +59,7 @@ typedef struct { uint16_t queued_len; uint16_t max_size; bool short_packet; + uint8_t interval; } xfer_ctl_t; static const char *TAG = "TUSB:DCD"; @@ -284,6 +284,14 @@ void dcd_disconnect(uint8_t rhport) USB0.dctl |= USB_SFTDISCON_M; } +void dcd_sof_enable(uint8_t rhport, bool en) +{ + (void) rhport; + (void) en; + + // TODO implement later +} + /*------------------------------------------------------------------*/ /* DCD Endpoint port *------------------------------------------------------------------*/ @@ -303,6 +311,7 @@ bool dcd_edpt_open(uint8_t rhport, tusb_desc_endpoint_t const *desc_edpt) xfer_ctl_t *xfer = XFER_CTL_BASE(epnum, dir); xfer->max_size = tu_edpt_packet_size(desc_edpt); + xfer->interval = desc_edpt->bInterval; if (dir == TUSB_DIR_OUT) { out_ep[epnum].doepctl &= ~(USB_D_EPTYPE0_M | USB_D_MPS0_M); @@ -423,6 +432,13 @@ bool dcd_edpt_xfer(uint8_t rhport, uint8_t ep_addr, uint8_t *buffer, uint16_t to USB0.in_ep_reg[epnum].dieptsiz = (num_packets << USB_D_PKTCNT0_S) | total_bytes; USB0.in_ep_reg[epnum].diepctl |= USB_D_EPENA1_M | USB_D_CNAK1_M; // Enable | CNAK + // For ISO endpoint with interval=1 set correct DATA0/DATA1 bit for next frame + if ((USB0.in_ep_reg[epnum].diepctl & USB_D_EPTYPE0_M) == (1 << USB_D_EPTYPE1_S) && xfer->interval == 1) { + // Take odd/even bit from frame counter. + uint32_t const odd_frame_now = (USB0.dsts & (1u << USB_SOFFN_S)); + USB0.in_ep_reg[epnum].diepctl |= (odd_frame_now ? USB_DI_SETD0PID1 : USB_DI_SETD1PID1); + } + // Enable fifo empty interrupt only if there are something to put in the fifo. if(total_bytes != 0) { USB0.dtknqr4_fifoemptymsk |= (1 << epnum); @@ -431,6 +447,13 @@ bool dcd_edpt_xfer(uint8_t rhport, uint8_t ep_addr, uint8_t *buffer, uint16_t to // Each complete packet for OUT xfers triggers XFRC. USB0.out_ep_reg[epnum].doeptsiz |= USB_PKTCNT0_M | ((xfer->max_size & USB_XFERSIZE0_V) << USB_XFERSIZE0_S); USB0.out_ep_reg[epnum].doepctl |= USB_EPENA0_M | USB_CNAK0_M; + + // For ISO endpoint with interval=1 set correct DATA0/DATA1 bit for next frame + if ((USB0.out_ep_reg[epnum].doepctl & USB_D_EPTYPE0_M) == (1 << USB_D_EPTYPE1_S) && xfer->interval == 1) { + // Take odd/even bit from frame counter. + uint32_t const odd_frame_now = (USB0.dsts & (1u << USB_SOFFN_S)); + USB0.out_ep_reg[epnum].doepctl |= (odd_frame_now ? USB_DO_SETD0PID1 : USB_DO_SETD1PID1); + } } return true; } diff --git a/configs/defconfig.common b/configs/defconfig.common index cbcfd8d2c..fb9e2db86 100644 --- a/configs/defconfig.common +++ b/configs/defconfig.common @@ -37,6 +37,7 @@ CONFIG_FATFS_API_ENCODING_UTF_8=y # CONFIG_FMB_CONTROLLER_SLAVE_ID_SUPPORT is not set CONFIG_FMB_TIMER_PORT_ENABLED=y CONFIG_FREERTOS_HZ=1000 +CONFIG_FREERTOS_ENABLE_BACKWARD_COMPATIBILITY=y # CONFIG_FREERTOS_ASSERT_ON_UNTESTED_FUNCTION is not set CONFIG_FREERTOS_IDLE_TASK_STACKSIZE=1024 CONFIG_HEAP_POISONING_LIGHT=y diff --git a/configs/defconfig.esp32 b/configs/defconfig.esp32 index bd38b4829..14a4f2c17 100644 --- a/configs/defconfig.esp32 +++ b/configs/defconfig.esp32 @@ -8,10 +8,10 @@ CONFIG_BT_SPP_ENABLED=y CONFIG_BT_HFP_ENABLE=y CONFIG_BT_STACK_NO_LOG=y CONFIG_BT_BLE_DYNAMIC_ENV_MEMORY=y -CONFIG_ESP32_SPIRAM_SUPPORT=y +CONFIG_SPIRAM=y CONFIG_SPIRAM_OCCUPY_HSPI_HOST=y -CONFIG_ESP32_ULP_COPROC_ENABLED=y -CONFIG_ESP32_XTAL_FREQ_AUTO=y +CONFIG_ULP_COPROC_ENABLED=y +CONFIG_XTAL_FREQ_AUTO=y # CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU1 is not set CONFIG_FREERTOS_FPU_IN_ISR=y # CONFIG_USE_WAKENET is not set diff --git a/configs/defconfig.esp32c3 b/configs/defconfig.esp32c3 index 31c42f7a0..ced594733 100644 --- a/configs/defconfig.esp32c3 +++ b/configs/defconfig.esp32c3 @@ -1,4 +1,4 @@ CONFIG_BT_BLE_BLUFI_ENABLE=y -CONFIG_ESP32C3_RTC_CLK_CAL_CYCLES=576 +CONFIG_RTC_CLK_CAL_CYCLES=576 # CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU0 is not set CONFIG_FREERTOS_IDLE_TASK_STACKSIZE=2304 diff --git a/configs/defconfig.esp32s2 b/configs/defconfig.esp32s2 index 6dc619a9f..f6d2c82f7 100644 --- a/configs/defconfig.esp32s2 +++ b/configs/defconfig.esp32s2 @@ -1,6 +1,6 @@ CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP=y -CONFIG_ESP32S2_DEFAULT_CPU_FREQ_240=y -CONFIG_ESP32S2_SPIRAM_SUPPORT=y +CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240=y +CONFIG_SPIRAM=y CONFIG_ESP32S2_KEEP_USB_ALIVE=y # CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU0 is not set # CONFIG_USE_WAKENET is not set diff --git a/configs/defconfig.esp32s3 b/configs/defconfig.esp32s3 index d56dedcdc..2437efd2e 100644 --- a/configs/defconfig.esp32s3 +++ b/configs/defconfig.esp32s3 @@ -1,7 +1,7 @@ CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP=y -CONFIG_ESP32S3_DEFAULT_CPU_FREQ_240=y -CONFIG_ESP32S3_SPIRAM_SUPPORT=y -CONFIG_ESP32S3_RTC_CLK_CAL_CYCLES=576 +CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240=y +CONFIG_SPIRAM=y +CONFIG_RTC_CLK_CAL_CYCLES=576 CONFIG_ESP32S3_UNIVERSAL_MAC_ADDRESSES_TWO=y # CONFIG_ESP_SLEEP_GPIO_RESET_WORKAROUND is not set # CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU1 is not set diff --git a/main/idf_component.yml b/main/idf_component.yml new file mode 100644 index 000000000..fb266a7af --- /dev/null +++ b/main/idf_component.yml @@ -0,0 +1,47 @@ +dependencies: + # Required IDF version + idf: ">=5.1" + + mdns: "^1.0.7" + # nghttp: "^1.50.0" + # esp_jpeg: "^1.0.4" + # esp-dsp: "^1.2.0" + # esp-sr: "^1.0.3" + # esp32-camera: "^2.0.3" + # esp-dl: + # git: https://github.com/espressif/esp-dl.git + # arduino: + # path: components/arduino + + # # Defining a dependency from the registry: + # # https://components.espressif.com/component/example/cmp + # example/cmp: "^3.3.3" # Automatically update minor releases + # + # # Other ways to define dependencies + # + # # For components maintained by Espressif only name can be used. + # # Same as `espressif/cmp` + # component: "~1.0.0" # Automatically update bugfix releases + # + # # Or in a longer form with extra parameters + # component2: + # version: ">=2.0.0" + # + # # For transient dependencies `public` flag can be set. + # # `public` flag doesn't have an effect for the `main` component. + # # All dependencies of `main` are public by default. + # public: true + # + # # For components hosted on non-default registry: + # service_url: "https://componentregistry.company.com" + # + # # For components in git repository: + # test_component: + # path: test_component + # git: ssh://git@gitlab.com/user/components.git + # + # # For test projects during component development + # # components can be used from a local directory + # # with relative or absolute path + # some_local_component: + # path: ../../projects/component diff --git a/tools/config.sh b/tools/config.sh index 7aac39e5e..4216e0b1f 100755 --- a/tools/config.sh +++ b/tools/config.sh @@ -6,7 +6,7 @@ if [ -z $IDF_PATH ]; then fi if [ -z $IDF_BRANCH ]; then - IDF_BRANCH="release/v4.4" + IDF_BRANCH="master" fi if [ -z $AR_PR_TARGET_BRANCH ]; then @@ -24,9 +24,6 @@ if [ -z $IDF_TARGET ]; then fi fi -IDF_COMPS="$IDF_PATH/components" -IDF_TOOLCHAIN="xtensa-$IDF_TARGET-elf" - # Owner of the target ESP32 Arduino repository AR_USER="espressif" diff --git a/tools/copy-libs.sh b/tools/copy-libs.sh index a6505d084..af8e1b339 100755 --- a/tools/copy-libs.sh +++ b/tools/copy-libs.sh @@ -95,7 +95,7 @@ for item in "${@:2:${#@}-5}"; do elif [ "$prefix" = "-O" ]; then PIO_CC_FLAGS+="$item " elif [[ "$item" != "-Wall" && "$item" != "-Werror=all" && "$item" != "-Wextra" ]]; then - if [[ "${item:0:23}" != "-mfix-esp32-psram-cache" && "${item:0:18}" != "-fmacro-prefix-map" ]]; then + if [[ "${item:0:23}" != "-mfix-esp32-psram-cache" && "${item:0:18}" != "-fmacro-prefix-map" && "${item:0:20}" != "-fdiagnostics-color=" ]]; then C_FLAGS+="$item " fi fi @@ -109,7 +109,7 @@ set -- $str for item in "${@:2:${#@}-5}"; do prefix="${item:0:2}" if [[ "$prefix" != "-I" && "$prefix" != "-D" && "$item" != "-Wall" && "$item" != "-Werror=all" && "$item" != "-Wextra" && "$prefix" != "-O" ]]; then - if [[ "${item:0:23}" != "-mfix-esp32-psram-cache" && "${item:0:18}" != "-fmacro-prefix-map" ]]; then + if [[ "${item:0:23}" != "-mfix-esp32-psram-cache" && "${item:0:18}" != "-fmacro-prefix-map" && "${item:0:20}" != "-fdiagnostics-color=" ]]; then AS_FLAGS+="$item " if [[ $C_FLAGS == *"$item"* ]]; then PIO_CC_FLAGS+="$item " @@ -128,7 +128,7 @@ set -- $str for item in "${@:2:${#@}-5}"; do prefix="${item:0:2}" if [[ "$prefix" != "-I" && "$prefix" != "-D" && "$item" != "-Wall" && "$item" != "-Werror=all" && "$item" != "-Wextra" && "$prefix" != "-O" ]]; then - if [[ "${item:0:23}" != "-mfix-esp32-psram-cache" && "${item:0:18}" != "-fmacro-prefix-map" ]]; then + if [[ "${item:0:23}" != "-mfix-esp32-psram-cache" && "${item:0:18}" != "-fmacro-prefix-map" && "${item:0:20}" != "-fdiagnostics-color=" ]]; then CPP_FLAGS+="$item " if [[ $PIO_CC_FLAGS != *"$item"* ]]; then PIO_CXX_FLAGS+="$item " @@ -155,13 +155,15 @@ else libs="${libs:19:${#libs}-1}" flags=`cat build/build.ninja | grep LINK_FLAGS` flags="${flags:15:${#flags}-1}" + paths=`cat build/build.ninja | grep LINK_PATH` + paths="${paths:14:${#paths}-1}" if [ "$IDF_TARGET" = "esp32" ]; then flags="-Wno-frame-address $flags" fi if [ "$IDF_TARGET" != "esp32c3" ]; then flags="-mlongcalls $flags" fi - str="$flags $libs" + str="$flags $libs $paths" fi if [ "$IDF_TARGET" = "esp32" ]; then LD_SCRIPTS+="-T esp32.rom.redefined.ld " @@ -362,7 +364,7 @@ for item; do if [[ "$fname" == "main" && "$dname" == "esp32-arduino-lib-builder" ]]; then continue fi - while [[ "$dname" != "components" && "$dname" != "build" ]]; do + while [[ "$dname" != "components" && "$dname" != "managed_components" && "$dname" != "build" ]]; do ipath=`dirname "$ipath"` fname=`basename "$ipath"` dname=`basename $(dirname "$ipath")` @@ -482,7 +484,7 @@ rm -rf platform_start.txt platform_mid.txt 1platform_mid.txt cp -f "sdkconfig" "$AR_SDK/sdkconfig" # gen_esp32part.py -cp "$IDF_COMPS/partition_table/gen_esp32part.py" "$AR_GEN_PART_PY" +cp "$IDF_PATH/components/partition_table/gen_esp32part.py" "$AR_GEN_PART_PY" # copy precompiled libs (if we need them) function copy_precompiled_lib(){ diff --git a/tools/copy-to-arduino.sh b/tools/copy-to-arduino.sh index 6880b75d6..ef8b9074c 100755 --- a/tools/copy-to-arduino.sh +++ b/tools/copy-to-arduino.sh @@ -19,6 +19,7 @@ echo "Installing new libraries to $ESP32_ARDUINO" rm -rf $ESP32_ARDUINO/tools/sdk $ESP32_ARDUINO/tools/gen_esp32part.py $ESP32_ARDUINO/tools/platformio-build-*.py $ESP32_ARDUINO/platform.txt cp -f $AR_OUT/platform.txt $ESP32_ARDUINO/ +cp -f $AR_OUT/package_esp32_index.template.json $ESP32_ARDUINO/package/package_esp32_index.template.json cp -Rf $AR_TOOLS/sdk $ESP32_ARDUINO/tools/ cp -f $AR_TOOLS/gen_esp32part.py $ESP32_ARDUINO/tools/ cp -f $AR_TOOLS/platformio-build-*.py $ESP32_ARDUINO/tools/ diff --git a/tools/gen_tools_json.py b/tools/gen_tools_json.py new file mode 100644 index 000000000..98657ee71 --- /dev/null +++ b/tools/gen_tools_json.py @@ -0,0 +1,136 @@ +#!/usr/bin/env python +# python tools/gen_tools_json.py -i $IDF_PATH -j components/arduino/package/package_esp32_index.template.json -o out/ + +from __future__ import print_function + +__author__ = "Hristo Gochkov" +__version__ = "2023" + +import os +import shutil +import errno +import os.path +import json +import platform +import sys +import stat +import argparse + +if sys.version_info[0] == 3: + unicode = lambda s: str(s) + +if __name__ == '__main__': + + parser = argparse.ArgumentParser( + prog = 'gen_tools_json', + description = 'Update Arduino package index with the tolls found in ESP-IDF') + parser.add_argument('-i', '--esp-idf', dest='idf_path', required=True, help='Path to ESP-IDF') + parser.add_argument('-j', '--pkg-json', dest='arduino_json', required=True, help='path to Arduino package json') + parser.add_argument('-o', '--out-path', dest='out_path', required=True, help='Output path to store the update package json') + args = parser.parse_args() + + idf_path = args.idf_path; + arduino_json = args.arduino_json; + out_path = args.out_path; + + # settings + arduino_tools = ["xtensa-esp32-elf","xtensa-esp32s2-elf","xtensa-esp32s3-elf","riscv32-esp-elf","openocd-esp32"] + + # code start + farray = json.load(open(arduino_json)) + + idf_tools = json.load(open(idf_path + '/tools/tools.json')) + for tool in idf_tools['tools']: + try: + tool_index = arduino_tools.index(tool['name']) + except: + continue + tool_name = tool['name'] + tool_version = tool['versions'][0]['name'] + if tool_name.endswith('-elf'): + tool_name += '-gcc' + print('Found {0}, version: {1}'.format(tool_name, tool_version)) + + dep_found = False + dep_skip = False + for dep in farray['packages'][0]['platforms'][0]['toolsDependencies']: + if dep['name'] == tool_name: + if dep['version'] == tool_version: + print('Skipping {0}. Same version {1}'.format(tool_name, tool_version)) + dep_skip = True + break + print('Updating dependency version of {0} from {1} to {2}'.format(tool_name, dep['version'], tool_version)) + dep['version'] = tool_version + dep_found = True + if dep_skip == True: + continue + if dep_found == False: + print('Adding new dependency: {0} version {1}'.format(tool_name, tool_version)) + deps = { + "packager": "esp32", + "name": tool_name, + "version": tool_version + } + farray['packages'][0]['platforms'][0]['toolsDependencies'].append(deps) + + systems = [] + for arch in tool['versions'][0]: + if arch == 'name' or arch == 'status': + continue + tool_data = tool['versions'][0][arch] + + system = { + "host": '', + "url": tool_data['url'], + "archiveFileName": os.path.basename(tool_data['url']), + "checksum": "SHA-256:"+tool_data['sha256'], + "size": tool_data['size'] + } + + if arch == "win32": + system["host"] = "i686-mingw32"; + elif arch == "win64": + system["host"] = "x86_64-mingw32"; + elif arch == "macos-arm64": + system["host"] = "arm64-apple-darwin"; + elif arch == "macos": + system["host"] = "x86_64-apple-darwin"; + elif arch == "linux-amd64": + system["host"] = "x86_64-pc-linux-gnu"; + elif arch == "linux-i686": + system["host"] = "i686-pc-linux-gnu"; + elif arch == "linux-arm64": + system["host"] = "aarch64-linux-gnu"; + elif arch == "linux-armel": + system["host"] = "arm-linux-gnueabihf"; + elif arch == "linux-armhf": + # system["host"] = "arm-linux-gnueabihf"; + continue + else : + continue + + systems.append(system) + + tool_found = False + for t in farray['packages'][0]['tools']: + if t['name'] == tool_name: + t['version'] = tool_version + t['systems'] = systems + tool_found = True + print('Updating binaries of {0} to version {1}'.format(tool_name, tool_version)) + if tool_found == False: + print('Adding new tool: {0} version {1}'.format(tool_name, tool_version)) + tools = { + "name": tool_name, + "version": tool_version, + "systems": systems + } + farray['packages'][0]['tools'].append(tools) + + json_str = json.dumps(farray, indent=2) + out_file = out_path + os.path.basename(arduino_json) + with open(out_file, "w") as f: + f.write(json_str+"\n") + f.close() + # print(json_str) + print('{0} generated'.format(out_file)) diff --git a/tools/update-components.sh b/tools/update-components.sh index 7bc0dce58..56a2b685e 100755 --- a/tools/update-components.sh +++ b/tools/update-components.sh @@ -63,10 +63,6 @@ else git -C "$AR_COMPS/esp32-camera" fetch && \ git -C "$AR_COMPS/esp32-camera" pull --ff-only fi -#this is a temp measure to fix build issue -# if [ -f "$AR_COMPS/esp32-camera/idf_component.yml" ]; then -# rm -rf "$AR_COMPS/esp32-camera/idf_component.yml" -# fi if [ $? -ne 0 ]; then exit 1; fi # @@ -98,16 +94,14 @@ fi if [ $? -ne 0 ]; then exit 1; fi # -# CLONE/UPDATE ESP-LITTLEFS +# CLONE/UPDATE ESP-DSP # -echo "Updating ESP-LITTLEFS..." -if [ ! -d "$AR_COMPS/esp_littlefs" ]; then - git clone $LITTLEFS_REPO_URL "$AR_COMPS/esp_littlefs" && \ - git -C "$AR_COMPS/esp_littlefs" submodule update --init --recursive +echo "Updating ESP-DSP..." +if [ ! -d "$AR_COMPS/esp-dsp" ]; then + git clone $DSP_REPO_URL "$AR_COMPS/esp-dsp" else - git -C "$AR_COMPS/esp_littlefs" fetch && \ - git -C "$AR_COMPS/esp_littlefs" pull --ff-only && \ - git -C "$AR_COMPS/esp_littlefs" submodule update --init --recursive + git -C "$AR_COMPS/esp-dsp" fetch && \ + git -C "$AR_COMPS/esp-dsp" pull --ff-only fi if [ $? -ne 0 ]; then exit 1; fi @@ -140,14 +134,16 @@ fi if [ $? -ne 0 ]; then exit 1; fi # -# CLONE/UPDATE ESP-DSP +# CLONE/UPDATE ESP-LITTLEFS # -echo "Updating ESP-DSP..." -if [ ! -d "$AR_COMPS/esp-dsp" ]; then - git clone $DSP_REPO_URL "$AR_COMPS/esp-dsp" +echo "Updating ESP-LITTLEFS..." +if [ ! -d "$AR_COMPS/esp_littlefs" ]; then + git clone $LITTLEFS_REPO_URL "$AR_COMPS/esp_littlefs" && \ + git -C "$AR_COMPS/esp_littlefs" submodule update --init --recursive else - git -C "$AR_COMPS/esp-dsp" fetch && \ - git -C "$AR_COMPS/esp-dsp" pull --ff-only + git -C "$AR_COMPS/esp_littlefs" fetch && \ + git -C "$AR_COMPS/esp_littlefs" pull --ff-only && \ + git -C "$AR_COMPS/esp_littlefs" submodule update --init --recursive fi if [ $? -ne 0 ]; then exit 1; fi