Skip to content

Commit

Permalink
Merge pull request #325 from github0null/dev
Browse files Browse the repository at this point in the history
v3.16.0 update
  • Loading branch information
github0null committed Apr 6, 2024
2 parents ab38c15 + e950264 commit cfae8b7
Show file tree
Hide file tree
Showing 12 changed files with 96 additions and 48 deletions.
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,21 @@ All notable version changes will be recorded in this file.

***

### [v3.16.0] update

**Change**:
- `Cortex-Debug Config`: Auto generate debug config now has been **Removed**. Use the right-click menu function instead.

**Fix**:
- `Keil Project Export`: Source file type error for '*.asm'.

**Optimize**:
- `GUI Prompt String`: Change some prompt string.
- `JLink Flasher Template`: Allow use '${hexFile}, ${binFile}...' variables in `jlink.flasher.cmd.template` file.
- `STLink Flasher`: Use codepage `437` when exec STM32_Program_CLI.exe in win32 system.

***

### [v3.15.1] update

**Optimize**:
Expand Down
11 changes: 10 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"homepage": "https://em-ide.com",
"license": "MIT",
"description": "A mcu development environment for 8051/AVR/STM8/Cortex-M/MIPS/RISC-V",
"version": "3.15.1",
"version": "3.16.0",
"preview": false,
"engines": {
"vscode": "^1.67.0"
Expand Down Expand Up @@ -887,6 +887,10 @@
"light": "./res/icon/SwitchSourceOrTarget_16x.svg"
}
},
{
"command": "_cl.eide.project.genDebugConfigTemplate",
"title": "%eide.flash.gen.dbgconf%"
},
{
"command": "_cl.eide.project.fetchShellFlasher",
"title": "%eide.flash.fetch-shell-flasher%",
Expand Down Expand Up @@ -1452,6 +1456,11 @@
"group": "inline",
"when": "viewItem == UPLOAD_OPTION || viewItem == UPLOAD_OPTION_Shell && view == cl.eide.view.projects"
},
{
"command": "_cl.eide.project.genDebugConfigTemplate",
"when": "viewItem == SOLUTION || viewItem == UPLOAD_OPTION || viewItem == UPLOAD_OPTION_Shell && view == cl.eide.view.projects",
"group": "5_group@3"
},
{
"command": "_cl.eide.project.fetchShellFlasher",
"group": "inline",
Expand Down
7 changes: 4 additions & 3 deletions package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,16 @@
"eide.package.install": "Install CMSIS Chip Package",
"eide.package.install.cmsis": "Install CMSIS Header Files",
"eide.package.remove": "Uninstall Chip Support Package",
"eide.package.select.device": "Choose Device",
"eide.package.select.device": "Select Device",
"eide.package.comp.install": "Install Component",
"eide.package.comp.uninstall": "Uninstall Component",

"eide.builder.switch": "Choose Toolchain",
"eide.builder.switch": "Select Toolchain",
"eide.builder.config": "Configure Toolchain",
"eide.builder.setup-toolchain-prefix": "Setup Compiler Prefix",

"eide.flash.switch": "Choose Flasher",
"eide.flash.switch": "Select Flasher",
"eide.flash.gen.dbgconf": "Generate Cortex-Debug Configuration",
"eide.flash.fetch-shell-flasher": "Install Shell Flasher Script From Remote Repository",

"eide.deps.include.show": "Display All Include Paths",
Expand Down
1 change: 1 addition & 0 deletions package.nls.zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@
"eide.builder.setup-toolchain-prefix": "设置编译器前缀",

"eide.flash.switch": "切换烧录器",
"eide.flash.gen.dbgconf": "生成 Cortex-Debug 配置模板",
"eide.flash.fetch-shell-flasher": "从云端安装 Shell 烧录脚本",

"eide.deps.include.show": "显示所有包含路径",
Expand Down
2 changes: 1 addition & 1 deletion res/data/models/unix/8051.keil.model.json
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@
"name": "output hex file",
"toolPath": "BIN/Ohx51",
"outputSuffix": ".hex",
"command": "${linkerOutput} HEXFILE(${output}) HEX"
"command": "${linkerOutput} HEXFILE\\(${output}\\) HEX"
}
]
},
Expand Down
5 changes: 1 addition & 4 deletions src/EIDEProject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2545,9 +2545,6 @@ $(OUT_DIR):
return; // exit, because this event will trigger 'update debug config' operations
}
}

