Skip to content

Commit 99bb6b6

Browse files
authored
Merge pull request #512 from github0null/dev
v3.26.6 revision
2 parents 9ad7381 + f46a5a6 commit 99bb6b6

14 files changed

+460
-65
lines changed

CHANGELOG.md

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

77
***
88

9+
### [v3.26.6] revision
10+
11+
**New**:
12+
- `One-Click Debug`: Support new debugger `eclipse-cdt.cdt-gdb-vscode`. You can select it in project settings.
13+
14+
**Changes**:
15+
- `axf2elf Removed`: This function now is deprecated because we can use 'loadFiles', 'symbolFiles' options to load ac5/ac6 axf.
16+
- `Project Export`: Check [PR 511](https://github.com/github0null/eide/pull/511) for more details.
17+
18+
***
19+
920
### [v3.26.5] revision
1021

1122
**Improve**:

eide.code-workspace

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66
],
77
"settings": {
88
"search.useIgnoreFiles": false,
9-
"typescript.tsdk": "node_modules\\typescript\\lib"
9+
"js/ts.tsdk.path": "node_modules/typescript/lib"
1010
}
11-
}
11+
}

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 7 deletions
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.26.5",
39+
"version": "3.26.6",
4040
"preview": false,
4141
"engines": {
4242
"vscode": "^1.67.0"
@@ -440,12 +440,6 @@
440440
"description": "Auto Generate RTE_Components.h",
441441
"default": true
442442
},
443-
"EIDE.ARM.Option.AxfToElf": {
444-
"type": "boolean",
445-
"scope": "resource",
446-
"markdownDescription": "%settings.armcc.convert.axf%",
447-
"default": true
448-
},
449443
"EIDE.STM8.STVP.CliExePath": {
450444
"type": "string",
451445
"scope": "resource",

res/data/openocd-helpers.tcl

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
#
2+
# Cortex-Debug extension calls this function during initialization. You can copy this
3+
# file, modify it and specifyy it as one of the config files supplied in launch.json
4+
# preferably at the beginning.
5+
#
6+
# Note that this file simply defines a function for use later when it is time to configure
7+
# for SWO.
8+
#
9+
set USE_SWO 0
10+
proc CDSWOConfigure { CDCPUFreqHz CDSWOFreqHz CDSWOOutput } {
11+
# We don't create/configure the entire TPIU which requires advanced knowledge of the device
12+
# like which DAP/AP ports to use, what their bases addresses are, etc. That should already
13+
# be done by the config files from the Silicon Vendor
14+
catch {tpiu init}; # we are allowed to call this multiple times. So, call it just in case
15+
set tipu_names [tpiu names]
16+
if { [llength $tipu_names] == 0 } {
17+
puts stderr "[info script]: Error: Could not find TPIU/SWO names. Perhaps it hasn't been created?"
18+
} else {
19+
set mytpiu [lindex $tipu_names 0]
20+
# We don't create/configure the entire TPIU which requires advanced knowledge of the device
21+
# like which DAP/AP ports to use, what their bases addresses are, etc. That should already
22+
# be done by the config files from the Silicon Vendor
23+
puts "[info script]: $mytpiu configure -protocol uart -output $CDSWOOutput -traceclk $CDCPUFreqHz -pin-freq $CDSWOFreqHz"
24+
$mytpiu configure -protocol uart -output $CDSWOOutput -traceclk $CDCPUFreqHz -pin-freq $CDSWOFreqHz
25+
$mytpiu enable
26+
}
27+
}
28+
29+
#
30+
# The following function may not work in a multi-core setup. You may want to overide this function
31+
# to enable RTOS detection for each core appropriately. This function must be called before `init` and
32+
# after all the targets are created.
33+
#
34+
proc CDRTOSConfigure { rtos } {
35+
set target [target current]
36+
if { $target != "" } {
37+
puts "[info script]: $target configure -rtos $rtos"
38+
$target configure -rtos $rtos
39+
} else {
40+
# Maybe this function was called too early?
41+
puts stderr "[info script]: Error: No current target. Could not configure target for RTOS"
42+
}
43+
}
44+
45+
#
46+
# CDLiveWatchSetup
47+
# This function must be called before the init is called and after all the targets are created. You can create
48+
# a custom version of this function (even empty) if you already setup the gdb-max-connections elsewhere
49+
#
50+
# We increment all gdb-max-connections by one if it is already a non-zero. Note that if it was already set to -1,
51+
# we leave it alone as it means unlimited connections
52+
#
53+
proc CDLiveWatchSetup {} {
54+
try {
55+
foreach tgt [target names] {
56+
set nConn [$tgt cget -gdb-max-connections]
57+
if { $nConn > 0 } {
58+
incr nConn
59+
$tgt configure -gdb-max-connections $nConn
60+
puts "[info script]: Info: Setting gdb-max-connections for target '$tgt' to $nConn"
61+
}
62+
}
63+
} on error {} {
64+
puts stderr "[info script]: Error: Failed to increase gdb-max-connections for current target. Live variables will not work"
65+
}
66+
}

src/CodeBuilder.ts

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1126,17 +1126,18 @@ export class ARMCodeBuilder extends CodeBuilder {
11261126

11271127
const extraCommands: any[] = [];
11281128

1129+
//! deprecated. 现在我们可以通过在调试配置中设置 'loadFiles' 和 'symbolFiles' 来实现同样效果
11291130
// convert axf to elf
11301131
// why we need this ? see: https://stackoverflow.com/questions/49508277/warning-loadable-section-my-section-outside-of-elf-segments
1131-
if (['AC5', 'AC6'].includes(config.toolchain) &&
1132-
settingManager.IsConvertAxf2Elf() &&
1133-
options['linker']['$disableOutputTask'] != true) {
1134-
const axf2elf_log = `\${OutDir}/axf2elf.log`;
1135-
extraCommands.push({
1136-
name: 'axf to elf',
1137-
command: `axf2elf -d "\${ToolchainRoot}" -i "\${OutDir}/\${ProjectName}.axf" -o "\${OutDir}/\${ProjectName}.elf" > "${axf2elf_log}"`
1138-
});
1139-
}
1132+
// if (['AC5', 'AC6'].includes(config.toolchain) &&
1133+
// settingManager.IsConvertAxf2Elf() &&
1134+
// options['linker']['$disableOutputTask'] != true) {
1135+
// const axf2elf_log = `\${OutDir}/axf2elf.log`;
1136+
// extraCommands.push({
1137+
// name: 'axf to elf',
1138+
// command: `axf2elf -d "\${ToolchainRoot}" -i "\${OutDir}/\${ProjectName}.axf" -o "\${OutDir}/\${ProjectName}.elf" > "${axf2elf_log}"`
1139+
// });
1140+
// }
11401141

11411142
// insert command lines
11421143
if (settingManager.isInsertCommandsAtBegin()) {

src/EIDEProject.ts

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1541,6 +1541,11 @@ export abstract class AbstractProject implements CustomConfigurationProvider, Pr
15411541

15421542
//////////////////////// project targets //////////////////////////
15431543

1544+
getTargetInfo(): ProjectTargetInfo {
1545+
const prjConfig = this.GetConfiguration<any>().config;
1546+
return prjConfig.targets[prjConfig.mode];
1547+
}
1548+
15441549
getCurrentTarget(): string {
15451550
return this.GetConfiguration().config.mode;
15461551
}
@@ -3414,7 +3419,7 @@ $(OUT_DIR):
34143419

34153420
protected abstract create(option: CreateOptions): File;
34163421

3417-
abstract ExportToKeilProject(): File | undefined;
3422+
abstract ExportToKeilProject(saveFile?: File): File | undefined;
34183423

34193424
static NewProject(workspaceState: vscode.Memento): AbstractProject {
34203425
return new EIDEProject(workspaceState);
@@ -3813,7 +3818,7 @@ class EIDEProject extends AbstractProject {
38133818
return baseInfo.workspaceFile;
38143819
}
38153820

3816-
ExportToKeilProject(): File | undefined {
3821+
ExportToKeilProject(saveFile?: File): File | undefined {
38173822

38183823
let keilFile: File;
38193824

@@ -3826,8 +3831,8 @@ class EIDEProject extends AbstractProject {
38263831
const keilSuffix = prjConfig.type === 'C51' ? 'uvproj' : 'uvprojx';
38273832
const suffixFilter = [new RegExp('\\.' + keilSuffix + '$', 'i')];
38283833

3829-
// local keil file
3830-
const localKeilFile = File.fromArray([this.GetRootDir().path, `${prjConfig.name}.${keilSuffix}`]);
3834+
// use user-specified save path, or fall back to project root
3835+
const localKeilFile = saveFile ?? File.fromArray([this.GetRootDir().path, `${prjConfig.name}.${keilSuffix}`]);
38313836

38323837
// get from project root folder
38333838
if (localKeilFile.IsFile()) {
@@ -3860,7 +3865,7 @@ class EIDEProject extends AbstractProject {
38603865
halFiles = halFiles.concat(group.files);
38613866
} else {
38623867
fileGroups.push(<FileGroup>{
3863-
name: File.ToUnixPath(<string>rePath).toUpperCase(),
3868+
name: File.ToUnixPath(<string>rePath),
38643869
files: group.files,
38653870
disabled: group.disabled
38663871
});
@@ -3892,10 +3897,13 @@ class EIDEProject extends AbstractProject {
38923897
// rm empty file groups for MDK
38933898
fileGroups = fileGroups.filter(g => g.files.length > 0);
38943899

3900+
const outDir = saveFile ? new File(NodePath.dirname(saveFile.path)) : this.GetRootDir();
3901+
const outName = saveFile ? saveFile.noSuffixName : localKeilFile.noSuffixName;
3902+
38953903
// set keil xml
3896-
keilParser.SetKeilXml(this, fileGroups, cDevice);
3904+
keilParser.SetKeilXml(this, fileGroups, outDir, cDevice);
38973905

3898-
return keilParser.Save(this.GetRootDir(), localKeilFile.noSuffixName);
3906+
return keilParser.Save(outDir, outName);
38993907
}
39003908

39013909
//////////////////////////////// overrride ///////////////////////////////////

src/EIDEProjectExplorer.ts

Lines changed: 79 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,9 @@ import {
8989
remove_this_item,
9090
view_str$prompt$filesOptionsComment,
9191
view_str$virual_doc_provider_banner,
92-
view_str$missed_stubs_added
92+
view_str$missed_stubs_added,
93+
view_str$keil_export_path_warning,
94+
view_str$settings$debugger
9395
} from './StringTable';
9496
import { CodeBuilder, BuildOptions } from './CodeBuilder';
9597
import { ExceptionToMessage, newMessage } from './Message';
@@ -112,7 +114,8 @@ import {
112114
pyocd_getTargetList,
113115
generateDotnetProgramCmd,
114116
isGccFamilyToolchain,
115-
cxxDemangle
117+
cxxDemangle,
118+
DEBUGGER_MAPS
116119
} from './utility';
117120
import { concatSystemEnvPath, DeleteDir, exeSuffix, kill, osType, DeleteAllChildren, userhome, getGlobalState } from './Platform';
118121
import { KeilARMOption, KeilC51Option, KeilParser, KeilRteDependence } from './KeilXmlParser';
@@ -1371,6 +1374,16 @@ class ProjectDataProvider implements vscode.TreeDataProvider<ProjTreeItem>, vsco
13711374
projectIndex: element.val.projectIndex
13721375
}));
13731376

1377+
// setting: debugger
1378+
const debuggerId = project.getTargetInfo().settings.debugger || 'unknown';
1379+
iList.push(new ProjTreeItem(TreeItemType.SETTINGS_ITEM, {
1380+
key: 'debugger',
1381+
value: DEBUGGER_MAPS[debuggerId].name,
1382+
keyAlias: view_str$settings$debugger,
1383+
tooltip: newMarkdownString(`**${view_str$settings$debugger}**: \`${DEBUGGER_MAPS[debuggerId].name}\``),
1384+
projectIndex: element.val.projectIndex
1385+
}));
1386+
13741387
// setting: project env
13751388
iList.push(new ProjTreeItem(TreeItemType.SETTINGS_ITEM, {
13761389
key: 'project.env',
@@ -1969,6 +1982,7 @@ class ProjectDataProvider implements vscode.TreeDataProvider<ProjTreeItem>, vsco
19691982
libList: []
19701983
},
19711984
builderOptions: {},
1985+
settings: {}
19721986
};
19731987
eidePrjCfg.targets[targetName] = nEideTarget;
19741988

@@ -2206,7 +2220,8 @@ class ProjectDataProvider implements vscode.TreeDataProvider<ProjTreeItem>, vsco
22062220
incList: [],
22072221
defineList: [],
22082222
libList: []
2209-
}
2223+
},
2224+
settings: {}
22102225
};
22112226

22122227
nEideTarget.cppPreprocessAttrs.defineList = eTarget.builldArgs.cMacros;
@@ -4203,7 +4218,7 @@ export class ProjectExplorer implements CustomConfigurationProvider {
42034218
}
42044219
}
42054220

4206-
ExportKeilXml(prjItem: ProjTreeItem) {
4221+
async ExportKeilXml(prjItem: ProjTreeItem) {
42074222
try {
42084223
const prj = this.getProjectByTreeItem(prjItem);
42094224
if (!prj)
@@ -4221,7 +4236,27 @@ export class ProjectExplorer implements CustomConfigurationProvider {
42214236
return;
42224237
}
42234238

4224-
const xmlFile = prj.ExportToKeilProject();
4239+
const prjConfig = prj.GetConfiguration().config;
4240+
const keilSuffix = prjConfig.type === 'C51' ? 'uvproj' : 'uvprojx';
4241+
const defaultUri = vscode.Uri.file(NodePath.join(prj.GetRootDir().path, `${prjConfig.name}.${keilSuffix}`));
4242+
4243+
const uri = await vscode.window.showSaveDialog({
4244+
defaultUri: defaultUri,
4245+
filters: { 'Keil Project': [keilSuffix] }
4246+
});
4247+
if (!uri) return;
4248+
4249+
// warn if the chosen save path is on a different drive from the project root;
4250+
// in that case, cross-drive paths cannot be made relative and will be written as absolute paths
4251+
const saveDrive = NodePath.parse(uri.fsPath).root.toLowerCase();
4252+
const prjDrive = NodePath.parse(prj.GetRootDir().path).root.toLowerCase();
4253+
if (saveDrive !== prjDrive) {
4254+
GlobalEvent.emit('msg', newMessage('Warning', view_str$keil_export_path_warning
4255+
.replace('{0}', saveDrive)
4256+
.replace('{1}', prjDrive)));
4257+
}
4258+
4259+
const xmlFile = prj.ExportToKeilProject(new File(uri.fsPath));
42254260

42264261
if (xmlFile) {
42274262
GlobalEvent.emit('msg', newMessage('Info', export_keil_xml_ok + prj.toRelativePath(xmlFile.path)));
@@ -6192,6 +6227,36 @@ export class ProjectExplorer implements CustomConfigurationProvider {
61926227
}
61936228
}
61946229
break;
6230+
case 'debugger':
6231+
{
6232+
const selections: any[] = [];
6233+
6234+
if (prj.getProjectType() !== 'C51') {
6235+
6236+
selections.push({
6237+
value: 'cortex-debug',
6238+
label: DEBUGGER_MAPS['cortex-debug'].name,
6239+
detail: `extension id: ${DEBUGGER_MAPS['cortex-debug'].extension_id}`
6240+
});
6241+
6242+
selections.push({
6243+
value: 'cdt-gdb-debug',
6244+
label: DEBUGGER_MAPS['cdt-gdb-debug'].name,
6245+
detail: `extension id: ${DEBUGGER_MAPS['cdt-gdb-debug'].extension_id}`
6246+
});
6247+
}
6248+
6249+
const res = await vscode.window.showQuickPick(selections, {placeHolder: 'Select debugger type'});
6250+
if (res) {
6251+
const targetInfo = prj.getTargetInfo();
6252+
if (targetInfo.settings.debugger !== res.value) {
6253+
targetInfo.settings.debugger = res.value;
6254+
this.updateSettingsView(prj);
6255+
prj.Save(true);
6256+
}
6257+
}
6258+
}
6259+
break;
61956260
// 'project.env'
61966261
case 'project.env':
61976262
{
@@ -7222,7 +7287,8 @@ export class ProjectExplorer implements CustomConfigurationProvider {
72227287
type: 'jlink' | 'openocd' | 'pyocd',
72237288
prj: AbstractProject, old_cfgs: any[]): Promise<{ debug_config: any, override_idx: number } | undefined> {
72247289

7225-
const _elfPath = File.ToUnixPath(prj.getOutputDir()) + '/' + `${prj.getProjectName()}.elf`;
7290+
const _outFullName = File.ToUnixPath(prj.getOutputDir()) + '/' + `${prj.getProjectName()}`
7291+
const _elfPath = `${_outFullName}.elf`;
72267292
const _debugConfigTemplates = {
72277293
'jlink': {
72287294
cwd: '${workspaceRoot}',
@@ -7260,9 +7326,15 @@ export class ProjectExplorer implements CustomConfigurationProvider {
72607326
};
72617327

72627328
const debugConfig: any = _debugConfigTemplates[type];
7329+
const toolchain = prj.getToolchain();
7330+
7331+
if (toolchain.name == 'AC5' || toolchain.name == 'AC6') {
7332+
debugConfig['executable'] = undefined;
7333+
debugConfig['loadFiles'] = [ `${_outFullName}.hex` ];
7334+
debugConfig['symbolFiles'] = [ `${_outFullName}.axf` ];
7335+
}
72637336

72647337
/* set gdb toolchain */
7265-
const toolchain = prj.getToolchain();
72667338
if (toolchain.getToolchainPrefix) {
72677339
debugConfig.toolchainPrefix = toolchain.getToolchainPrefix().trim().replace(/-$/, '');
72687340
} else if (debugConfig.toolchainPrefix) {

0 commit comments

Comments
 (0)