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'], }