Skip to content

Commit ed98cd7

Browse files
authored
Merge pull request #473 from github0null/dev
v3.25.5 revision
2 parents 392ffb0 + b23c5dc commit ed98cd7

File tree

8 files changed

+75
-37
lines changed

8 files changed

+75
-37
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,15 @@ All notable version changes will be recorded in this file.
66

77
***
88

9+
### [v3.25.5] revision
10+
11+
**Fix**:
12+
- `Flasher`: fix flasher crashed when enumSerialPort failed.
13+
- `Setup Toolchain`: fix performace issue for OnSetToolchainPath(). update toolchain descriptions.
14+
- `sdcc+binutils Toolchain`: fix "fatal error: cannot execute 'cc1'" for Win32 platform.
15+
16+
***
17+
918
### [v3.25.3] revision
1019

1120
**Improve**:

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
"homepage": "https://em-ide.com",
3737
"license": "MIT",
3838
"description": "A mcu development environment for 8051/AVR/STM8/Cortex-M/MIPS/RISC-V",
39-
"version": "3.25.3",
39+
"version": "3.25.5",
4040
"preview": false,
4141
"engines": {
4242
"vscode": "^1.67.0"

src/CodeBuilder.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -470,6 +470,12 @@ export abstract class CodeBuilder {
470470
getOutDir: () => { return this.project.ToAbsolutePath(outDir); }
471471
}, builderOptions.options);
472472

473+
// add extra system search path
474+
if (toolchain.exportSystemSearchPath) {
475+
toolchain.exportSystemSearchPath(builderOptions.options)
476+
.forEach(p => builderOptions.sysPaths?.push(p));
477+
}
478+
473479
// handle options
474480
this.preHandleOptions(builderOptions.options);
475481

