Skip to content

Commit

Permalink
Merge pull request #312 from github0null/dev
Browse files Browse the repository at this point in the history
v3.15.0 update
  • Loading branch information
github0null committed Feb 24, 2024
2 parents a533efa + 53de224 commit 5b5c9c4
Show file tree
Hide file tree
Showing 18 changed files with 718 additions and 248 deletions.
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,27 @@ All notable version changes will be recorded in this file.

***

### [v3.15.0] update

**New**:
- `RightClick Menu`: Add groups for menu

**Optimize**:
- `COSMIC STM8`: Auto select crts*.stm8 library

***

### [v3.14.20240116] revision

**New**:
- `Clangd Support`: Auto generate `.clangd` config for your project. (Only for gcc/clang compiler !)
- `Library Generator Support`: Add libs generator, support archive your obj files after build done.

**Optimize**:
- `OpenOCD Flasher`: Allow select 'None' config.

***

### [v3.14.0] update

**New**:
Expand Down
13 changes: 13 additions & 0 deletions lang/stm8.cosmic.verify.json
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,19 @@
"type": "boolean",
"default": false
},
"crts-initialize": {
"description": "Range Of Variables To Be Initialized",
"type": "string",
"default": "crtsi",
"enum": [
"crtsi",
"crtsx"
],
"enumDescriptions": [
"@near",
"@near and @far"
]
},
"LD_FLAGS": {
"markdownDescription": "Other Linker Options (clnk)",
"$ref": "#/definitions/misc-controls"
Expand Down
441 changes: 247 additions & 194 deletions package.json

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@
"eide.function.reload.jlink.dev.list": "Reload JLink Devices List",
"eide.function.reload.stm8.dev.list": "Reload STM8 Devices List",
"eide.function.reinstall.binaries": "Reinstall eide binaries",
"eide.function.gen_clang_format": "Create new .clang-format template file",
"eide.function.open_libs.yml": "Open Libs Generator Configuration",

"eide.project.show_project_vars": "Show All Project Variables",
"eide.project.save": "Save Project",
"eide.project.refresh": "Refresh",
"eide.project.save.all": "Save All Projects",
"eide.project.active": "Active Project",
"eide.project.close": "Close",
"eide.project.close": "Close Project",
"eide.project.export.template": "Export Eide Project Template",
"eide.project.export.keil": "Export Keil Project",
"eide.project.show.commands": "Show Compiler CommandLine",
Expand All @@ -29,7 +31,7 @@
"eide.project.upload": "Program Flash",
"eide.project.flash.erase.all": "Erase Chip",
"eide.project.modify.files.options": "Show Source Files Extra Compiler Options",
"eide.project.import.ext.project.src.struct": "Import source tree from other projects",
"eide.project.import.ext.project.src.struct": "Import SourceFile Tree From Other Project",
"eide.project.generate_builder_params": "Generate builder.params",

"eide.prj.menus.main.cppcheck": "Static Check",
Expand Down
2 changes: 2 additions & 0 deletions package.nls.zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
"eide.function.reload.jlink.dev.list": "重新加载 JLink 芯片信息列表",
"eide.function.reload.stm8.dev.list": "重新加载 STM8 芯片信息列表",
"eide.function.reinstall.binaries": "重新安装 eide binaries",
"eide.function.gen_clang_format": "新建 .clang-format 代码格式化配置模板",
"eide.function.open_libs.yml": "打开lib生成器配置",

"eide.project.show_project_vars": "显示所有可用的项目变量",
"eide.project.save": "保存项目",
Expand Down
26 changes: 26 additions & 0 deletions res/data/template.libs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
##########################################################################################
# Generate libs for your project
# syntax:
# ---
# <your lib name>:
# - <obj file 1>
# - <obj file 2>
#
# For more syntax, please refer to: https://www.npmjs.com/package/micromatch
#
##########################################################################################

## ----------------------------
## examples
## This examples will generate 2 libs after build done,
## they are: 'app.lib', 'test.lib'
## ----------------------------
#app:
# - '**/src/app.o'
# - '**/src/a.o'
# - '**/src/a/*.o'
#
#test:
# - '**/test/app.o'
# - '**/test/c.o'
# - '**/test/c/*.o'
Binary file modified res/template/cosmic_stm8.ept
Binary file not shown.
38 changes: 20 additions & 18 deletions src/CodeBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,25 +131,8 @@ export abstract class CodeBuilder {
paramsModTime?: number;
} {

const srcList: { path: string, virtualPath?: string; }[] = [];
const srcParams: { [name: string]: string; } = {};
const fGoups = this.project.getFileGroups();
const filter = AbstractProject.getSourceFileFilter();

// filter source files
for (const group of fGoups) {
if (group.disabled) continue; // skip disabled group
for (const source of group.files) {
if (source.disabled) continue; // skip disabled file
if (!filter.some((reg) => reg.test(source.file.path))) continue; // skip non-source
const rePath = this.project.ToRelativePath(source.file.path);
const fInfo: any = { path: rePath || source.file.path }
if (AbstractProject.isVirtualSourceGroup(group)) {
fInfo.virtualPath = `${group.name}/${source.file.name}`;
}
srcList.push(fInfo);
}
}
const srcList: { path: string, virtualPath?: string; }[] = this.project.getAllSources();

// append user options for files
try {
Expand Down Expand Up @@ -483,6 +466,25 @@ export abstract class CodeBuilder {
// handle options
this.preHandleOptions(builderOptions.options);

// gen libs.makefile
const mkfile = File.fromArray([this.project.ToAbsolutePath(outDir), 'libs.makefile']);
const mk_txt = this.project.genLibsMakefileContent(mkfile.name);
if (mk_txt) {
try {
mkfile.Write(mk_txt);
let command: any = {
name: 'make libs',
command: `make --directory=./${outDir} --makefile=./${mkfile.name} all`
};
if (builderOptions.options.afterBuildTasks == undefined)
builderOptions.options.afterBuildTasks = [];
builderOptions.options.afterBuildTasks = [command].concat(builderOptions.options.afterBuildTasks);
} catch (error) {
GlobalEvent.emit('msg', newMessage('Warning', `Generating '${mkfile.name}' failed !`));
GlobalEvent.emit('globalLog', ExceptionToMessage(error, 'Error'));
}
}

// generate hash for compiler options
builderOptions.sha = this.genHashFromCompilerOptions(builderOptions);

Expand Down
20 changes: 16 additions & 4 deletions src/Compress.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export class SevenZipper {
this._event.emit('progress', 20, line);
});

process.Run('tar', paramList);
process.Run(this._tar_path(), paramList);
});
}

