Skip to content

Commit 5b5c9c4

Browse files
authored
Merge pull request #312 from github0null/dev
v3.15.0 update
2 parents a533efa + 53de224 commit 5b5c9c4

18 files changed

+718
-248
lines changed

CHANGELOG.md

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

77
***
88

9+
### [v3.15.0] update
10+
11+
**New**:
12+
- `RightClick Menu`: Add groups for menu
13+
14+
**Optimize**:
15+
- `COSMIC STM8`: Auto select crts*.stm8 library
16+
17+
***
18+
19+
### [v3.14.20240116] revision
20+
21+
**New**:
22+
- `Clangd Support`: Auto generate `.clangd` config for your project. (Only for gcc/clang compiler !)
23+
- `Library Generator Support`: Add libs generator, support archive your obj files after build done.
24+
25+
**Optimize**:
26+
- `OpenOCD Flasher`: Allow select 'None' config.
27+
28+
***
29+
930
### [v3.14.0] update
1031

1132
**New**:

lang/stm8.cosmic.verify.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,19 @@
294294
"type": "boolean",
295295
"default": false
296296
},
297+
"crts-initialize": {
298+
"description": "Range Of Variables To Be Initialized",
299+
"type": "string",
300+
"default": "crtsi",
301+
"enum": [
302+
"crtsi",
303+
"crtsx"
304+
],
305+
"enumDescriptions": [
306+
"@near",
307+
"@near and @far"
308+
]
309+
},
297310
"LD_FLAGS": {
298311
"markdownDescription": "Other Linker Options (clnk)",
299312
"$ref": "#/definitions/misc-controls"

package.json

Lines changed: 247 additions & 194 deletions
Large diffs are not rendered by default.

package.nls.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,15 @@
1111
"eide.function.reload.jlink.dev.list": "Reload JLink Devices List",
1212
"eide.function.reload.stm8.dev.list": "Reload STM8 Devices List",
1313
"eide.function.reinstall.binaries": "Reinstall eide binaries",
14+
"eide.function.gen_clang_format": "Create new .clang-format template file",
15+
"eide.function.open_libs.yml": "Open Libs Generator Configuration",
1416

1517
"eide.project.show_project_vars": "Show All Project Variables",
1618
"eide.project.save": "Save Project",
1719
"eide.project.refresh": "Refresh",
1820
"eide.project.save.all": "Save All Projects",
1921
"eide.project.active": "Active Project",
20-
"eide.project.close": "Close",
22+
"eide.project.close": "Close Project",
2123
"eide.project.export.template": "Export Eide Project Template",
2224
"eide.project.export.keil": "Export Keil Project",
2325
"eide.project.show.commands": "Show Compiler CommandLine",
@@ -29,7 +31,7 @@
2931
"eide.project.upload": "Program Flash",
3032
"eide.project.flash.erase.all": "Erase Chip",
3133
"eide.project.modify.files.options": "Show Source Files Extra Compiler Options",
32-
"eide.project.import.ext.project.src.struct": "Import source tree from other projects",
34+
"eide.project.import.ext.project.src.struct": "Import SourceFile Tree From Other Project",
3335
"eide.project.generate_builder_params": "Generate builder.params",
3436

3537
"eide.prj.menus.main.cppcheck": "Static Check",

package.nls.zh-CN.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
"eide.function.reload.jlink.dev.list": "重新加载 JLink 芯片信息列表",
1212
"eide.function.reload.stm8.dev.list": "重新加载 STM8 芯片信息列表",
1313
"eide.function.reinstall.binaries": "重新安装 eide binaries",
14+
"eide.function.gen_clang_format": "新建 .clang-format 代码格式化配置模板",
15+
"eide.function.open_libs.yml": "打开lib生成器配置",
1416

1517
"eide.project.show_project_vars": "显示所有可用的项目变量",
1618
"eide.project.save": "保存项目",

res/data/template.libs.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
##########################################################################################
2+
# Generate libs for your project
3+
# syntax:
4+
# ---
5+
# <your lib name>:
6+
# - <obj file 1>
7+
# - <obj file 2>
8+
#
9+
# For more syntax, please refer to: https://www.npmjs.com/package/micromatch
10+
#
11+
##########################################################################################
12+
13+
## ----------------------------
14+
## examples
15+
## This examples will generate 2 libs after build done,
16+
## they are: 'app.lib', 'test.lib'
17+
## ----------------------------
18+
#app:
19+
# - '**/src/app.o'
20+
# - '**/src/a.o'
21+
# - '**/src/a/*.o'
22+
#
23+
#test:
24+
# - '**/test/app.o'
25+
# - '**/test/c.o'
26+
# - '**/test/c/*.o'

res/template/cosmic_stm8.ept

152 Bytes
Binary file not shown.

src/CodeBuilder.ts

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -131,25 +131,8 @@ export abstract class CodeBuilder {
131131
paramsModTime?: number;
132132
} {
133133

134-
const srcList: { path: string, virtualPath?: string; }[] = [];
135134
const srcParams: { [name: string]: string; } = {};
136-
const fGoups = this.project.getFileGroups();
137-
const filter = AbstractProject.getSourceFileFilter();
138-
139-
// filter source files
140-
for (const group of fGoups) {
141-
if (group.disabled) continue; // skip disabled group
142-
for (const source of group.files) {
143-
if (source.disabled) continue; // skip disabled file
144-
if (!filter.some((reg) => reg.test(source.file.path))) continue; // skip non-source
145-
const rePath = this.project.ToRelativePath(source.file.path);
146-
const fInfo: any = { path: rePath || source.file.path }
147-
if (AbstractProject.isVirtualSourceGroup(group)) {
148-
fInfo.virtualPath = `${group.name}/${source.file.name}`;
149-
}
150-
srcList.push(fInfo);
151-
}
152-
}
135+
const srcList: { path: string, virtualPath?: string; }[] = this.project.getAllSources();
153136

154137
// append user options for files
155138
try {
@@ -483,6 +466,25 @@ export abstract class CodeBuilder {
483466
// handle options
484467
this.preHandleOptions(builderOptions.options);
485468

469+
// gen libs.makefile
470+
const mkfile = File.fromArray([this.project.ToAbsolutePath(outDir), 'libs.makefile']);
471+
const mk_txt = this.project.genLibsMakefileContent(mkfile.name);
472+
if (mk_txt) {
473+
try {
474+
mkfile.Write(mk_txt);
475+
let command: any = {
476+
name: 'make libs',
477+
command: `make --directory=./${outDir} --makefile=./${mkfile.name} all`
478+
};
479+
if (builderOptions.options.afterBuildTasks == undefined)
480+
builderOptions.options.afterBuildTasks = [];
481+
builderOptions.options.afterBuildTasks = [command].concat(builderOptions.options.afterBuildTasks);
482+
} catch (error) {
483+
GlobalEvent.emit('msg', newMessage('Warning', `Generating '${mkfile.name}' failed !`));
484+
GlobalEvent.emit('globalLog', ExceptionToMessage(error, 'Error'));
485+
}
486+
}
487+
486488
// generate hash for compiler options
487489
builderOptions.sha = this.genHashFromCompilerOptions(builderOptions);
488490

src/Compress.ts

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ export class SevenZipper {
102102
this._event.emit('progress', 20, line);
103103
});
104104

105-
process.Run('tar', paramList);
105+
process.Run(this._tar_path(), paramList);
106106
});
107107
}
108108