src/HexUploader.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,12 +257,21 @@ export abstract class HexUploader<InvokeParamsType> {
257257

258258
resolveHexFilePathEnvs(input: string, programs: FlashProgramFile[]): string {
259259

260-
const portList = ResManager.GetInstance().enumSerialPort();
260+
let portList: string[] = [];
261+
try {
262+
portList = ResManager.GetInstance().enumSerialPort();
263+
} catch (error) {
264+
GlobalEvent.log_error(error);
265+
}
261266

262267
let commandLine = input
263268
.replace(/\$\{hexFile\}|\$\{binFile\}|\$\{programFile\}/ig, programs[0].path)
264269
.replace(/\$\{port\}/ig, portList[0] || '')
265-
.replace(/\$\{portList\}/ig, portList.join(' '));
270+
.replace(/\$\{portList\}/ig, portList.join(' '))
271+
.replace('${port[0]}', portList[0] || '')
272+
.replace('${port[1]}', portList[1] || '')
273+
.replace('${port[2]}', portList[2] || '')
274+
.replace('${port[3]}', portList[3] || '');
266275

267276
programs.forEach((file, index) => {
268277

src/OperationExplorer.ts

Lines changed: 27 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ export class OperationExplorer {
415415
const itemList: ProjectTemplatePickItem[] = [
416416
{
417417
label: '8051 Quick Start (SDCC)',
418-
detail: 'Universal 8051 example project with SDCC',
418+
detail: 'Generic 8051 example project with SDCC',
419419
templateName: 'mcs51_sdcc',
420420
type: 'C51'
421421
},
@@ -692,6 +692,14 @@ export class OperationExplorer {
692692
const toolchainManager = ToolchainManager.getInstance();
693693
const resManager = ResManager.GetInstance();
694694

695+
const makeToolchainDespTxt = (id: ToolchainName): string => {
696+
const dir = toolchainManager.getToolchainExecutableFolder(id);
697+
if (dir && dir.IsDir())
698+
return this.getStatusTxt(true) + ` Loc: ${dir.path}`;
699+
else
700+
return this.getStatusTxt(false) + ` Loc: ${dir?.path || ''}`
701+
};
702+
695703
const toolchainPickItems: ToolchainDespPickItem[] = [
696704
{
697705
type: 'None',
@@ -701,37 +709,32 @@ export class OperationExplorer {
701709
{
702710
label: 'Keil C51 (cx51) (ide path)',
703711
type: 'Keil_C51',
704-
description: this.getStatusTxt(toolchainManager.isToolchainPathReady('Keil_C51'))
705-
+ ` Loc: ${toolchainManager.getToolchainExecutableFolder('Keil_C51')?.path}`,
712+
description: makeToolchainDespTxt('Keil_C51'),
706713
detail: view_str$operation$setKeil51Path
707714
},
708715
{
709716
label: 'IAR For STM8 (iccstm8) (ide path)',
710717
type: 'IAR_STM8',
711-
description: this.getStatusTxt(toolchainManager.isToolchainPathReady('IAR_STM8'))
712-
+ ` Loc: ${toolchainManager.getToolchainExecutableFolder('IAR_STM8')?.path}`,
718+
description: makeToolchainDespTxt('IAR_STM8'),
713719
detail: view_str$operation$setToolchainInstallDir.replace('${name}', 'IAR For STM8')
714720
},
715721
{
716722
label: 'SDCC (sdcc)',
717723
type: 'SDCC',
718-
description: this.getStatusTxt(toolchainManager.isToolchainPathReady('SDCC'))
719-
+ ` Loc: ${toolchainManager.getToolchainExecutableFolder('SDCC')?.path}`,
724+
description: makeToolchainDespTxt('SDCC'),
720725
detail: view_str$operation$setToolchainInstallDir.replace('${name}', 'SDCC')
721726
},
722727
{
723728
label: 'SDCC + Binutils For 8051 (sdcc + i51-elf-as)',
724729
type: 'GNU_SDCC_MCS51',
725-
description: this.getStatusTxt(toolchainManager.isToolchainPathReady('GNU_SDCC_MCS51'))
726-
+ ` Loc: ${toolchainManager.getToolchainExecutableFolder('GNU_SDCC_MCS51')?.path}`,
730+
description: makeToolchainDespTxt('GNU_SDCC_MCS51'),
727731
detail: view_str$operation$setToolchainInstallDir.replace('${name}', 'SDCC + Binutils For 8051')
728732
},
729733
{
730734
label: 'COSMIC STM8 C Compiler (cxstm8)',
731735
type: 'COSMIC_STM8',
732-
description: this.getStatusTxt(toolchainManager.isToolchainPathReady('COSMIC_STM8'))
733-
+ ` Loc: ${toolchainManager.getToolchainExecutableFolder('COSMIC_STM8')?.path}`,
734-
detail: view_str$operation$setToolchainInstallDir.replace('${name}', 'COSMIC_STM8'),
736+
description: makeToolchainDespTxt('COSMIC_STM8'),
737+
detail: view_str$operation$setToolchainInstallDir.replace('${name}', 'COSMIC STM8'),
735738
buttons: [
736739
{
737740
iconPath: vscode.Uri.file(resManager.GetIconByName('Login_16x.svg').path),
@@ -761,22 +764,19 @@ export class OperationExplorer {
761764
{
762765
label: 'ARMCC V5 (armcc) (standalone toolchain)',
763766
type: 'AC5',
764-
description: this.getStatusTxt(toolchainManager.isToolchainPathReady('AC5'))
765-
+ ` Loc: ${toolchainManager.getToolchainExecutableFolder('AC5')?.path}`,
766-
detail: view_str$operation$setToolchainInstallDir.replace('${name}', 'ARMCC V5 Toolchain')
767+
description: makeToolchainDespTxt('AC5'),
768+
detail: view_str$operation$setToolchainInstallDir.replace('${name}', 'ARMCC V5')
767769
},
768770
{
769771
label: 'ARMCC V6 (armclang) (standalone toolchain)',
770772
type: 'AC6',
771-
description: this.getStatusTxt(toolchainManager.isToolchainPathReady('AC6'))
772-
+ ` Loc: ${toolchainManager.getToolchainExecutableFolder('AC6')?.path}`,
773-
detail: view_str$operation$setToolchainInstallDir.replace('${name}', 'ARMCC V6 Toolchain')
773+
description: makeToolchainDespTxt('AC6'),
774+
detail: view_str$operation$setToolchainInstallDir.replace('${name}', 'ARMCC V6')
774775
},
775776
{
776777
label: 'IAR ARM C/C++ Compiler (iccarm) (standalone toolchain)',
777778
type: 'IAR_ARM',
778-
description: this.getStatusTxt(toolchainManager.isToolchainPathReady('IAR_ARM'))
779-
+ ` Loc: ${toolchainManager.getToolchainExecutableFolder('IAR_ARM')?.path}`,
779+
description: makeToolchainDespTxt('IAR_ARM'),
780780
detail: view_str$operation$setToolchainInstallDir.replace('${name}', 'IAR ARM C/C++ Compiler')
781781
},
782782

@@ -789,8 +789,7 @@ export class OperationExplorer {
789789
{
790790
label: `GNU Arm Embedded Toolchain (${toolchainManager.getToolchainPrefix('GCC')}gcc)`,
791791
type: 'GCC',
792-
description: this.getStatusTxt(toolchainManager.isToolchainPathReady('GCC'))
793-
+ ` Loc: ${toolchainManager.getToolchainExecutableFolder('GCC')?.path}`,
792+
description: makeToolchainDespTxt('GCC'),
794793
detail: view_str$operation$setToolchainInstallDir.replace('${name}', `GNU Arm Embedded Toolchain`),
795794
buttons: [
796795
{
@@ -802,8 +801,7 @@ export class OperationExplorer {
802801
{
803802
label: `RISC-V GCC Toolchain (${toolchainManager.getToolchainPrefix('RISCV_GCC')}gcc)`,
804803
type: 'RISCV_GCC',
805-
description: this.getStatusTxt(toolchainManager.isToolchainPathReady('RISCV_GCC'))
806-
+ ` Loc: ${toolchainManager.getToolchainExecutableFolder('RISCV_GCC')?.path}`,
804+
description: makeToolchainDespTxt('RISCV_GCC'),
807805
detail: view_str$operation$setToolchainInstallDir.replace('${name}', `RISC-V GCC Toolchain`),
808806
buttons: [
809807
{
@@ -815,16 +813,14 @@ export class OperationExplorer {
815813
{
816814
label: 'MIPS MTI GCC Compiler',
817815
type: 'MTI_GCC',
818-
description: this.getStatusTxt(toolchainManager.isToolchainPathReady('MTI_GCC'))
819-
+ ` Loc: ${toolchainManager.getToolchainExecutableFolder('MTI_GCC')?.path}`,
816+
description: makeToolchainDespTxt('MTI_GCC'),
820817
detail: view_str$operation$setToolchainInstallDir.replace('${name}', 'MTI_GCC'),
821818
},
822819
{
823-
label: `Universal GCC Toolchain (${toolchainManager.getToolchainPrefix('ANY_GCC')}gcc)`,
820+
label: `Generic GCC Toolchain (${toolchainManager.getToolchainPrefix('ANY_GCC')}gcc)`,
824821
type: 'ANY_GCC',
825-
description: this.getStatusTxt(toolchainManager.isToolchainPathReady('ANY_GCC'))
826-
+ ` Loc: ${toolchainManager.getToolchainExecutableFolder('ANY_GCC')?.path}`,
827-
detail: view_str$operation$setToolchainInstallDir.replace('${name}', `ANY GCC Toolchain`),
822+
description: makeToolchainDespTxt('ANY_GCC'),
823+
detail: view_str$operation$setToolchainInstallDir.replace('${name}', `Generic GCC Toolchain`),
828824
buttons: [
829825
{
830826
iconPath: vscode.Uri.file(resManager.GetIconByName('EditTitleString_16x.svg').path),
@@ -842,8 +838,7 @@ export class OperationExplorer {
842838
{
843839
label: `LLVM Embedded Toolchain For Arm (clang)`,
844840
type: 'LLVM_ARM',
845-
description: this.getStatusTxt(toolchainManager.isToolchainPathReady('LLVM_ARM'))
846-
+ ` Loc: ${toolchainManager.getToolchainExecutableFolder('LLVM_ARM')?.path}`,
841+
description: makeToolchainDespTxt('LLVM_ARM'),
847842
detail: view_str$operation$setToolchainInstallDir.replace('${name}', `LLVM Embedded Toolchain For Arm`)
848843
}
849844
];

src/StringTable.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -895,7 +895,7 @@ export const view_str$operation$empty_mips_prj = [
895895

896896
export const view_str$operation$empty_anygcc_prj = [
897897
'通用的 GCC 项目',
898-
'Universal GCC Project'
898+
'Generic GCC Project'
899899
][langIndex];
900900

901901
export const view_str$operation$open_serialport = [

src/ToolchainManager.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,11 @@ export interface IToolchian {
162162
*/
163163
migrateOptions?: (oldOptions: BuilderOptions) => void;
164164

165+
/**
166+
* 导出额外的系统搜索路径(如果有的话)
167+
*/
168+
exportSystemSearchPath?: (builderOptions: BuilderOptions) => string[];
169+
165170
newInstance(): IToolchian;
166171
}
167172

@@ -319,7 +324,7 @@ export class ToolchainManager {
319324
case 'RISCV_GCC':
320325
return 'GNU RISC-V Toolchain';
321326
case 'ANY_GCC':
322-
return 'GNU Toolchain';
327+
return 'Generic GNU Toolchain';
323328
case 'COSMIC_STM8':
324329
return 'COSMIC STM8 C Compiler';
325330
case 'MTI_GCC':
@@ -1214,6 +1219,14 @@ class GNU_SDCC_MCS51 implements IToolchian {
12141219
}
12151220
}
12161221

1222+
exportSystemSearchPath(builderOptions: BuilderOptions): string[] {
1223+
const r: string[] = [];
1224+
// to fix: sdcpp.exe: fatal error: cannot execute 'cc1': CreateProcess: No such file or directory
1225+
if (platform.osType() == 'win32')
1226+
r.push(File.ToLocalPath(NodePath.join(this.getToolchainDir().path, 'libexec', 'sdcc', 'x86_64-w64-mingw32', '12.1.0')));
1227+
return r;
1228+
}
1229+
12171230
getInternalDefines<T extends BuilderConfigData>(builderCfg: T, builderOpts: BuilderOptions): utility.CppMacroDefine[] {
12181231

12191232
const mList: utility.CppMacroDefine[] = [

src/extension.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2078,6 +2078,12 @@ class ExternalDebugConfigProvider implements vscode.DebugConfigurationProvider {
20782078
m = /(?:-USB|-SelectEmuBySN) ([^\s]+)/.exec(flasherCfg.otherCmds);
20792079
if (m && m.length > 1)
20802080
dbgCfg['serialNumber'] = m[1];
2081+
// -JLinkScriptFile <ScriptFilePath>
2082+
m = /-JLinkScriptFile ([^\s"]+|"[^"]+")/.exec(flasherCfg.otherCmds);
2083+
if (m && m.length > 1)
2084+
dbgCfg['jlinkscript'] = m[1].startsWith('"')
2085+
? m[1].substring(1, m[1].length - 1)
2086+
: m[1];
20812087
}
20822088
result.push(dbgCfg);
20832089
result.push(newAttachDebugCfg(dbgCfg));

0 commit comments

Comments
 (0)