diff options
| author | Jie Feng <[email protected]> | 2025-07-24 22:30:10 +0800 |
|---|---|---|
| committer | Jie Feng <[email protected]> | 2025-07-24 22:36:59 +0800 |
| commit | aacd73ba42dfe58706fe83f8521ebe0ff957a79c (patch) | |
| tree | b4e09f78a8e0eec2a5ea4ca1a4cc97613923cc93 /hw | |
| parent | e1509ba0bb5d4aa64c6ec471ea408c2ab43a027a (diff) | |
Add nanoch32v305
Diffstat (limited to 'hw')
| -rw-r--r-- | hw/bsp/ch32v30x/boards/ch32v307v_r1_1v0/board.cmake (renamed from hw/bsp/ch32v307/boards/ch32v307v_r1_1v0/board.cmake) | 0 | ||||
| -rw-r--r-- | hw/bsp/ch32v30x/boards/ch32v307v_r1_1v0/board.h (renamed from hw/bsp/ch32v307/boards/ch32v307v_r1_1v0/board.h) | 0 | ||||
| -rw-r--r-- | hw/bsp/ch32v30x/boards/ch32v307v_r1_1v0/board.mk (renamed from hw/bsp/ch32v307/boards/ch32v307v_r1_1v0/board.mk) | 0 | ||||
| -rw-r--r-- | hw/bsp/ch32v30x/boards/nanoch32v305/board.cmake | 4 | ||||
| -rw-r--r-- | hw/bsp/ch32v30x/boards/nanoch32v305/board.h | 48 | ||||
| -rw-r--r-- | hw/bsp/ch32v30x/boards/nanoch32v305/board.mk | 1 | ||||
| -rw-r--r-- | hw/bsp/ch32v30x/ch32v307.ld (renamed from hw/bsp/ch32v307/ch32v307.ld) | 0 | ||||
| -rw-r--r-- | hw/bsp/ch32v30x/ch32v30x_conf.h (renamed from hw/bsp/ch32v307/ch32v30x_conf.h) | 0 | ||||
| -rw-r--r-- | hw/bsp/ch32v30x/ch32v30x_it.c (renamed from hw/bsp/ch32v307/ch32v30x_it.c) | 0 | ||||
| -rw-r--r-- | hw/bsp/ch32v30x/ch32v30x_it.h (renamed from hw/bsp/ch32v307/ch32v30x_it.h) | 0 | ||||
| -rw-r--r-- | hw/bsp/ch32v30x/debug_uart.c (renamed from hw/bsp/ch32v307/debug_uart.c) | 0 | ||||
| -rw-r--r-- | hw/bsp/ch32v30x/debug_uart.h (renamed from hw/bsp/ch32v307/debug_uart.h) | 0 | ||||
| -rw-r--r-- | hw/bsp/ch32v30x/family.c (renamed from hw/bsp/ch32v307/family.c) | 7 | ||||
| -rw-r--r-- | hw/bsp/ch32v30x/family.cmake (renamed from hw/bsp/ch32v307/family.cmake) | 0 | ||||
| -rw-r--r-- | hw/bsp/ch32v30x/family.mk (renamed from hw/bsp/ch32v307/family.mk) | 0 | ||||
| -rw-r--r-- | hw/bsp/ch32v30x/system_ch32v30x.c (renamed from hw/bsp/ch32v307/system_ch32v30x.c) | 0 | ||||
| -rw-r--r-- | hw/bsp/ch32v30x/system_ch32v30x.h (renamed from hw/bsp/ch32v307/system_ch32v30x.h) | 0 | ||||
| -rw-r--r-- | hw/bsp/ch32v30x/wch-riscv.cfg (renamed from hw/bsp/ch32v307/wch-riscv.cfg) | 0 |
18 files changed, 59 insertions, 1 deletions
diff --git a/hw/bsp/ch32v307/boards/ch32v307v_r1_1v0/board.cmake b/hw/bsp/ch32v30x/boards/ch32v307v_r1_1v0/board.cmake index 9f5682042..9f5682042 100644 --- a/hw/bsp/ch32v307/boards/ch32v307v_r1_1v0/board.cmake +++ b/hw/bsp/ch32v30x/boards/ch32v307v_r1_1v0/board.cmake diff --git a/hw/bsp/ch32v307/boards/ch32v307v_r1_1v0/board.h b/hw/bsp/ch32v30x/boards/ch32v307v_r1_1v0/board.h index 491347034..491347034 100644 --- a/hw/bsp/ch32v307/boards/ch32v307v_r1_1v0/board.h +++ b/hw/bsp/ch32v30x/boards/ch32v307v_r1_1v0/board.h diff --git a/hw/bsp/ch32v307/boards/ch32v307v_r1_1v0/board.mk b/hw/bsp/ch32v30x/boards/ch32v307v_r1_1v0/board.mk index 4e91d8938..4e91d8938 100644 --- a/hw/bsp/ch32v307/boards/ch32v307v_r1_1v0/board.mk +++ b/hw/bsp/ch32v30x/boards/ch32v307v_r1_1v0/board.mk diff --git a/hw/bsp/ch32v30x/boards/nanoch32v305/board.cmake b/hw/bsp/ch32v30x/boards/nanoch32v305/board.cmake new file mode 100644 index 000000000..9f5682042 --- /dev/null +++ b/hw/bsp/ch32v30x/boards/nanoch32v305/board.cmake @@ -0,0 +1,4 @@ +function(update_board TARGET) +# target_compile_definitions(${TARGET} PUBLIC +# ) +endfunction() diff --git a/hw/bsp/ch32v30x/boards/nanoch32v305/board.h b/hw/bsp/ch32v30x/boards/nanoch32v305/board.h new file mode 100644 index 000000000..62bbef94c --- /dev/null +++ b/hw/bsp/ch32v30x/boards/nanoch32v305/board.h @@ -0,0 +1,48 @@ +/* + * The MIT License (MIT) + * + * Copyright (c) 2023 Ha Thach (tinyusb.org) for Adafruit Industries + * + * 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. + */ + +/* metadata: + name: nanoCH32V305 + url: https://github.com/wuxx/nanoCH32V305 +*/ + +#ifndef BOARD_H_ +#define BOARD_H_ + +#ifdef __cplusplus + extern "C" { +#endif + +#define LED_PORT GPIOA +#define LED_PIN GPIO_Pin_3 +#define LED_STATE_ON 0 +#define LED_CLOCK_EN() RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOC, ENABLE) + +// TODO UART port + +#ifdef __cplusplus + } +#endif + +#endif diff --git a/hw/bsp/ch32v30x/boards/nanoch32v305/board.mk b/hw/bsp/ch32v30x/boards/nanoch32v305/board.mk new file mode 100644 index 000000000..4e91d8938 --- /dev/null +++ b/hw/bsp/ch32v30x/boards/nanoch32v305/board.mk @@ -0,0 +1 @@ +LD_FILE = $(FAMILY_PATH)/ch32v307.ld diff --git a/hw/bsp/ch32v307/ch32v307.ld b/hw/bsp/ch32v30x/ch32v307.ld index 55bd10cd0..55bd10cd0 100644 --- a/hw/bsp/ch32v307/ch32v307.ld +++ b/hw/bsp/ch32v30x/ch32v307.ld diff --git a/hw/bsp/ch32v307/ch32v30x_conf.h b/hw/bsp/ch32v30x/ch32v30x_conf.h index 0b86ad390..0b86ad390 100644 --- a/hw/bsp/ch32v307/ch32v30x_conf.h +++ b/hw/bsp/ch32v30x/ch32v30x_conf.h diff --git a/hw/bsp/ch32v307/ch32v30x_it.c b/hw/bsp/ch32v30x/ch32v30x_it.c index c329c5613..c329c5613 100644 --- a/hw/bsp/ch32v307/ch32v30x_it.c +++ b/hw/bsp/ch32v30x/ch32v30x_it.c diff --git a/hw/bsp/ch32v307/ch32v30x_it.h b/hw/bsp/ch32v30x/ch32v30x_it.h index f3977a8be..f3977a8be 100644 --- a/hw/bsp/ch32v307/ch32v30x_it.h +++ b/hw/bsp/ch32v30x/ch32v30x_it.h diff --git a/hw/bsp/ch32v307/debug_uart.c b/hw/bsp/ch32v30x/debug_uart.c index 2fd3a9d64..2fd3a9d64 100644 --- a/hw/bsp/ch32v307/debug_uart.c +++ b/hw/bsp/ch32v30x/debug_uart.c diff --git a/hw/bsp/ch32v307/debug_uart.h b/hw/bsp/ch32v30x/debug_uart.h index a7e070585..a7e070585 100644 --- a/hw/bsp/ch32v307/debug_uart.h +++ b/hw/bsp/ch32v30x/debug_uart.h diff --git a/hw/bsp/ch32v307/family.c b/hw/bsp/ch32v30x/family.c index 48eb8a38c..bd01f4f46 100644 --- a/hw/bsp/ch32v307/family.c +++ b/hw/bsp/ch32v30x/family.c @@ -122,12 +122,13 @@ void board_init(void) { GPIO_Init(LED_PORT, &GPIO_InitStructure); // Button +#ifdef BUTTON_PORT BUTTON_CLOCK_EN(); GPIO_InitStructure.GPIO_Pin = BUTTON_PIN; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPU; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_Init(BUTTON_PORT, &GPIO_InitStructure); - +#endif /* Enable interrupts globally */ __enable_irq(); @@ -157,7 +158,11 @@ void board_led_write(bool state) { } uint32_t board_button_read(void) { +#ifdef BUTTON_PORT return BUTTON_STATE_ACTIVE == GPIO_ReadInputDataBit(BUTTON_PORT, BUTTON_PIN); +#else + return false; +#endif } int board_uart_read(uint8_t* buf, int len) { diff --git a/hw/bsp/ch32v307/family.cmake b/hw/bsp/ch32v30x/family.cmake index 446e850c5..446e850c5 100644 --- a/hw/bsp/ch32v307/family.cmake +++ b/hw/bsp/ch32v30x/family.cmake diff --git a/hw/bsp/ch32v307/family.mk b/hw/bsp/ch32v30x/family.mk index bf2732106..bf2732106 100644 --- a/hw/bsp/ch32v307/family.mk +++ b/hw/bsp/ch32v30x/family.mk diff --git a/hw/bsp/ch32v307/system_ch32v30x.c b/hw/bsp/ch32v30x/system_ch32v30x.c index 23f783df4..23f783df4 100644 --- a/hw/bsp/ch32v307/system_ch32v30x.c +++ b/hw/bsp/ch32v30x/system_ch32v30x.c diff --git a/hw/bsp/ch32v307/system_ch32v30x.h b/hw/bsp/ch32v30x/system_ch32v30x.h index ad81058c7..ad81058c7 100644 --- a/hw/bsp/ch32v307/system_ch32v30x.h +++ b/hw/bsp/ch32v30x/system_ch32v30x.h diff --git a/hw/bsp/ch32v307/wch-riscv.cfg b/hw/bsp/ch32v30x/wch-riscv.cfg index aa35aa9c5..aa35aa9c5 100644 --- a/hw/bsp/ch32v307/wch-riscv.cfg +++ b/hw/bsp/ch32v30x/wch-riscv.cfg |
