Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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**:
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.5",
"preview": false,
"engines": {
"vscode": "^1.67.0"
Expand Down
6 changes: 6 additions & 0 deletions src/CodeBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
13 changes: 11 additions & 2 deletions src/HexUploader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,12 +257,21 @@ export abstract class HexUploader<InvokeParamsType> {

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) => {

Expand Down
59 changes: 27 additions & 32 deletions src/OperationExplorer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
},
Expand Down Expand Up @@ -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',
Expand All @@ -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),
Expand Down Expand Up @@ -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')
},

Expand All @@ -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: [
{
Expand All @@ -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: [
{
Expand All @@ -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),
Expand All @@ -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`)
}
];
Expand Down
2 changes: 1 addition & 1 deletion src/StringTable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down
15 changes: 14 additions & 1 deletion src/ToolchainManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,11 @@ export interface IToolchian {
*/
migrateOptions?: (oldOptions: BuilderOptions) => void;

/**
* 导出额外的系统搜索路径(如果有的话)
*/
exportSystemSearchPath?: (builderOptions: BuilderOptions) => string[];

newInstance(): IToolchian;
}

Expand Down Expand Up @@ -319,7 +324,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':
Expand Down Expand Up @@ -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<T extends BuilderConfigData>(builderCfg: T, builderOpts: BuilderOptions): utility.CppMacroDefine[] {

const mList: utility.CppMacroDefine[] = [
Expand Down
6 changes: 6 additions & 0 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2078,6 +2078,12 @@ class ExternalDebugConfigProvider implements vscode.DebugConfigurationProvider {
m = /(?:-USB|-SelectEmuBySN) ([^\s]+)/.exec(flasherCfg.otherCmds);
if (m && m.length > 1)
dbgCfg['serialNumber'] = m[1];
// -JLinkScriptFile <ScriptFilePath>
m = /-JLinkScriptFile ([^\s"]+|"[^"]+")/.exec(flasherCfg.otherCmds);
if (m && m.length > 1)
dbgCfg['jlinkscript'] = m[1].startsWith('"')
? m[1].substring(1, m[1].length - 1)
: m[1];
}
result.push(dbgCfg);
result.push(newAttachDebugCfg(dbgCfg));
Expand Down