Skip to content

Commit 39045c2

Browse files
committed
Fix CH592F release toolchain and knob mapping
1 parent d2e256b commit 39045c2

5 files changed

Lines changed: 24 additions & 17 deletions

File tree

firmware/CH592F/CMakeLists.txt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -208,9 +208,8 @@ if(CMAKE_BUILD_TYPE STREQUAL "Debug")
208208
)
209209
else()
210210
list(APPEND CH592_COMPILE_DEFINITIONS
211-
DEBUG=Debug_UART1
212-
UART_LOG_ENABLE=1
213-
KBD_DEBUG_BUILD=1
211+
UART_LOG_ENABLE=0
212+
KBD_DEBUG_BUILD=0
214213
KBD_USB_LOG_ENABLE=0
215214
)
216215
endif()

firmware/CH592F/cmake/toolchain-ch59x.cmake

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ set(CMAKE_SYSTEM_PROCESSOR riscv)
77
#
88
# This file auto-detects the MounRiver Studio (MRS) RISC-V GCC toolchain.
99
# Supported compiler prefixes:
10-
# riscv-none-embed- | riscv-wch-elf- | riscv-none-elf-
10+
# riscv32-wch-elf- | riscv-wch-elf- | riscv-none-embed- | riscv-none-elf-
1111
#
1212
# Detection order:
1313
# 1. MRS_TOOLCHAIN_ROOT — cmake -D / env var / console cache
@@ -51,7 +51,7 @@ endif()
5151

5252
# --- MRS_TOOLCHAIN_ROOT → TOOLCHAIN_DIR ------------------------------------
5353
if(NOT DEFINED TOOLCHAIN_DIR AND DEFINED MRS_TOOLCHAIN_ROOT)
54-
foreach(_sub IN ITEMS "RISC-V Embedded GCC/bin" "RISC-V Embedded GCC12/bin")
54+
foreach(_sub IN ITEMS "RISC-V Embedded GCC15/bin" "RISC-V Embedded GCC12/bin" "RISC-V Embedded GCC/bin")
5555
if(EXISTS "${MRS_TOOLCHAIN_ROOT}/${_sub}")
5656
set(TOOLCHAIN_DIR "${MRS_TOOLCHAIN_ROOT}/${_sub}"
5757
CACHE PATH "RISC-V toolchain bin directory" FORCE)
@@ -93,7 +93,7 @@ foreach(_pass IN ITEMS "hint" "path")
9393
set(_find_args "")
9494
endif()
9595

96-
foreach(_prefix IN ITEMS "riscv-none-embed-" "riscv-wch-elf-" "riscv-none-elf-")
96+
foreach(_prefix IN ITEMS "riscv32-wch-elf-" "riscv-wch-elf-" "riscv-none-embed-" "riscv-none-elf-")
9797
find_program(_probe_gcc "${_prefix}gcc" ${_find_args})
9898
if(_probe_gcc)
9999
get_filename_component(_bin_dir "${_probe_gcc}" DIRECTORY)
@@ -114,7 +114,7 @@ if(NOT DEFINED TOOLCHAIN_PREFIX)
114114
" CH592F RISC-V cross-compiler not found.\n"
115115
" 未找到 CH592F RISC-V 交叉编译器。\n"
116116
"\n"
117-
" Searched: riscv-none-embed-gcc / riscv-wch-elf-gcc / riscv-none-elf-gcc\n"
117+
" Searched: riscv32-wch-elf-gcc / riscv-wch-elf-gcc / riscv-none-embed-gcc / riscv-none-elf-gcc\n"
118118
"\n"
119119
" Fix (choose one):\n"
120120
"\n"

