Skip to content

Commit c806363

Browse files
authored
v3.23.12 revision
v3.23.12 revision
2 parents 9fe1ab8 + 5c19d30 commit c806363

File tree

8 files changed

+117
-47
lines changed

8 files changed

+117
-47
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ All notable version changes will be recorded in this file.
66

77
***
88

9-
### [v3.23.11] revision
9+
### [v3.23.12] revision
1010

1111
**Improve**:
1212
- `GNU Arm Toolchain`: Support new mcpu: `cortex-m52, cortex-m55, cortex-m85`.

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.23.11",
39+
"version": "3.23.12",
4040
"preview": false,
4141
"engines": {
4242
"vscode": "^1.67.0"

src/EIDEProject.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2141,20 +2141,18 @@ $(OUT_DIR):
21412141
private getEnvFileDefCont(): string[] {
21422142
return [
21432143
`###########################################################`,
2144-
`# project environment variables`,
2144+
`# Project Environment Variables`,
21452145
`###########################################################`,
21462146
``,
2147+
`## Global Variables`,
2148+
``,
21472149
`# append command prefix for toolchain`,
21482150
`#COMPILER_CMD_PREFIX=`,
2149-
``,
21502151
`# mcu ram size (used to print memory usage)`,
21512152
`#MCU_RAM_SIZE=0x00`,
2152-
``,
21532153
`# mcu rom size (used to print memory usage)`,
21542154
`#MCU_ROM_SIZE=0x00`,
21552155
``,
2156-
`# put your global variables ...`,
2157-
`#GLOBAL_VAR=`,
21582156
``,
21592157
].map((line) => line);
21602158
}
@@ -2639,6 +2637,7 @@ $(OUT_DIR):
26392637
this.registerBuiltinVar(key, () => process.env[key] || '');
26402638
}
26412639
}
2640+
this.registerBuiltinVar('EIDE_PY3_CMD', () => ResManager.instance().getPython3());
26422641
}
26432642

26442643
private RegisterEvent(): void {

src/ResManager.ts

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
import { File } from "../lib/node-utility/File";
2626
import { WorkspaceManager } from "./WorkspaceManager";
2727
import { GlobalEvent } from "./GlobalEvents";
28-
import { exeSuffix, GetLocalCodePage, osType, getArchId, userhome } from "./Platform";
28+
import { exeSuffix, GetLocalCodePage, osType, getArchId, userhome, find } from "./Platform";
2929
import { ExceptionToMessage } from "./Message";
3030

3131
import * as ChildProcess from 'child_process';
@@ -274,13 +274,6 @@ export class ResManager extends events.EventEmitter {
274274
}
275275
}
276276

