From 8011329ac9f27fa1a0c65b52cac878b10d5225de Mon Sep 17 00:00:00 2001 From: github0null Date: Sat, 13 Sep 2025 23:34:14 +0800 Subject: [PATCH 1/7] support 'jlinkscript' for debug config --- src/extension.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/extension.ts b/src/extension.ts index 5af2fbb..b8386a7 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -2078,6 +2078,10 @@ class ExternalDebugConfigProvider implements vscode.DebugConfigurationProvider { m = /(?:-USB|-SelectEmuBySN) ([^\s]+)/.exec(flasherCfg.otherCmds); if (m && m.length > 1) dbgCfg['serialNumber'] = m[1]; + // -JLinkScriptFile + m = /-JLinkScriptFile ([^\s"]+|"[^"]+")/.exec(flasherCfg.otherCmds); + if (m && m.length > 1) + dbgCfg['jlinkscript'] = m[1]; } result.push(dbgCfg); result.push(newAttachDebugCfg(dbgCfg)); From 7dad1804fbcb3f1d31a60618fbb58feb53a8b20d Mon Sep 17 00:00:00 2001 From: github0null Date: Sat, 13 Sep 2025 23:56:26 +0800 Subject: [PATCH 2/7] fix flasher crashed when enumSerialPort failed --- src/HexUploader.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/HexUploader.ts b/src/HexUploader.ts index 327df38..bf6797a 100644 --- a/src/HexUploader.ts +++ b/src/HexUploader.ts @@ -257,12 +257,21 @@ export abstract class HexUploader { resolveHexFilePathEnvs(input: string, programs: FlashProgramFile[]): string { - const portList = ResManager.GetInstance().enumSerialPort(); + let portList: string[] = []; + try { + portList = ResManager.GetInstance().enumSerialPort(); + } catch (error) { + GlobalEvent.log_error(error); + } let commandLine = input .replace(/\$\{hexFile\}|\$\{binFile\}|\$\{programFile\}/ig, programs[0].path) .replace(/\$\{port\}/ig, portList[0] || '') - .replace(/\$\{portList\}/ig, portList.join(' ')); + .replace(/\$\{portList\}/ig, portList.join(' ')) + .replace('${port[0]}', portList[0] || '') + .replace('${port[1]}', portList[1] || '') + .replace('${port[2]}', portList[2] || '') + .replace('${port[3]}', portList[3] || ''); programs.forEach((file, index) => { From 59f6098fe7a8b4cc7a36e42ebe9dce744e9e5998 Mon Sep 17 00:00:00 2001 From: github0null Date: Sun, 14 Sep 2025 00:22:09 +0800 Subject: [PATCH 3/7] fix performace issue for OnSetToolchainPath(). update toolchain descriptions --- src/OperationExplorer.ts | 59 ++++++++++++++++++---------------------- src/StringTable.ts | 2 +- src/ToolchainManager.ts | 2 +- 3 files changed, 29 insertions(+), 34 deletions(-) diff --git a/src/OperationExplorer.ts b/src/OperationExplorer.ts index d47712e..e999267 100644 --- a/src/OperationExplorer.ts +++ b/src/OperationExplorer.ts @@ -415,7 +415,7 @@ export class OperationExplorer { const itemList: ProjectTemplatePickItem[] = [ { label: '8051 Quick Start (SDCC)', - detail: 'Universal 8051 example project with SDCC', + detail: 'Generic 8051 example project with SDCC', templateName: 'mcs51_sdcc', type: 'C51' }, @@ -692,6 +692,14 @@ export class OperationExplorer { const toolchainManager = ToolchainManager.getInstance(); const resManager = ResManager.GetInstance(); + const makeToolchainDespTxt = (id: ToolchainName): string => { + const dir = toolchainManager.getToolchainExecutableFolder(id); + if (dir && dir.IsDir()) + return this.getStatusTxt(true) + ` Loc: ${dir.path}`; + else + return this.getStatusTxt(false) + ` Loc: ${dir?.path || ''}` + }; + const toolchainPickItems: ToolchainDespPickItem[] = [ { type: 'None', @@ -701,37 +709,32 @@ export class OperationExplorer { { label: 'Keil C51 (cx51) (ide path)', type: 'Keil_C51', - description: this.getStatusTxt(toolchainManager.isToolchainPathReady('Keil_C51')) - + ` Loc: ${toolchainManager.getToolchainExecutableFolder('Keil_C51')?.path}`, + description: makeToolchainDespTxt('Keil_C51'), detail: view_str$operation$setKeil51Path }, { label: 'IAR For STM8 (iccstm8) (ide path)', type: 'IAR_STM8', - description: this.getStatusTxt(toolchainManager.isToolchainPathReady('IAR_STM8')) - + ` Loc: ${toolchainManager.getToolchainExecutableFolder('IAR_STM8')?.path}`, + description: makeToolchainDespTxt('IAR_STM8'), detail: view_str$operation$setToolchainInstallDir.replace('${name}', 'IAR For STM8') }, { label: 'SDCC (sdcc)', type: 'SDCC', - description: this.getStatusTxt(toolchainManager.isToolchainPathReady('SDCC')) - + ` Loc: ${toolchainManager.getToolchainExecutableFolder('SDCC')?.path}`, + description: makeToolchainDespTxt('SDCC'), detail: view_str$operation$setToolchainInstallDir.replace('${name}', 'SDCC') }, { label: 'SDCC + Binutils For 8051 (sdcc + i51-elf-as)', type: 'GNU_SDCC_MCS51', - description: this.getStatusTxt(toolchainManager.isToolchainPathReady('GNU_SDCC_MCS51')) - + ` Loc: ${toolchainManager.getToolchainExecutableFolder('GNU_SDCC_MCS51')?.path}`, + description: makeToolchainDespTxt('GNU_SDCC_MCS51'), detail: view_str$operation$setToolchainInstallDir.replace('${name}', 'SDCC + Binutils For 8051') }, { label: 'COSMIC STM8 C Compiler (cxstm8)', type: 'COSMIC_STM8', - description: this.getStatusTxt(toolchainManager.isToolchainPathReady('COSMIC_STM8')) - + ` Loc: ${toolchainManager.getToolchainExecutableFolder('COSMIC_STM8')?.path}`, - detail: view_str$operation$setToolchainInstallDir.replace('${name}', 'COSMIC_STM8'), + description: makeToolchainDespTxt('COSMIC_STM8'), + detail: view_str$operation$setToolchainInstallDir.replace('${name}', 'COSMIC STM8'), buttons: [ { iconPath: vscode.Uri.file(resManager.GetIconByName('Login_16x.svg').path), @@ -761,22 +764,19 @@ export class OperationExplorer { { label: 'ARMCC V5 (armcc) (standalone toolchain)', type: 'AC5', - description: this.getStatusTxt(toolchainManager.isToolchainPathReady('AC5')) - + ` Loc: ${toolchainManager.getToolchainExecutableFolder('AC5')?.path}`, - detail: view_str$operation$setToolchainInstallDir.replace('${name}', 'ARMCC V5 Toolchain') + description: makeToolchainDespTxt('AC5'), + detail: view_str$operation$setToolchainInstallDir.replace('${name}', 'ARMCC V5') }, { label: 'ARMCC V6 (armclang) (standalone toolchain)', type: 'AC6', - description: this.getStatusTxt(toolchainManager.isToolchainPathReady('AC6')) - + ` Loc: ${toolchainManager.getToolchainExecutableFolder('AC6')?.path}`, - detail: view_str$operation$setToolchainInstallDir.replace('${name}', 'ARMCC V6 Toolchain') + description: makeToolchainDespTxt('AC6'), + detail: view_str$operation$setToolchainInstallDir.replace('${name}', 'ARMCC V6') }, { label: 'IAR ARM C/C++ Compiler (iccarm) (standalone toolchain)', type: 'IAR_ARM', - description: this.getStatusTxt(toolchainManager.isToolchainPathReady('IAR_ARM')) - + ` Loc: ${toolchainManager.getToolchainExecutableFolder('IAR_ARM')?.path}`, + description: makeToolchainDespTxt('IAR_ARM'), detail: view_str$operation$setToolchainInstallDir.replace('${name}', 'IAR ARM C/C++ Compiler') }, @@ -789,8 +789,7 @@ export class OperationExplorer { { label: `GNU Arm Embedded Toolchain (${toolchainManager.getToolchainPrefix('GCC')}gcc)`, type: 'GCC', - description: this.getStatusTxt(toolchainManager.isToolchainPathReady('GCC')) - + ` Loc: ${toolchainManager.getToolchainExecutableFolder('GCC')?.path}`, + description: makeToolchainDespTxt('GCC'), detail: view_str$operation$setToolchainInstallDir.replace('${name}', `GNU Arm Embedded Toolchain`), buttons: [ { @@ -802,8 +801,7 @@ export class OperationExplorer { { label: `RISC-V GCC Toolchain (${toolchainManager.getToolchainPrefix('RISCV_GCC')}gcc)`, type: 'RISCV_GCC', - description: this.getStatusTxt(toolchainManager.isToolchainPathReady('RISCV_GCC')) - + ` Loc: ${toolchainManager.getToolchainExecutableFolder('RISCV_GCC')?.path}`, + description: makeToolchainDespTxt('RISCV_GCC'), detail: view_str$operation$setToolchainInstallDir.replace('${name}', `RISC-V GCC Toolchain`), buttons: [ { @@ -815,16 +813,14 @@ export class OperationExplorer { { label: 'MIPS MTI GCC Compiler', type: 'MTI_GCC', - description: this.getStatusTxt(toolchainManager.isToolchainPathReady('MTI_GCC')) - + ` Loc: ${toolchainManager.getToolchainExecutableFolder('MTI_GCC')?.path}`, + description: makeToolchainDespTxt('MTI_GCC'), detail: view_str$operation$setToolchainInstallDir.replace('${name}', 'MTI_GCC'), }, { - label: `Universal GCC Toolchain (${toolchainManager.getToolchainPrefix('ANY_GCC')}gcc)`, + label: `Generic GCC Toolchain (${toolchainManager.getToolchainPrefix('ANY_GCC')}gcc)`, type: 'ANY_GCC', - description: this.getStatusTxt(toolchainManager.isToolchainPathReady('ANY_GCC')) - + ` Loc: ${toolchainManager.getToolchainExecutableFolder('ANY_GCC')?.path}`, - detail: view_str$operation$setToolchainInstallDir.replace('${name}', `ANY GCC Toolchain`), + description: makeToolchainDespTxt('ANY_GCC'), + detail: view_str$operation$setToolchainInstallDir.replace('${name}', `Generic GCC Toolchain`), buttons: [ { iconPath: vscode.Uri.file(resManager.GetIconByName('EditTitleString_16x.svg').path), @@ -842,8 +838,7 @@ export class OperationExplorer { { label: `LLVM Embedded Toolchain For Arm (clang)`, type: 'LLVM_ARM', - description: this.getStatusTxt(toolchainManager.isToolchainPathReady('LLVM_ARM')) - + ` Loc: ${toolchainManager.getToolchainExecutableFolder('LLVM_ARM')?.path}`, + description: makeToolchainDespTxt('LLVM_ARM'), detail: view_str$operation$setToolchainInstallDir.replace('${name}', `LLVM Embedded Toolchain For Arm`) } ]; diff --git a/src/StringTable.ts b/src/StringTable.ts index 0dea650..66e1c35 100644 --- a/src/StringTable.ts +++ b/src/StringTable.ts @@ -895,7 +895,7 @@ export const view_str$operation$empty_mips_prj = [ export const view_str$operation$empty_anygcc_prj = [ '通用的 GCC 项目', - 'Universal GCC Project' + 'Generic GCC Project' ][langIndex]; export const view_str$operation$open_serialport = [ diff --git a/src/ToolchainManager.ts b/src/ToolchainManager.ts index eed8b19..0513b4b 100644 --- a/src/ToolchainManager.ts +++ b/src/ToolchainManager.ts @@ -319,7 +319,7 @@ export class ToolchainManager { case 'RISCV_GCC': return 'GNU RISC-V Toolchain'; case 'ANY_GCC': - return 'GNU Toolchain'; + return 'Generic GNU Toolchain'; case 'COSMIC_STM8': return 'COSMIC STM8 C Compiler'; case 'MTI_GCC': From a1b0b98b9ccafb74b8a2671045cc0e6846ca5c64 Mon Sep 17 00:00:00 2001 From: github0null Date: Sun, 14 Sep 2025 01:48:14 +0800 Subject: [PATCH 4/7] 3.25.4 preview --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 397c048..cd058e9 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,7 @@ "homepage": "https://em-ide.com", "license": "MIT", "description": "A mcu development environment for 8051/AVR/STM8/Cortex-M/MIPS/RISC-V", - "version": "3.25.3", + "version": "3.25.4", "preview": false, "engines": { "vscode": "^1.67.0" From e5b3564d33c5e43ac0271421741f0ca424185feb Mon Sep 17 00:00:00 2001 From: github0null Date: Wed, 17 Sep 2025 23:57:20 +0800 Subject: [PATCH 5/7] remove leading and tailing '"' for jlinkscript args in debug config --- src/extension.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/extension.ts b/src/extension.ts index b8386a7..58fc7ac 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -2081,7 +2081,9 @@ class ExternalDebugConfigProvider implements vscode.DebugConfigurationProvider { // -JLinkScriptFile m = /-JLinkScriptFile ([^\s"]+|"[^"]+")/.exec(flasherCfg.otherCmds); if (m && m.length > 1) - dbgCfg['jlinkscript'] = m[1]; + dbgCfg['jlinkscript'] = m[1].startsWith('"') + ? m[1].substring(1, m[1].length - 1) + : m[1]; } result.push(dbgCfg); result.push(newAttachDebugCfg(dbgCfg)); From 1b696038899e9ab9de491fe3583863efcfc5d6c2 Mon Sep 17 00:00:00 2001 From: github0null Date: Thu, 18 Sep 2025 00:16:28 +0800 Subject: [PATCH 6/7] fix "fatal error: cannot execute 'cc1'" for sdcc --- src/CodeBuilder.ts | 6 ++++++ src/ToolchainManager.ts | 13 +++++++++++++ 2 files changed, 19 insertions(+) diff --git a/src/CodeBuilder.ts b/src/CodeBuilder.ts index 67c799a..c764ea7 100644 --- a/src/CodeBuilder.ts +++ b/src/CodeBuilder.ts @@ -470,6 +470,12 @@ export abstract class CodeBuilder { getOutDir: () => { return this.project.ToAbsolutePath(outDir); } }, builderOptions.options); + // add extra system search path + if (toolchain.exportSystemSearchPath) { + toolchain.exportSystemSearchPath(builderOptions.options) + .forEach(p => builderOptions.sysPaths?.push(p)); + } + // handle options this.preHandleOptions(builderOptions.options); diff --git a/src/ToolchainManager.ts b/src/ToolchainManager.ts index 0513b4b..d9cf203 100644 --- a/src/ToolchainManager.ts +++ b/src/ToolchainManager.ts @@ -162,6 +162,11 @@ export interface IToolchian { */ migrateOptions?: (oldOptions: BuilderOptions) => void; + /** + * 导出额外的系统搜索路径(如果有的话) + */ + exportSystemSearchPath?: (builderOptions: BuilderOptions) => string[]; + newInstance(): IToolchian; } @@ -1214,6 +1219,14 @@ class GNU_SDCC_MCS51 implements IToolchian { } } + exportSystemSearchPath(builderOptions: BuilderOptions): string[] { + const r: string[] = []; + // to fix: sdcpp.exe: fatal error: cannot execute 'cc1': CreateProcess: No such file or directory + if (platform.osType() == 'win32') + r.push(File.ToLocalPath(NodePath.join(this.getToolchainDir().path, 'libexec', 'sdcc', 'x86_64-w64-mingw32', '12.1.0'))); + return r; + } + getInternalDefines(builderCfg: T, builderOpts: BuilderOptions): utility.CppMacroDefine[] { const mList: utility.CppMacroDefine[] = [ From b23c5dc482c9237a6ca3c45241f379669d7df391 Mon Sep 17 00:00:00 2001 From: github0null Date: Thu, 18 Sep 2025 00:16:49 +0800 Subject: [PATCH 7/7] v3.25.5 revision --- CHANGELOG.md | 9 +++++++++ package.json | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b05a21a..9780bbe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,15 @@ All notable version changes will be recorded in this file. *** +### [v3.25.5] revision + +**Fix**: + - `Flasher`: fix flasher crashed when enumSerialPort failed. + - `Setup Toolchain`: fix performace issue for OnSetToolchainPath(). update toolchain descriptions. + - `sdcc+binutils Toolchain`: fix "fatal error: cannot execute 'cc1'" for Win32 platform. + +*** + ### [v3.25.3] revision **Improve**: diff --git a/package.json b/package.json index cd058e9..c7f3f6e 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,7 @@ "homepage": "https://em-ide.com", "license": "MIT", "description": "A mcu development environment for 8051/AVR/STM8/Cortex-M/MIPS/RISC-V", - "version": "3.25.4", + "version": "3.25.5", "preview": false, "engines": { "vscode": "^1.67.0"