tools/scripts/targets/ch592/build.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ def _size_row_from_artifact(build_dir: Path) -> Optional[tuple[int, int, int]]:
9797
try:
9898
res = subprocess.run(
9999
[cross_size, "--format=berkeley", str(elf_file)],
100-
capture_output=True, text=True, check=True
100+
capture_output=True, text=True, check=True, timeout=3
101101
)
102102
except Exception:
103103
return None
@@ -127,7 +127,7 @@ def _artifact_region_usage_from_objdump(build_dir: Path) -> Optional[dict[str, i
127127
try:
128128
res = subprocess.run(
129129
[cross_objdump, "-h", str(elf_file)],
130-
capture_output=True, text=True, check=True
130+
capture_output=True, text=True, check=True, timeout=3
131131
)
132132
except Exception:
133133
return None
@@ -303,6 +303,10 @@ def _generator_configure_args() -> list[str]:
303303
return args
304304

305305

306+
def _ninja_build_files_ready(build_dir: Path) -> bool:
307+
return (build_dir / "CMakeCache.txt").is_file() and (build_dir / "build.ninja").is_file()
308+
309+
306310
def cmake_configure_args(cmake: Path, keyboard: str, profile: str, build_dir: Path) -> list[str]:
307311
build_type = {"release": "MinSizeRel", "debug": "Debug"}[profile]
308312
return [
@@ -423,7 +427,7 @@ def build(keyboard: str, profile: str) -> Path:
423427
cached_keyboard = _parse_cmake_cache_var(cache_file, "KEYBOARD")
424428
cached_model = _parse_cmake_cache_var(cache_file, "KBD_MODEL")
425429
if (
426-
not cache_file.is_file()
430+
not _ninja_build_files_ready(build_dir)
427431
or (cached_keyboard and _normalize_keyboard(cached_keyboard) != keyboard)
428432
or (cached_model and _normalize_keyboard(cached_model) != keyboard)
429433
):
@@ -573,7 +577,7 @@ def bootloader_build() -> Path:
573577

574578
build_dir = IAP_BUILD_DIR
575579
cache_file = build_dir / "CMakeCache.txt"
576-
if not cache_file.is_file():
580+
if not _ninja_build_files_ready(build_dir):
577581
bootloader_configure()
578582

579583
sep()
@@ -632,7 +636,7 @@ def jumpiap_build() -> Path:
632636

633637
build_dir = JUMPIAP_BUILD_DIR
634638
cache_file = build_dir / "CMakeCache.txt"
635-
if not cache_file.is_file():
639+
if not _ninja_build_files_ready(build_dir):
636640
jumpiap_configure()
637641

638642
sep()

tools/scripts/targets/ch592/profile.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,12 @@
1414

1515

1616
FIRMWARE_DIR = PROJECT_ROOT / "firmware" / "CH592F"
17-
_MRS_TOOLCHAIN_BIN_DIRS = ("RISC-V Embedded GCC/bin", "RISC-V Embedded GCC12/bin")
18-
_RISCV_GCC_PREFIXES = ("riscv-none-embed-", "riscv-wch-elf-", "riscv-none-elf-")
17+
_MRS_TOOLCHAIN_BIN_DIRS = (
18+
"RISC-V Embedded GCC15/bin",
19+
"RISC-V Embedded GCC12/bin",
20+
"RISC-V Embedded GCC/bin",
21+
)
22+
_RISCV_GCC_PREFIXES = ("riscv32-wch-elf-", "riscv-wch-elf-", "riscv-none-embed-", "riscv-none-elf-")
1923

2024

2125
def _base_preset(state: dict) -> str:

tools/studio/src/config/layouts.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,16 +80,16 @@ export const LAYOUT_FIVE_KEYS: LayoutDef = {
8080
* 说明: + 代表旋钮(被分成3份:左转、按下、右转)
8181
* 旋钮的3个操作都在同一个位置(row 0, col 0),由 EncoderButton 组件合并显示
8282
* 实体键顺序按实际物理位置:0=P34, 1=P14, 2=P33, 3=P31
83-
* 虚拟按键: 0-3=物理键, 4=按下, 5=逆时针, 6=顺时针
83+
* 虚拟按键: 0-3=物理键, 4=顺时针, 5=逆时针, 6=按下
8484
*/
8585
export const LAYOUT_KNOB: LayoutDef = {
8686
name: '旋钮款',
8787
cols: 3,
8888
rows: 2,
8989
hasEncoder: true,
9090
keys: [
91-
{ index: 4, row: 0, col: 0, size: '1u', label: '●', type: 'encoder-press' }, // 旋钮按下(+)
92-
{ index: 6, row: 0, col: 0, size: '1u', label: '↻', type: 'encoder-cw' }, // 旋钮右转(与按下同一位置)
91+
{ index: 6, row: 0, col: 0, size: '1u', label: '●', type: 'encoder-press' }, // 旋钮按下(+)
92+
{ index: 4, row: 0, col: 0, size: '1u', label: '↻', type: 'encoder-cw' }, // 旋钮右转(与按下同一位置)
9393
{ index: 5, row: 0, col: 0, size: '1u', label: '↺', type: 'encoder-ccw' }, // 旋钮左转(与按下同一位置)
9494
{ index: 0, row: 0, col: 1, size: '1u' }, // 按键0(·)
9595
{ index: 1, row: 0, col: 2, size: '2u-v' }, // 按键1(|,竖向2u)

0 commit comments

Comments
 (0)