Skip to content

Commit cfae8b7

Browse files
authored
Merge pull request #325 from github0null/dev
v3.16.0 update
2 parents ab38c15 + e950264 commit cfae8b7

File tree

12 files changed

+96
-48
lines changed

12 files changed

+96
-48
lines changed

CHANGELOG.md

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

77
***
88

9+
### [v3.16.0] update
10+
11+
**Change**:
12+
- `Cortex-Debug Config`: Auto generate debug config now has been **Removed**. Use the right-click menu function instead.
13+
14+
**Fix**:
15+
- `Keil Project Export`: Source file type error for '*.asm'.
16+
17+
**Optimize**:
18+
- `GUI Prompt String`: Change some prompt string.
19+
- `JLink Flasher Template`: Allow use '${hexFile}, ${binFile}...' variables in `jlink.flasher.cmd.template` file.
20+
- `STLink Flasher`: Use codepage `437` when exec STM32_Program_CLI.exe in win32 system.
21+
22+
***
23+
924
### [v3.15.1] update
1025

1126
**Optimize**:

package.json

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
"homepage": "https://em-ide.com",
3939
"license": "MIT",
4040
"description": "A mcu development environment for 8051/AVR/STM8/Cortex-M/MIPS/RISC-V",
41-
"version": "3.15.1",
41+
"version": "3.16.0",
4242
"preview": false,
4343
"engines": {
4444
"vscode": "^1.67.0"
@@ -887,6 +887,10 @@
887887
"light": "./res/icon/SwitchSourceOrTarget_16x.svg"
888888
}
889889
},
890+
{
891+
"command": "_cl.eide.project.genDebugConfigTemplate",
892+
"title": "%eide.flash.gen.dbgconf%"
893+
},
890894
{
891895
"command": "_cl.eide.project.fetchShellFlasher",
892896
"title": "%eide.flash.fetch-shell-flasher%",
@@ -1452,6 +1456,11 @@
14521456
"group": "inline",
14531457
"when": "viewItem == UPLOAD_OPTION || viewItem == UPLOAD_OPTION_Shell && view == cl.eide.view.projects"
14541458
},
1459+
{
1460+
"command": "_cl.eide.project.genDebugConfigTemplate",
1461+
"when": "viewItem == SOLUTION || viewItem == UPLOAD_OPTION || viewItem == UPLOAD_OPTION_Shell && view == cl.eide.view.projects",
1462+
"group": "5_group@3"
1463+
},
14551464
{
14561465
"command": "_cl.eide.project.fetchShellFlasher",
14571466
"group": "inline",

package.nls.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,15 +80,16 @@
8080
"eide.package.install": "Install CMSIS Chip Package",
8181
"eide.package.install.cmsis": "Install CMSIS Header Files",
8282
"eide.package.remove": "Uninstall Chip Support Package",
83-
"eide.package.select.device": "Choose Device",
83+
"eide.package.select.device": "Select Device",
8484
"eide.package.comp.install": "Install Component",
8585
"eide.package.comp.uninstall": "Uninstall Component",
8686

87-
"eide.builder.switch": "Choose Toolchain",
87+
"eide.builder.switch": "Select Toolchain",
8888
"eide.builder.config": "Configure Toolchain",
8989
"eide.builder.setup-toolchain-prefix": "Setup Compiler Prefix",
9090

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

9495
"eide.deps.include.show": "Display All Include Paths",

package.nls.zh-CN.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@
8282
"eide.builder.setup-toolchain-prefix": "设置编译器前缀",
8383

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

8788
"eide.deps.include.show": "显示所有包含路径",

res/data/models/unix/8051.keil.model.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@
154154
"name": "output hex file",
155155
"toolPath": "BIN/Ohx51",
156156
"outputSuffix": ".hex",
157-
"command": "${linkerOutput} HEXFILE(${output}) HEX"
157+
"command": "${linkerOutput} HEXFILE\\(${output}\\) HEX"
158158
}
159159
]
160160
},