@@ -154,13 +154,25 @@ export class SevenZipper {
154154
});
155155
}
156156

157+
private _is_tar(path: string) {
158+
return /\.tar$|\.tar\./.test(path);
159+
}
160+
161+
private _tar_path(): string {
162+
if (platform.osType() == 'win32') {
163+
return ResManager.instance().getMsysBinToolPath('tar');
164+
} else {
165+
return 'tar';
166+
}
167+
}
168+
157169
Unzip(zipFile: File, outDir?: File): Promise<Error | null> {
158170

159171
if (!zipFile.IsFile()) {
160172
throw new Error('\'' + zipFile.path + '\' is not exist');
161173
}
162174

163-
if (platform.osType() != 'win32' && zipFile.suffix.startsWith('tar')) {
175+
if (this._is_tar(zipFile.name)) {
164176
return this._unzip_tar(zipFile, outDir);
165177
} else {
166178
return this._unzip_zip_7z(zipFile, outDir);
@@ -174,15 +186,15 @@ export class SevenZipper {
174186
}
175187

176188
// use tar
177-
if (platform.osType() != 'win32' && zipFile.suffix.startsWith('tar')) {
189+
if (this._is_tar(zipFile.name)) {
178190

179191
let paramList: string[] = [];
180192

181193
paramList.push('-xvf');
182194
paramList.push(zipFile.path);
183195
paramList.push('-C', outDir ? outDir.path : zipFile.dir);
184196

185-
return child_process.execFileSync('tar', paramList).toString();
197+
return child_process.execFileSync(this._tar_path(), paramList).toString();
186198
}
187199
// use 7z
188200
else {

src/DebugConfigGenerator.ts

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -196,18 +196,22 @@ class CortexDebugConfigProvider extends IDebugConfigProvider {
196196

197197
else if ('openocd' == debugConfig.servertype) {
198198
const openocdConf = <OpenOCDFlashOptions>JSON.parse(JSON.stringify(prjConfig.uploadConfig));
199+
const cfgs: string[] = [];
199200

200-
if (!openocdConf.interface.startsWith('${workspaceFolder}/')) {
201-
openocdConf.interface = `interface/${openocdConf.interface}`;
201+
if (openocdConf.interface) {
202+
if (!openocdConf.interface.startsWith('${workspaceFolder}/')) {
203+
openocdConf.interface = `interface/${openocdConf.interface}`;
204+
}
205+
cfgs.push(`${openocdConf.interface}.cfg`);
202206
}
203-
if (!openocdConf.target.startsWith('${workspaceFolder}/')) {
204-
openocdConf.target = `target/${openocdConf.target}`;
207+
if (openocdConf.target) {
208+
if (!openocdConf.target.startsWith('${workspaceFolder}/')) {
209+
openocdConf.target = `target/${openocdConf.target}`;
210+
}
211+
cfgs.push(`${openocdConf.target}.cfg`);
205212
}
206213

207-
debugConfig.configFiles = [
208-
`${openocdConf.interface}.cfg`,
209-
`${openocdConf.target}.cfg`
210-
];
214+
debugConfig.configFiles = cfgs;
211215
}
212216

213217
else if ('jlink' == debugConfig.servertype) {

0 commit comments

Comments
 (0)