diff --git a/.github/actions/setup_toolchain/download/action.yml b/.github/actions/setup_toolchain/download/action.yml index 2af456ef8..813197208 100644 --- a/.github/actions/setup_toolchain/download/action.yml +++ b/.github/actions/setup_toolchain/download/action.yml @@ -24,7 +24,13 @@ runs: run: | mkdir -p ~/cache/${{ inputs.toolchain }} wget --progress=dot:giga ${{ inputs.toolchain_url }} -O toolchain.tar.gz - tar -C ~/cache/${{ inputs.toolchain }} -xaf toolchain.tar.gz + if [[ ${{ inputs.toolchain }} == rx-gcc ]]; then + mv toolchain.tar.gz toolchain.run + chmod +x toolchain.run + ./toolchain.run -p ~/cache/${{ inputs.toolchain }}/gnurx -y + else + tar -C ~/cache/${{ inputs.toolchain }} -xaf toolchain.tar.gz + fi shell: bash - name: Set Toolchain Path diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 78d95fbbc..712c7dd43 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -51,14 +51,15 @@ jobs: # Build CMake # --------------------------------------- cmake: + # if: false needs: set-matrix uses: ./.github/workflows/build_util.yml strategy: fail-fast: false matrix: toolchain: + # - 'arm-clang' is built by circle-ci - 'aarch64-gcc' - # - 'arm-clang' # clang is built by circle-ci - 'arm-gcc' - 'msp430-gcc' - 'riscv-gcc' @@ -73,18 +74,19 @@ jobs: # Build Make # --------------------------------------- make: - #if: github.event_name == 'pull_request' + # if: false needs: set-matrix uses: ./.github/workflows/build_util.yml strategy: fail-fast: false matrix: toolchain: + # 'arm-clang' is built by circle-ci - 'aarch64-gcc' - # - 'arm-clang' # clang is built by circle-ci - 'arm-gcc' - 'msp430-gcc' - 'riscv-gcc' + - 'rx-gcc' with: build-system: 'make' toolchain: ${{ matrix.toolchain }} @@ -112,6 +114,7 @@ jobs: # Build Espressif # --------------------------------------- espressif: + # if: false uses: ./.github/workflows/build_util.yml strategy: fail-fast: false @@ -131,6 +134,7 @@ jobs: # Build IAR on HFP self-hosted # --------------------------------------- arm-iar: + # if: false if: github.repository_owner == 'hathach' needs: set-matrix runs-on: [self-hosted, Linux, X64, hifiphile] diff --git a/.github/workflows/build_renesas.yml b/.github/workflows/build_renesas.yml deleted file mode 100644 index 3d2cbab28..000000000 --- a/.github/workflows/build_renesas.yml +++ /dev/null @@ -1,66 +0,0 @@ -name: Build Renesas - -on: - workflow_dispatch: - push: - paths: - - 'src/**' - - 'examples/**' - - 'lib/**' - - 'hw/**' - - 'tools/get_deps.py' - - '.github/workflows/build_renesas.yml' - pull_request: - branches: [ master ] - paths: - - 'src/**' - - 'examples/**' - - 'lib/**' - - 'hw/**' - - 'tools/get_deps.py' - - '.github/workflows/build_renesas.yml' - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -jobs: - build-rx: - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - family: - # Alphabetical order - - 'rx' - steps: - - name: Checkout TinyUSB - uses: actions/checkout@v4 - - - name: Set Toolchain URL - run: echo >> $GITHUB_ENV TOOLCHAIN_URL=http://gcc-renesas.com/downloads/get.php?f=rx/8.3.0.202004-gnurx/gcc-8.3.0.202004-GNURX-ELF.run - - - name: Cache Toolchain - uses: actions/cache@v4 - id: cache-toolchain - with: - path: ~/cache/ - key: ${{ runner.os }}-21-03-30-${{ env.TOOLCHAIN_URL }} - - - name: Install Toolchain - if: steps.cache-toolchain.outputs.cache-hit != 'true' - run: | - mkdir -p ~/cache/toolchain/gnurx - wget --progress=dot:mega $TOOLCHAIN_URL -O toolchain.run - chmod +x toolchain.run - ./toolchain.run -p ~/cache/toolchain/gnurx -y - - - name: Set Toolchain Path - run: echo >> $GITHUB_PATH `echo ~/cache/toolchain/*/bin` - - - name: Get Dependencies - run: | - python3 tools/get_deps.py ${{ matrix.family }} - - - name: Build - run: python3 tools/build.py -s make ${{ matrix.family }} diff --git a/.github/workflows/ci_set_matrix.py b/.github/workflows/ci_set_matrix.py index c6f4e8fe2..7dc9a2fa1 100644 --- a/.github/workflows/ci_set_matrix.py +++ b/.github/workflows/ci_set_matrix.py @@ -7,7 +7,8 @@ toolchain_list = { "arm-iar": "", "arm-gcc": "", "msp430-gcc": "http://software-dl.ti.com/msp430/msp430_public_sw/mcu/msp430/MSPGCC/9_2_0_0/export/msp430-gcc-9.2.0.50_linux64.tar.bz2", - "riscv-gcc": "https://github.com/xpack-dev-tools/riscv-none-elf-gcc-xpack/releases/download/v13.2.0-2/xpack-riscv-none-elf-gcc-13.2.0-2-linux-x64.tar.gz" + "riscv-gcc": "https://github.com/xpack-dev-tools/riscv-none-elf-gcc-xpack/releases/download/v13.2.0-2/xpack-riscv-none-elf-gcc-13.2.0-2-linux-x64.tar.gz", + "rx-gcc": "http://gcc-renesas.com/downloads/get.php?f=rx/8.3.0.202004-gnurx/gcc-8.3.0.202004-GNURX-ELF.run", } # family: [supported toolchain] @@ -27,6 +28,7 @@ family_list = { "nrf": ["arm-gcc", "arm-clang"], "ra": ["arm-gcc"], "rp2040": ["arm-gcc"], + "rx": ["rx-gcc"], "samd11 samd21 saml2x": ["arm-gcc", "arm-clang"], "samd5x_e5x samg": ["arm-gcc", "arm-clang"], "stm32f0 stm32f1 stm32f2 stm32f3": ["arm-gcc", "arm-clang", "arm-iar"], diff --git a/.idea/cmake.xml b/.idea/cmake.xml index 24d4eafe9..5568609dd 100644 --- a/.idea/cmake.xml +++ b/.idea/cmake.xml @@ -131,7 +131,7 @@ - + diff --git a/hw/bsp/ch32v20x/boards/ch32v203_r0_1v0/board.cmake b/hw/bsp/ch32v20x/boards/ch32v203_r0_1v0/board.cmake index 8d3e0326e..31b6b716e 100644 --- a/hw/bsp/ch32v20x/boards/ch32v203_r0_1v0/board.cmake +++ b/hw/bsp/ch32v20x/boards/ch32v203_r0_1v0/board.cmake @@ -3,6 +3,8 @@ set(MCU_VARIANT D6) set(LD_FLASH_SIZE 64K) set(LD_RAM_SIZE 20K) +# set(LD_FILE_GNU ${CMAKE_CURRENT_LIST_DIR}/../../linker/${CH32_FAMILY}_tinyuf2.ld) + function(update_board TARGET) target_compile_definitions(${TARGET} PUBLIC CFG_EXAMPLE_MSC_DUAL_READONLY diff --git a/hw/bsp/ch32v20x/family.c b/hw/bsp/ch32v20x/family.c index be654e543..c32cfd46e 100644 --- a/hw/bsp/ch32v20x/family.c +++ b/hw/bsp/ch32v20x/family.c @@ -127,7 +127,7 @@ void board_init(void) { } void board_led_write(bool state) { - GPIO_WriteBit(LED_PORT, LED_PIN, state); + GPIO_WriteBit(LED_PORT, LED_PIN, state ? LED_STATE_ON : (1-LED_STATE_ON)); } uint32_t board_button_read(void) { diff --git a/hw/bsp/ch32v20x/family.cmake b/hw/bsp/ch32v20x/family.cmake index 3fb1c0e79..1d574fdf8 100644 --- a/hw/bsp/ch32v20x/family.cmake +++ b/hw/bsp/ch32v20x/family.cmake @@ -1,5 +1,6 @@ include_guard() +set(UF2_FAMILY_ID 0x699b62ec) set(CH32_FAMILY ch32v20x) set(SDK_DIR ${TOP}/hw/mcu/wch/${CH32_FAMILY}) set(SDK_SRC_DIR ${SDK_DIR}/EVT/EXAM/SRC) @@ -128,4 +129,7 @@ function(family_configure_example TARGET RTOS) # Flashing family_add_bin_hex(${TARGET}) family_flash_openocd_wch(${TARGET}) + + #family_add_uf2(${TARGET} ${UF2_FAMILY_ID}) + #family_flash_uf2(${TARGET} ${UF2_FAMILY_ID}) endfunction() diff --git a/hw/bsp/espressif/boards/espressif_c6_devkitc/board.cmake b/hw/bsp/espressif/boards/espressif_c6_devkitc/board.cmake new file mode 100644 index 000000000..50c7cb35d --- /dev/null +++ b/hw/bsp/espressif/boards/espressif_c6_devkitc/board.cmake @@ -0,0 +1,2 @@ +# Apply board specific content here +set(IDF_TARGET "esp32c6") diff --git a/hw/bsp/espressif/boards/espressif_c6_devkitc/board.h b/hw/bsp/espressif/boards/espressif_c6_devkitc/board.h new file mode 100644 index 000000000..243dd47f6 --- /dev/null +++ b/hw/bsp/espressif/boards/espressif_c6_devkitc/board.h @@ -0,0 +1,51 @@ +/* + * The MIT License (MIT) + * + * Copyright (c) 2020, Ha Thach (tinyusb.org) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * This file is part of the TinyUSB stack. + */ + +#ifndef BOARD_H_ +#define BOARD_H_ + +#ifdef __cplusplus + extern "C" { +#endif + +#define NEOPIXEL_PIN 8 + +#define BUTTON_PIN 9 +#define BUTTON_STATE_ACTIVE 0 + +// SPI for USB host shield +#define MAX3421_SPI_HOST SPI2_HOST +#define MAX3421_SCK_PIN 4 +#define MAX3421_MOSI_PIN 6 +#define MAX3421_MISO_PIN 5 +#define MAX3421_CS_PIN 10 +#define MAX3421_INTR_PIN 7 + +#ifdef __cplusplus + } +#endif + +#endif /* BOARD_H_ */ diff --git a/hw/bsp/family_support.cmake b/hw/bsp/family_support.cmake index 6eef5b88b..d9443f811 100644 --- a/hw/bsp/family_support.cmake +++ b/hw/bsp/family_support.cmake @@ -6,6 +6,8 @@ include(CMakePrintHelpers) set(TOP "${CMAKE_CURRENT_LIST_DIR}/../..") get_filename_component(TOP ${TOP} ABSOLUTE) +set(UF2CONV_PY ${TOP}/tools/uf2/utils/uf2conv.py) + #------------------------------------------------------------- # Toolchain # Can be changed via -DTOOLCHAIN=gcc|iar or -DCMAKE_C_COMPILER= @@ -296,6 +298,13 @@ function(family_add_bin_hex TARGET) VERBATIM) endfunction() +# Add uf2 output +function(family_add_uf2 TARGET FAMILY_ID) + set(BIN_FILE $/${TARGET}.hex) + add_custom_command(TARGET ${TARGET} POST_BUILD + COMMAND python ${UF2CONV_PY} -f ${FAMILY_ID} -c -o $/${TARGET}.uf2 ${BIN_FILE} + VERBATIM) +endfunction() #---------------------------------- # Example Target Configure (Default rule) @@ -461,6 +470,13 @@ function(family_flash_pyocd TARGET) ) endfunction() +# Flash with UF2 +function(family_flash_uf2 TARGET FAMILY_ID) + add_custom_target(${TARGET}-uf2 + DEPENDS ${TARGET} + COMMAND python ${UF2CONV_PY} -f ${FAMILY_ID} --deploy $/${TARGET}.uf2 + ) +endfunction() # Add flash teensy_cli target function(family_flash_teensy TARGET) diff --git a/tools/get_deps.py b/tools/get_deps.py index cf15126b3..50cc5c893 100644 --- a/tools/get_deps.py +++ b/tools/get_deps.py @@ -14,7 +14,7 @@ deps_mandatory = { '159e31b689577dbf69cf0683bbaffbd71fa5ee10', 'all'], 'tools/uf2': ['https://github.com/microsoft/uf2.git', - '19615407727073e36d81bf239c52108ba92e7660', + 'c594542b2faa01cc33a2b97c9fbebc38549df80a', 'all'], }