src/EIDEProject.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2545,9 +2545,6 @@ $(OUT_DIR):
25452545
return; // exit, because this event will trigger 'update debug config' operations
25462546
}
25472547
}
2548-
2549-
// update debug config after uploader changed
2550-
this.updateDebugConfig();
25512548
}
25522549
});
25532550
}
@@ -2667,7 +2664,7 @@ $(OUT_DIR):
26672664
}
26682665

26692666
protected onUploaderChanged() {
2670-
this.updateDebugConfig(); // update debug config after uploader changed
2667+
//TODO
26712668
}
26722669

26732670
protected abstract onComponentUpdate(updateList: ComponentUpdateItem[]): void;

src/EIDEProjectExplorer.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4182,9 +4182,6 @@ export class ProjectExplorer implements CustomConfigurationProvider {
41824182
// start build
41834183
codeBuilder.build(options);
41844184

4185-
// update debug configuration
4186-
prj.updateDebugConfig();
4187-
41884185
setTimeout(() => {
41894186
this._buildLock = false;
41904187
}, 500);
@@ -6862,6 +6859,11 @@ export class ProjectExplorer implements CustomConfigurationProvider {
68626859
}
68636860
}
68646861

6862+
async genDebugConfigTemplate(item: ProjTreeItem) {
6863+
const project = this.dataProvider.GetProjectByIndex(item.val.projectIndex);
6864+
project.updateDebugConfig();
6865+
}
6866+
68656867
private prev_click_info: ItemClickInfo | undefined = undefined;
68666868

