Skip to content

Commit

Permalink
Merge pull request #2668 from hathach/add-c6-board
Browse files Browse the repository at this point in the history
Add esp c6 devkit board
  • Loading branch information
hathach committed Jun 6, 2024
2 parents d10b65a + 8df372a commit ba2f229
Show file tree
Hide file tree
Showing 12 changed files with 95 additions and 74 deletions.
8 changes: 7 additions & 1 deletion .github/actions/setup_toolchain/download/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 7 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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 }}
Expand Down Expand Up @@ -112,6 +114,7 @@ jobs:
# Build Espressif
# ---------------------------------------
espressif:
# if: false
uses: ./.github/workflows/build_util.yml
strategy:
fail-fast: false
Expand All @@ -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]
Expand Down
66 changes: 0 additions & 66 deletions .github/workflows/build_renesas.yml

This file was deleted.

4 changes: 3 additions & 1 deletion .github/workflows/ci_set_matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"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]
Expand All @@ -27,6 +28,7 @@
"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"],
Expand Down
2 changes: 1 addition & 1 deletion .idea/cmake.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions hw/bsp/ch32v20x/boards/ch32v203_r0_1v0/board.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion hw/bsp/ch32v20x/family.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
4 changes: 4 additions & 0 deletions hw/bsp/ch32v20x/family.cmake
Original file line number Diff line number Diff line change
@@ -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)
Expand Down Expand Up @@ -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()
2 changes: 2 additions & 0 deletions hw/bsp/espressif/boards/espressif_c6_devkitc/board.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Apply board specific content here
set(IDF_TARGET "esp32c6")
51 changes: 51 additions & 0 deletions hw/bsp/espressif/boards/espressif_c6_devkitc/board.h
Original file line number Diff line number Diff line change
@@ -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_ */
16 changes: 16 additions & 0 deletions hw/bsp/family_support.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down Expand Up @@ -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_FILE_DIR:${TARGET}>/${TARGET}.hex)
add_custom_command(TARGET ${TARGET} POST_BUILD
COMMAND python ${UF2CONV_PY} -f ${FAMILY_ID} -c -o $<TARGET_FILE_DIR:${TARGET}>/${TARGET}.uf2 ${BIN_FILE}
VERBATIM)
endfunction()

#----------------------------------
# Example Target Configure (Default rule)
Expand Down Expand Up @@ -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_FILE_DIR:${TARGET}>/${TARGET}.uf2
)
endfunction()

# Add flash teensy_cli target
function(family_flash_teensy TARGET)
Expand Down
2 changes: 1 addition & 1 deletion tools/get_deps.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
'159e31b689577dbf69cf0683bbaffbd71fa5ee10',
'all'],
'tools/uf2': ['https://github.com/microsoft/uf2.git',
'19615407727073e36d81bf239c52108ba92e7660',
'c594542b2faa01cc33a2b97c9fbebc38549df80a',
'all'],
}

Expand Down

0 comments on commit ba2f229

Please sign in to comment.