277-
GetHostInfo(): HostInfo {
278-
return {
279-
host: "47.240.52.92",
280-
port: 50000
281-
};
282-
}
283-
284277
GetIconByName(name: string): File {
285278
let f = this.iconMap.get(name);
286279

@@ -325,6 +318,14 @@ export class ResManager extends events.EventEmitter {
325318
return process.env['ComSpec'];
326319
}
327320

321+
getPython3(): string {
322+
if (osType() == 'win32') {
323+
return File.from(userhome(), '.eide', 'bin', 'python36', 'python3.exe').path;
324+
} else {
325+
return find('python3') || 'python';
326+
}
327+
}
328+
328329
//-----------------------------------------------------------------
329330

330331
getAppRootFolder(): File {

src/StringTable.ts

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -413,15 +413,45 @@ export const view_str$env_desc$toolchain_root = [
413413
][langIndex];
414414

415415
export const view_str$env_desc$compiler_prefix = [
416-
`编译器前缀,例如:arm-none-eabi-`,
417-
`Compiler prefix, like: arm-none-eabi-`
416+
`GCC编译器前缀 (非GCC则没有前缀,为空),例如:arm-none-eabi-`,
417+
`GCC Compiler Prefix (empty if it's not gcc). e.g. arm-none-eabi-`
418418
][langIndex];
419419

420420
export const view_str$env_desc$compiler_folder = [
421421
`编译器可执行文件目录`,
422422
`Compiler executable file's folder`
423423
][langIndex];
424424

425+
export const view_str$env_desc$compiler_ver = [
426+
`编译器版本号,如:'8.3.1'`,
427+
`Compiler Version. e.g. 8.3.1`
428+
][langIndex];
429+
430+
export const view_str$env_desc$compiler_full_name = [
431+
`编译器全名 (可读名称)`,
432+
`Compiler Full Name (Human-readable Name)`
433+
][langIndex];
434+
435+
export const view_str$env_desc$cc_base_args = [
436+
`C 编译器的基本参数 (CFLAGS)`,
437+
`Base C Compiler Flags (CFLAGS)`
438+
][langIndex];
439+
440+
export const view_str$env_desc$cxx_base_args = [
441+
`C++ 编译器的基本参数 (CXXFLAGS)`,
442+
`Base C++ Compiler Flags (CXXFLAGS)`
443+
][langIndex];
444+
445+
export const view_str$env_desc$asm_base_args = [
446+
`汇编器的基本参数 (ASMFLAGS)`,
447+
`Base Assembler Flags (ASMFLAGS)`
448+
][langIndex];
449+
450+
export const view_str$env_desc$py3_cmd = [
451+
`插件内置的 python3 命令 (非windows平台则使用系统自带命令)`,
452+
`The built-in python3 commands of the plugin (for non-Windows platforms, use the system's built-in commands)`
453+
][langIndex];
454+
425455
//---------------Other---------------
426456

427457
export const view_str$gen_sct_failed = [

src/WebPanelManager.ts

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,16 @@ import { ResManager } from "./ResManager";
2828
import { AbstractProject } from "./EIDEProject";
2929
import { ArmBaseCompileConfigModel } from "./EIDEProjectModules";
3030
import { GlobalEvent } from "./GlobalEvents";
31-
import { view_str$compile$options, view_str$compile$storageLayout, view_str$env_desc$builer_folder, view_str$env_desc$compiler_folder, view_str$env_desc$compiler_prefix, view_str$env_desc$output_dir, view_str$env_desc$project_name, view_str$env_desc$project_root, view_str$env_desc$toolchain_root, view_str$operation$done, view_str$project$cmsis_config_wizard } from "./StringTable";
31+
import { view_str$compile$options, view_str$compile$storageLayout,
32+
view_str$env_desc$builer_folder, view_str$env_desc$compiler_folder,
33+
view_str$env_desc$compiler_prefix, view_str$env_desc$output_dir,
34+
view_str$env_desc$project_name, view_str$env_desc$project_root,
35+
view_str$env_desc$toolchain_root, view_str$operation$done,
36+
view_str$project$cmsis_config_wizard, view_str$env_desc$py3_cmd,
37+
view_str$env_desc$cc_base_args, view_str$env_desc$cxx_base_args,
38+
view_str$env_desc$asm_base_args, view_str$env_desc$compiler_ver,
39+
view_str$env_desc$compiler_full_name
40+
} from "./StringTable";
3241
import * as NodePath from 'path';
3342
import * as CmsisConfigParser from './CmsisConfigParser'
3443
import * as os from 'os'
@@ -232,18 +241,23 @@ export class WebPanelManager {
232241

233242
const envList: any[] = [
234243
// unify_builder specific variables
235-
{ name: '${BuilderFolder}', desc: view_str$env_desc$builer_folder },
236244
{ name: '${CompilerPrefix}', desc: view_str$env_desc$compiler_prefix },
237-
{ name: '${CompilerFolder}', desc: view_str$env_desc$compiler_folder }
245+
{ name: '${CompilerFullName}', desc: view_str$env_desc$compiler_full_name },
246+
{ name: '${CompilerVersion}', desc: view_str$env_desc$compiler_ver }
238247
];
239-
240248
const prjEnv = project.getProjectVariables();
241249
for (const key in prjEnv) {
242250
envList.push({
243251
name: `\$\{${key}\}`,
244252
desc: `${prjEnv[key]}`
245253
})
246254
}
255+
// other EIDE_xx variables
256+
[
257+
{ name: '${EIDE_CUR_COMPILER_CC_BASE_ARGS}', desc: view_str$env_desc$cc_base_args },
258+
{ name: '${EIDE_CUR_COMPILER_CXX_BASE_ARGS}', desc: view_str$env_desc$cxx_base_args },
259+
{ name: '${EIDE_CUR_COMPILER_AS_BASE_ARGS}', desc: view_str$env_desc$asm_base_args }
260+
].forEach(item => envList.push(item))
247261

248262
const toolchain = project.getToolchain();
249263

src/extension.ts

Lines changed: 48 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ function postLaunchHook(extensionCtx: vscode.ExtensionContext) {
315315
if (isFirstLaunch) {
316316

317317
// setup install time
318-
resManager.setAppUsrData('InstallTime', Date.now().toString());
318+
resManager.setAppUsrData('InstallTime', Date.now());
319319

320320
// only enable github proxy for GMT+8:00 by default
321321
const timeZone = Math.floor((new Date().getTimezoneOffset() / 60) * -1);
@@ -328,10 +328,16 @@ function postLaunchHook(extensionCtx: vscode.ExtensionContext) {
328328
// not first launch
329329
else {
330330

331+
// fix type error for old version
332+
if (typeof appUsrData['InstallTime'] === 'string') {
333+
appUsrData['InstallTime'] = parseInt(appUsrData['InstallTime']) || 0;
334+
resManager.setAppUsrData('InstallTime', appUsrData['InstallTime']);
335+
}
336+
331337
// A few days ago, show feedback message
332-
const some_days = 7 * (24 * 3600 * 1000);
338+
const some_days = 7 * utility.TIME_ONE_DAY;
333339
if (!appUsrData['Feedbacked'] &&
334-
Date.now() - appUsrData['InstallTime'] > some_days) {
340+
Date.now() > appUsrData['InstallTime'] + some_days) {
335341
resManager.setAppUsrData('Feedbacked', true);
336342
const msg = view_str$prompt$feedback;
337343
vscode.window.showInformationMessage(msg, rating_text, sponsor_author_text).then((ans) => {
@@ -433,9 +439,10 @@ async function checkAndInstallBinaries(forceInstall?: boolean): Promise<boolean>
433439
}
434440

435441
/* check eide binaries */
436-
// if user force reinstall, delete old 'bin' dir
442+
443+
// force reinstall
437444
if (forceInstall) {
438-
platform.DeleteDir(binFolder);
445+
return await tryUpdateBinaries(binFolder, undefined);
439446
}
440447

441448
// if binaries is installed, we need check binaries's version
@@ -461,12 +468,18 @@ async function checkAndInstallBinaries(forceInstall?: boolean): Promise<boolean>
461468
// try fetch update after 5sec delay
462469
if (localVersion) {
463470
setTimeout(async (curLocalVersion: string) => {
464-
const done = await tryUpdateBinaries(binFolder, curLocalVersion, true); // no prompt
465-
if (!done) {
466-
const msg = `Update eide-binaries failed, please restart vscode to try again !`;
467-
const sel = await vscode.window.showErrorMessage(msg, 'Restart', 'Cancel');
468-
if (sel == 'Restart') {
469-
vscode.commands.executeCommand('workbench.action.reloadWindow');
471+
const appUsrData = resManager.getAppUsrData() || {};
472+
const lastCheckUpdateTime: number = appUsrData['LastCheckBinariesUpdateTime'] || 0;
473+
if (Date.now() > lastCheckUpdateTime + (6 * utility.TIME_ONE_HOUR)) {
474+
const done = await tryUpdateBinaries(binFolder, curLocalVersion); // no prompt
475+
if (done) {
476+
resManager.setAppUsrData('LastCheckBinariesUpdateTime', Date.now());
477+
} else {
478+
const msg = `Update eide-binaries failed, please restart vscode to try again !`;
479+
const sel = await vscode.window.showErrorMessage(msg, 'Restart', 'Cancel');
480+
if (sel == 'Restart') {
481+
vscode.commands.executeCommand('workbench.action.reloadWindow');
482+
}
470483
}
471484
}
472485
}, 5 * 1000, localVersion);
@@ -476,7 +489,7 @@ async function checkAndInstallBinaries(forceInstall?: boolean): Promise<boolean>
476489
// the binaries maybe damaged, we need to force reinstall it
477490
else {
478491
platform.DeleteDir(binFolder); // del existed folder
479-
return await tryUpdateBinaries(binFolder, undefined, true);
492+
return await tryUpdateBinaries(binFolder, undefined);
480493
}
481494

482495
// export current binaries version
@@ -491,10 +504,13 @@ async function checkAndInstallBinaries(forceInstall?: boolean): Promise<boolean>
491504
}
492505

493506
// not found binaries folder, install it
494-
return await tryUpdateBinaries(binFolder, undefined, true);
507+
return await tryUpdateBinaries(binFolder, undefined);
495508
}
496509

497-
async function tryUpdateBinaries(binFolder: File, localVer?: string, notConfirm?: boolean): Promise<boolean> {
510+
/**
511+
* @param localVer 当前本地的版本号,通过比对版本号决定是否执行安装,如果为 undefined 则强制安装
512+
*/
513+
async function tryUpdateBinaries(binFolder: File, localVer?: string): Promise<boolean> {
498514

499515
const eideCfg = ResManager.GetInstance().getAppConfig<any>();
500516
const minReqVersion = eideCfg['binary_min_version'];
@@ -578,15 +594,12 @@ async function tryUpdateBinaries(binFolder: File, localVer?: string, notConfirm?
578594
// check bin folder
579595
// show notify to user and request a confirm
580596
if (checkBinFolder(binFolder) && preinstallVersion) {
581-
582-
if (!notConfirm) {
583-
const msg = `New update for eide binaries, version: '${preinstallVersion}', [ChangeLog](https://github.com/github0null/eide-resource/pulls?q=is%3Apr+is%3Aclosed), install now ?`;
584-
const sel = await vscode.window.showInformationMessage(msg, 'Yes', 'Later');
585-
if (sel != 'Yes') { return true; } // user canceled
586-
}
587-
588-
// del old bin folder before install
589-
platform.DeleteDir(binFolder);
597+
//TODO
598+
// if (!notConfirm) {
599+
// const msg = `New update for eide binaries, version: '${preinstallVersion}', [ChangeLog](https://github.com/github0null/eide-resource/pulls?q=is%3Apr+is%3Aclosed), install now ?`;
600+
// const sel = await vscode.window.showInformationMessage(msg, 'Yes', 'Later');
601+
// if (sel != 'Yes') { return true; } // user canceled
602+
// }
590603
}
591604

592605
return await tryInstallBinaries(binFolder, preinstallVersion);
@@ -615,9 +628,6 @@ async function tryInstallBinaries(binFolder: File, binVersion: string): Promise<
615628
try {
616629
const tmpFile = File.fromArray([os.tmpdir(), `eide-binaries-${binVersion}.${binType}`]);
617630

618-
/* make dir */
619-
binFolder.CreateDir(true);
620-
621631
const done = await vscode.window.withProgress({
622632
location: vscode.ProgressLocation.Notification,
623633
title: 'Downloading eide binaries',
@@ -666,6 +676,15 @@ async function tryInstallBinaries(binFolder: File, binVersion: string): Promise<
666676

667677
let prevPercent: number = 0;
668678

679+
// del old binaries
680+
if (binFolder.IsDir()) {
681+
progress.report({ message: `Cleanup old files ...` });
682+
platform.DeleteAllChildren(binFolder);
683+
}
684+
685+
// make dir
686+
binFolder.CreateDir(true);
687+
669688
// start unzip
670689
node7z.extractFull(tmpFile.path, binFolder.path, {
671690
$bin: ResManager.GetInstance().Get7za().path,
@@ -900,6 +919,9 @@ function exportEnvToSysPath(context?: vscode.ExtensionContext) {
900919
}
901920
}
902921

922+
/* setup python3 cmd */
923+
process.env['EIDE_PY3_CMD'] = resManager.getPython3();
924+
903925
// .NET 工具会收集用法数据,帮助我们改善你的体验。它由 Microsoft 收集并与社区共享。
904926
// 你可通过使用喜欢的 shell 将 DOTNET_CLI_TELEMETRY_OPTOUT 环境变量设置为 "1" 或 "true" 来选择退出遥测。
905927
// 阅读有关 .NET CLI 工具遥测的更多信息: https://aka.ms/dotnet-cli-telemetry

src/utility.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ import { SettingManager } from './SettingManager';
4545
import { ToolchainName } from './ToolchainManager';
4646
import { Time } from '../lib/node-utility/Time';
4747

48+
export const TIME_ONE_MINUTE = 60 * 1000;
49+
export const TIME_ONE_HOUR = 3600 * 1000;
50+
export const TIME_ONE_DAY = 24 * 3600 * 1000;
51+
4852
/**
4953
* @param len len必须是2的整数倍
5054
*/

0 commit comments

Comments
 (0)