68676869
private async OnTreeItemClick(item: ProjTreeItem) {

src/EIDEProjectModules.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ import * as child_process from 'child_process';
1010

1111
import { File } from "../lib/node-utility/File";
1212
import {
13-
view_str$compile$storageLayout, view_str$compile$useCustomScatterFile, view_str$compile$scatterFilePath,
13+
view_str$compile$storageLayout,
14+
view_str$compile$useCustomScatterFile, view_str$compile$scatterFilePath, view_str$compile$scatterFilePath_mdk,
1415
view_str$compile$floatingPointHardware, view_str$compile$cpuType, view_str$compile$deprecated,
1516
view_str$compile$options,
1617
view_str$flasher$binPath,
@@ -570,6 +571,9 @@ export abstract class ArmBaseCompileConfigModel
570571
}
571572

572573
GetKeyDescription(key: string): string {
574+
575+
const toolchain = this.prjConfigData.toolchain;
576+
573577
switch (key) {
574578
case 'cpuType':
575579
return view_str$compile$cpuType;
@@ -578,7 +582,9 @@ export abstract class ArmBaseCompileConfigModel
578582
case 'useCustomScatterFile':
579583
return view_str$compile$useCustomScatterFile;
580584
case 'scatterFilePath':
581-
return view_str$compile$scatterFilePath;
585+
return (toolchain == 'AC5' || toolchain == 'AC6')
586+
? view_str$compile$scatterFilePath_mdk
587+
: view_str$compile$scatterFilePath;
582588
case 'floatingPointHardware':
583589
return view_str$compile$floatingPointHardware;
584590
case 'options':

src/HexUploader.ts

Lines changed: 34 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,31 @@ export abstract class HexUploader<InvokeParamsType> {
202202
return result;
203203
}
204204

205+
resolveHexFilePathEnvs(input: string, programs: FlashProgramFile[]): string {
206+
207+
const portList = ResManager.GetInstance().enumSerialPort();
208+
209+
let commandLine = input
210+
.replace(/\$\{hexFile\}|\$\{binFile\}|\$\{programFile\}/ig, programs[0].path)
211+
.replace(/\$\{port\}/ig, portList[0] || '')
212+
.replace(/\$\{portList\}/ig, portList.join(' '));
213+
214+
programs.forEach((file, index) => {
215+
216+
commandLine = commandLine
217+
.replace(new RegExp(String.raw`\$\{hexFile\[${index}\]\}`, 'ig'), file.path)
218+
.replace(new RegExp(String.raw`\$\{binFile\[${index}\]\}`, 'ig'), file.path)
219+
.replace(new RegExp(String.raw`\$\{programFile\[${index}\]\}`, 'ig'), file.path);
220+
221+
if (file.addr) {
222+
commandLine = commandLine
223+
.replace(new RegExp(String.raw`\$\{binAddr\[${index}\]\}`, 'ig'), file.addr || '0x00000000')
224+
}
225+
});
226+
227+
return commandLine
228+
}
229+
205230
getAllProgramFiles(): FlashProgramFile[] {
206231
return this.parseProgramFiles(this.getUploadOptions<any>());
207232
}
@@ -313,6 +338,7 @@ class JLinkUploader extends HexUploader<any> {
313338

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

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

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

689-
const commandLine = CmdLineHandler.getCommandLine(
690-
SettingManager.GetInstance().getSTLinkExePath(), commands
691-
);
692-
715+
const exe = new File(SettingManager.GetInstance().getSTLinkExePath());
716+
const commandLine = CmdLineHandler.getCommandLine(exe.path, commands);
693717
const options = this.getUploadOptions<STLinkOptions>();
694718

695719
// run
696-
runShellCommand(this.toolType, `${commandLine} ${options.otherCmds || ''}`.trimEnd());
720+
let cmd = `${commandLine} ${options.otherCmds || ''}`.trimEnd();
721+
if (osType() == 'win32' && exe.noSuffixName.toLowerCase().startsWith('stm32_programmer_cli')) {
722+
cmd = 'chcp 437 && ' + cmd;
723+
}
724+
runShellCommand(this.toolType, cmd);
697725
}
698726
}
699727

@@ -1032,25 +1060,7 @@ class CustomUploader extends HexUploader<string> {
10321060
}
10331061
}
10341062

1035-
const portList = ResManager.GetInstance().enumSerialPort();
1036-
1037-
let commandLine = option.commandLine
1038-
.replace(/\$\{hexFile\}|\$\{binFile\}|\$\{programFile\}/ig, programs[0].path)
1039-
.replace(/\$\{port\}/ig, portList[0] || '')
1040-
.replace(/\$\{portList\}/ig, portList.join(' '));
1041-
1042-
programs.forEach((file, index) => {
1043-
1044-
commandLine = commandLine
1045-
.replace(new RegExp(String.raw`\$\{hexFile\[${index}\]\}`, 'ig'), file.path)
1046-
.replace(new RegExp(String.raw`\$\{binFile\[${index}\]\}`, 'ig'), file.path)
1047-
.replace(new RegExp(String.raw`\$\{programFile\[${index}\]\}`, 'ig'), file.path);
1048-
1049-
if (file.addr) {
1050-
commandLine = commandLine
1051-
.replace(new RegExp(String.raw`\$\{binAddr\[${index}\]\}`, 'ig'), file.addr || '0x00000000')
1052-
}
1053-
});
1063+
let commandLine = this.resolveHexFilePathEnvs(option.commandLine, programs);
10541064

10551065
// replace env
10561066
commandLine = this.project.replacePathEnv(commandLine);

src/KeilXmlParser.ts

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -164,17 +164,19 @@ export abstract class KeilParser<T> {
164164
}
165165

166166
protected JudgeFileType(f: File): number {
167-
switch (f.suffix.toLowerCase()) {
168-
case '.c':
167+
168+
if (AbstractProject.cppfileFilter.test(f.name)) {
169+
if (f.suffix.toLowerCase() == '.c')
169170
return 1;
170-
case '.s':
171-
case '.a51':
172-
return 2;
173-
case '.cpp':
171+
else
174172
return 8;
175-
default:
176-
return 5;
177173
}
174+
175+
else if (AbstractProject.asmfileFilter.test(f.name)) {
176+
return 2;
177+
}
178+
179+
return 5;
178180
}
179181

180182
// example: file: 'c:\aa\bb', path: '../cc/f.txt', result: 'c:\aa\cc\f.txt'

0 commit comments

Comments
 (0)