// update debug config after uploader changed
this.updateDebugConfig();
}
});
}
Expand Down Expand Up @@ -2667,7 +2664,7 @@ $(OUT_DIR):
}

protected onUploaderChanged() {
this.updateDebugConfig(); // update debug config after uploader changed
//TODO
}

protected abstract onComponentUpdate(updateList: ComponentUpdateItem[]): void;
Expand Down
8 changes: 5 additions & 3 deletions src/EIDEProjectExplorer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4182,9 +4182,6 @@ export class ProjectExplorer implements CustomConfigurationProvider {
// start build
codeBuilder.build(options);

// update debug configuration
prj.updateDebugConfig();

setTimeout(() => {
this._buildLock = false;
}, 500);
Expand Down Expand Up @@ -6862,6 +6859,11 @@ export class ProjectExplorer implements CustomConfigurationProvider {
}
}

async genDebugConfigTemplate(item: ProjTreeItem) {
const project = this.dataProvider.GetProjectByIndex(item.val.projectIndex);
project.updateDebugConfig();
}

private prev_click_info: ItemClickInfo | undefined = undefined;

private async OnTreeItemClick(item: ProjTreeItem) {
Expand Down
10 changes: 8 additions & 2 deletions src/EIDEProjectModules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import * as child_process from 'child_process';

import { File } from "../lib/node-utility/File";
import {
view_str$compile$storageLayout, view_str$compile$useCustomScatterFile, view_str$compile$scatterFilePath,
view_str$compile$storageLayout,
view_str$compile$useCustomScatterFile, view_str$compile$scatterFilePath, view_str$compile$scatterFilePath_mdk,
view_str$compile$floatingPointHardware, view_str$compile$cpuType, view_str$compile$deprecated,
view_str$compile$options,
view_str$flasher$binPath,
Expand Down Expand Up @@ -570,6 +571,9 @@ export abstract class ArmBaseCompileConfigModel
}

GetKeyDescription(key: string): string {

const toolchain = this.prjConfigData.toolchain;

switch (key) {
case 'cpuType':
return view_str$compile$cpuType;
Expand All @@ -578,7 +582,9 @@ export abstract class ArmBaseCompileConfigModel
case 'useCustomScatterFile':
return view_str$compile$useCustomScatterFile;
case 'scatterFilePath':
return view_str$compile$scatterFilePath;
return (toolchain == 'AC5' || toolchain == 'AC6')
? view_str$compile$scatterFilePath_mdk
: view_str$compile$scatterFilePath;
case 'floatingPointHardware':
return view_str$compile$floatingPointHardware;
case 'options':
Expand Down
58 changes: 34 additions & 24 deletions src/HexUploader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,31 @@ export abstract class HexUploader<InvokeParamsType> {
return result;
}

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

const portList = ResManager.GetInstance().enumSerialPort();

let commandLine = input
.replace(/\$\{hexFile\}|\$\{binFile\}|\$\{programFile\}/ig, programs[0].path)
.replace(/\$\{port\}/ig, portList[0] || '')
.replace(/\$\{portList\}/ig, portList.join(' '));

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

commandLine = commandLine
.replace(new RegExp(String.raw`\$\{hexFile\[${index}\]\}`, 'ig'), file.path)
.replace(new RegExp(String.raw`\$\{binFile\[${index}\]\}`, 'ig'), file.path)
.replace(new RegExp(String.raw`\$\{programFile\[${index}\]\}`, 'ig'), file.path);

if (file.addr) {
commandLine = commandLine
.replace(new RegExp(String.raw`\$\{binAddr\[${index}\]\}`, 'ig'), file.addr || '0x00000000')
}
});

return commandLine
}