Expand Down Expand Up @@ -154,13 +154,25 @@ export class SevenZipper {
});
}

private _is_tar(path: string) {
return /\.tar$|\.tar\./.test(path);
}

private _tar_path(): string {
if (platform.osType() == 'win32') {
return ResManager.instance().getMsysBinToolPath('tar');
} else {
return 'tar';
}
}

Unzip(zipFile: File, outDir?: File): Promise<Error | null> {

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

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

// use tar
if (platform.osType() != 'win32' && zipFile.suffix.startsWith('tar')) {
if (this._is_tar(zipFile.name)) {

let paramList: string[] = [];

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

return child_process.execFileSync('tar', paramList).toString();
return child_process.execFileSync(this._tar_path(), paramList).toString();
}
// use 7z
else {
Expand Down
20 changes: 12 additions & 8 deletions src/DebugConfigGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,18 +196,22 @@ class CortexDebugConfigProvider extends IDebugConfigProvider {

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

if (!openocdConf.interface.startsWith('${workspaceFolder}/')) {
openocdConf.interface = `interface/${openocdConf.interface}`;
if (openocdConf.interface) {
if (!openocdConf.interface.startsWith('${workspaceFolder}/')) {
openocdConf.interface = `interface/${openocdConf.interface}`;
}
cfgs.push(`${openocdConf.interface}.cfg`);
}
if (!openocdConf.target.startsWith('${workspaceFolder}/')) {
openocdConf.target = `target/${openocdConf.target}`;
if (openocdConf.target) {
if (!openocdConf.target.startsWith('${workspaceFolder}/')) {
openocdConf.target = `target/${openocdConf.target}`;
}
cfgs.push(`${openocdConf.target}.cfg`);
}

debugConfig.configFiles = [
`${openocdConf.interface}.cfg`,
`${openocdConf.target}.cfg`
];
debugConfig.configFiles = cfgs;
}

else if ('jlink' == debugConfig.servertype) {
Expand Down

0 comments on commit 5b5c9c4

Please sign in to comment.