getAllProgramFiles(): FlashProgramFile[] {
return this.parseProgramFiles(this.getUploadOptions<any>());
}
Expand Down Expand Up @@ -313,6 +338,7 @@ class JLinkUploader extends HexUploader<any> {

// replace vars
jlinkCommandtemplate = jlinkCommandtemplate.replace(/\$\{EIDE_JLINK_FLASHER_CMD\}/g, flasherCmds.join(os.EOL));
jlinkCommandtemplate = this.resolveHexFilePathEnvs(jlinkCommandtemplate, files);
jlinkCommandtemplate = this.project.resolveEnvVar(jlinkCommandtemplate);
jlinkCommandtemplate = jlinkCommandtemplate + os.EOL + 'exit'; // append 'exit' command

Expand Down Expand Up @@ -686,14 +712,16 @@ class STLinkUploader extends HexUploader<string[]> {

protected _launch(commands: string[]): void {

const commandLine = CmdLineHandler.getCommandLine(
SettingManager.GetInstance().getSTLinkExePath(), commands
);

const exe = new File(SettingManager.GetInstance().getSTLinkExePath());
const commandLine = CmdLineHandler.getCommandLine(exe.path, commands);
const options = this.getUploadOptions<STLinkOptions>();

// run
runShellCommand(this.toolType, `${commandLine} ${options.otherCmds || ''}`.trimEnd());
let cmd = `${commandLine} ${options.otherCmds || ''}`.trimEnd();
if (osType() == 'win32' && exe.noSuffixName.toLowerCase().startsWith('stm32_programmer_cli')) {
cmd = 'chcp 437 && ' + cmd;
}
runShellCommand(this.toolType, cmd);
}
}

Expand Down Expand Up @@ -1032,25 +1060,7 @@ class CustomUploader extends HexUploader<string> {
}
}

const portList = ResManager.GetInstance().enumSerialPort();

let commandLine = option.commandLine
.replace(/\$\{hexFile\}|\$\{binFile\}|\$\{programFile\}/ig, programs[0].path)
.replace(/\$\{port\}/ig, portList[0] || '')
.replace(/\$\{portList\}/ig, portList.join(' '));

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

commandLine = commandLine
.replace(new RegExp(String.raw`\$\{hexFile\[${index}\]\}`, 'ig'), file.path)
.replace(new RegExp(String.raw`\$\{binFile\[${index}\]\}`, 'ig'), file.path)
.replace(new RegExp(String.raw`\$\{programFile\[${index}\]\}`, 'ig'), file.path);

if (file.addr) {
commandLine = commandLine
.replace(new RegExp(String.raw`\$\{binAddr\[${index}\]\}`, 'ig'), file.addr || '0x00000000')
}
});
let commandLine = this.resolveHexFilePathEnvs(option.commandLine, programs);

// replace env
commandLine = this.project.replacePathEnv(commandLine);
Expand Down
18 changes: 10 additions & 8 deletions src/KeilXmlParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,17 +164,19 @@ export abstract class KeilParser<T> {
}

protected JudgeFileType(f: File): number {
switch (f.suffix.toLowerCase()) {
case '.c':

if (AbstractProject.cppfileFilter.test(f.name)) {
if (f.suffix.toLowerCase() == '.c')
return 1;
case '.s':
case '.a51':
return 2;
case '.cpp':
else
return 8;
default:
return 5;
}

else if (AbstractProject.asmfileFilter.test(f.name)) {
return 2;
}

return 5;
}

// example: file: 'c:\aa\bb', path: '../cc/f.txt', result: 'c:\aa\cc\f.txt'
Expand Down
8 changes: 6 additions & 2 deletions src/StringTable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,14 +209,18 @@ export const view_str$compile$storageLayout = [
][langIndex];

export const view_str$compile$useCustomScatterFile = [
'使用自定义的链接脚本',
'Use Custom Linker Script File'
'使用自定义的 Scatter File',
'Use Custom Scatter File'
][langIndex];

export const view_str$compile$scatterFilePath = [
'链接脚本路径',
'Linker Script File Path'
][langIndex];
export const view_str$compile$scatterFilePath_mdk = [
'Scatter File 路径',
'Scatter File Path'
][langIndex];

export const view_str$compile$floatingPointHardware = [
'硬件浮点选项',
Expand Down
1 change: 1 addition & 0 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ export async function activate(context: vscode.ExtensionContext) {
subscriptions.push(vscode.commands.registerCommand('_cl.eide.project.modifyUploadConfig', (item) => projectExplorer.ModifyUploadConfig(item)));
subscriptions.push(vscode.commands.registerCommand('_cl.eide.project.switchUploader', (item) => projectExplorer.switchUploader(item)));
subscriptions.push(vscode.commands.registerCommand('_cl.eide.project.fetchShellFlasher', (item) => projectExplorer.fetchShellFlasher(item)));
subscriptions.push(vscode.commands.registerCommand('_cl.eide.project.genDebugConfigTemplate', (item) => projectExplorer.genDebugConfigTemplate(item)));

// project deps
subscriptions.push(vscode.commands.registerCommand('_cl.eide.project.addIncludeDir', (item) => projectExplorer.AddIncludeDir(item.val.projectIndex)));
Expand Down

0 comments on commit cfae8b7

Please sign in to comment.