Skip to content

Commit

Permalink
Merge pull request #373 from github0null/dev
Browse files Browse the repository at this point in the history
v3.19.8 update
  • Loading branch information
github0null authored Sep 8, 2024
2 parents af2f20c + 1127119 commit c340dbc
Show file tree
Hide file tree
Showing 28 changed files with 220 additions and 104 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,19 @@ All notable version changes will be recorded in this file.

***

### [v3.19.8] update

**Fix**:
- `Chip Package`: Storage layout default value missed.
- `Unify Builder`: Fix ac6 linker options missed on macos. Thanks [@Deadline039](https://github.com/Deadline039).

**Optimize**:
- `Unify Builder`: Use 'dotnet unify_builder.dll' instead of 'unify_builder.exe' on arm64 platform.
- `C/C++ Config Provider`: Use g++ when provide compilerPath for cpptools.
- `Other`: Append msys path to the tail of system PATH, not head.

***

### [v3.19.6] update

**Change**:
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Embedded IDE

[![](https://img.shields.io/badge/home_page-em--ide.com-blue)](https://em-ide.com/)
[![](https://img.shields.io/badge/chat-discuss.em--ide.com-orange)](https://discuss.em-ide.com/)
[![](https://img.shields.io/visual-studio-marketplace/v/CL.eide)](https://marketplace.visualstudio.com/items?itemName=CL.eide)
[![](https://img.shields.io/visual-studio-marketplace/i/CL.eide)](https://marketplace.visualstudio.com/items?itemName=CL.eide)
[![](https://img.shields.io/visual-studio-marketplace/stars/CL.eide)](https://marketplace.visualstudio.com/items?itemName=CL.eide&ssr=false#review-details)

***

## [中文](./README_ZH-CN.md)
Expand Down
6 changes: 6 additions & 0 deletions README_ZH-CN.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Embedded IDE

[![](https://img.shields.io/badge/主页-em--ide.com-blue)](https://em-ide.com/)
[![](https://img.shields.io/badge/论坛-discuss.em--ide.com-orange)](https://discuss.em-ide.com/)
[![](https://img.shields.io/visual-studio-marketplace/v/CL.eide)](https://marketplace.visualstudio.com/items?itemName=CL.eide)
[![](https://img.shields.io/visual-studio-marketplace/i/CL.eide)](https://marketplace.visualstudio.com/items?itemName=CL.eide)
[![](https://img.shields.io/visual-studio-marketplace/stars/CL.eide)](https://marketplace.visualstudio.com/items?itemName=CL.eide&ssr=false#review-details)

***

## 简述 📑
Expand Down
2 changes: 1 addition & 1 deletion lib/node-utility
Submodule node-utility updated 1 files
+11 −3 File.ts
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 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.19.6",
"version": "3.19.8",
"preview": false,
"engines": {
"vscode": "^1.67.0"
Expand Down
Binary file modified res/tools/darwin/unify_builder/arm64/axf2elf.dll
Binary file not shown.
4 changes: 2 additions & 2 deletions res/tools/darwin/unify_builder/arm64/unify_builder.deps.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"targets": {
".NETCoreApp,Version=v6.0": {},
".NETCoreApp,Version=v6.0/osx-arm64": {
"unify_builder/3.7.4": {
"unify_builder/3.7.5": {
"dependencies": {
"CommandLineParser": "2.9.1",
"ConsoleTableExt": "3.1.9",
Expand Down Expand Up @@ -60,7 +60,7 @@
}
},
"libraries": {
"unify_builder/3.7.4": {
"unify_builder/3.7.5": {
"type": "project",
"serviceable": false,
"sha512": ""
Expand Down
Binary file modified res/tools/darwin/unify_builder/arm64/unify_builder.dll
Binary file not shown.
Binary file modified res/tools/darwin/unify_builder/x86_64/axf2elf.dll
Binary file not shown.
4 changes: 2 additions & 2 deletions res/tools/darwin/unify_builder/x86_64/unify_builder.deps.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"targets": {
".NETCoreApp,Version=v6.0": {},
".NETCoreApp,Version=v6.0/osx-x64": {
"unify_builder/3.7.4": {
"unify_builder/3.7.5": {
"dependencies": {
"CommandLineParser": "2.9.1",
"ConsoleTableExt": "3.1.9",
Expand Down Expand Up @@ -60,7 +60,7 @@
}
},
"libraries": {
"unify_builder/3.7.4": {
"unify_builder/3.7.5": {
"type": "project",
"serviceable": false,
"sha512": ""
Expand Down
Binary file modified res/tools/darwin/unify_builder/x86_64/unify_builder.dll
Binary file not shown.
Binary file modified res/tools/linux/unify_builder/axf2elf.dll
Binary file not shown.
4 changes: 2 additions & 2 deletions res/tools/linux/unify_builder/unify_builder.deps.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"targets": {
".NETCoreApp,Version=v6.0": {},
".NETCoreApp,Version=v6.0/linux-x64": {
"unify_builder/3.7.4": {
"unify_builder/3.7.5": {
"dependencies": {
"CommandLineParser": "2.9.1",
"ConsoleTableExt": "3.1.9",
Expand Down Expand Up @@ -60,7 +60,7 @@
}
},
"libraries": {
"unify_builder/3.7.4": {
"unify_builder/3.7.5": {
"type": "project",
"serviceable": false,
"sha512": ""
Expand Down
Binary file modified res/tools/linux/unify_builder/unify_builder.dll
Binary file not shown.
Binary file modified res/tools/win32/unify_builder/axf2elf.dll
Binary file not shown.
4 changes: 2 additions & 2 deletions res/tools/win32/unify_builder/unify_builder.deps.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"targets": {
".NETCoreApp,Version=v6.0": {},
".NETCoreApp,Version=v6.0/win-x64": {
"unify_builder/3.7.4": {
"unify_builder/3.7.5": {
"dependencies": {
"CommandLineParser": "2.9.1",
"ConsoleTableExt": "3.1.9",
Expand Down Expand Up @@ -60,7 +60,7 @@
}
},
"libraries": {
"unify_builder/3.7.4": {
"unify_builder/3.7.5": {
"type": "project",
"serviceable": false,
"sha512": ""
Expand Down
Binary file modified res/tools/win32/unify_builder/unify_builder.dll
Binary file not shown.
Binary file modified res/tools/win32/unify_builder/unify_builder.exe
Binary file not shown.
Binary file removed res/tools/win32/unify_builder/unify_builder.zip
Binary file not shown.
8 changes: 3 additions & 5 deletions src/CodeBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ import { ArrayDelRepetition } from "../lib/node-utility/Utility";
import { DependenceManager } from "./DependenceManager";
import { WorkspaceManager } from "./WorkspaceManager";
import { ToolchainName } from "./ToolchainManager";
import { md5, sha256, copyObject } from "./utility";
import { md5, sha256, copyObject, generateDotnetProgramCmd } from "./utility";
import { exeSuffix, osType } from "./Platform";
import { FileWatcher } from "../lib/node-utility/FileWatcher";
import { STVPFlasherOptions } from './HexUploader';
Expand Down Expand Up @@ -322,10 +322,8 @@ export abstract class CodeBuilder {
outDir.CreateDir(true);

// generate command line
const commandLine = CmdLineHandler.getCommandLine(
ResManager.instance().getUnifyBuilderExe().noSuffixName,
this.getCommands()
);
const commandLine = generateDotnetProgramCmd(
ResManager.instance().getUnifyBuilderExe(), this.getCommands());

// if only generate params, exit
if (options?.onlyGenParams) return;
Expand Down
23 changes: 20 additions & 3 deletions src/EIDEProject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2510,6 +2510,9 @@ $(OUT_DIR):
this.registerBuiltinVar('SYS_PathSep', () => platform.osType() != 'win32' ? ':' : ';');
this.registerBuiltinVar('SYS_PathSeparator', () => platform.osType() != 'win32' ? ':' : ';');
this.registerBuiltinVar('SYS_EOL', () => os.EOL);

// eide vars
this.registerBuiltinVar('UnifyBuilderDir', () => ResManager.instance().getUnifyBuilderExe().dir);
}

private RegisterEvent(): void {
Expand Down Expand Up @@ -2816,6 +2819,8 @@ $(OUT_DIR):

public abstract getSourceRefs(file: File): File[];

public abstract getCpptoolsConfig(): CppConfigItem;

//-----------------------------------------------------------

public abstract createBase(option: CreateOptions, createNewPrjFolder?: boolean): BaseProjectInfo;
Expand Down Expand Up @@ -3678,6 +3683,10 @@ class EIDEProject extends AbstractProject {

private __cpptools_updateTimeout: NodeJS.Timeout | undefined;

getCpptoolsConfig(): CppConfigItem {
return <CppConfigItem>deepCloneObject(this.cppToolsConfig);
}

forceUpdateCpptoolsConfig(): void {
this.UpdateCppConfig();
}
Expand Down Expand Up @@ -3944,9 +3953,17 @@ class EIDEProject extends AbstractProject {
// c++ files
else {

let compilerArgs = this.cppToolsConfig.cppCompilerArgs;
const compilerArgs: string[] = [];
const compilerPath = this.getToolchain().getGccFamilyCompilerPathForCpptools('c++');

// We need to tell gcc compiler: this is a c++ file
if (compilerPath) {
compilerArgs.push('-xc++');
}

this.cppToolsConfig.cppCompilerArgs?.forEach(arg => compilerArgs.push(arg));
if (fileArgs) {
compilerArgs = (compilerArgs || []).concat(fileArgs);
fileArgs.forEach(arg => compilerArgs.push(arg));
}

return {
Expand All @@ -3957,7 +3974,7 @@ class EIDEProject extends AbstractProject {
includePath: this.cppToolsConfig.includePath,
defines: this.cppToolsConfig.defines,
forcedInclude: this.cppToolsConfig.forcedInclude,
compilerPath: this.cppToolsConfig.compilerPath,
compilerPath: compilerPath || "",
compilerArgs: compilerArgs
}
};
Expand Down
103 changes: 61 additions & 42 deletions src/EIDEProjectExplorer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ import {
compareVersion,
getGccSystemSearchList,
openocd_getConfigList,
pyocd_getTargetList
pyocd_getTargetList,
generateDotnetProgramCmd
} from './utility';
import { concatSystemEnvPath, DeleteDir, exeSuffix, kill, osType, DeleteAllChildren } from './Platform';
import { KeilARMOption, KeilC51Option, KeilParser, KeilRteDependence } from './KeilXmlParser';
Expand Down Expand Up @@ -2732,7 +2733,7 @@ class ProjectDataProvider implements vscode.TreeDataProvider<ProjTreeItem>, vsco

const compilerOpt = <ArmBaseCompileData>nEideTarget.compileConfig;
compilerOpt.cpuType = guessArmCpuType(eTarget) || 'Cortex-M3';
compilerOpt.floatingPointHardware = /-M[4-9]\d+/.test(compilerOpt.cpuType) ? 'single' : 'none';
compilerOpt.floatingPointHardware = ArmCpuUtils.hasFpu(compilerOpt.cpuType) ? 'single' : 'none';
compilerOpt.useCustomScatterFile = true;
compilerOpt.scatterFilePath = '';

Expand Down Expand Up @@ -3862,50 +3863,68 @@ export class ProjectExplorer implements CustomConfigurationProvider {

private async registerClangdProvider(prj: AbstractProject) {

if (this.cppToolsApi) {
// 如果 cpptools 激活了,则禁用 clangd,防止两个冲突
return;
}
if (this.cppToolsApi)
return; // 如果 cpptools 激活了,则禁用 clangd,防止两个冲突

prj.on('cppConfigChanged', () => {
// todo
});

// ----------------------
// setup clangd config
// ----------------------
try {
let cfg: any = {};
const fclangd = File.fromArray([prj.getProjectRoot().path, '.clangd']);
if (fclangd.IsFile()) {
cfg = yaml.parse(fclangd.Read());
const envs = prj.getProjectVariables();
if (envs['EIDE_CLANGD_PROVIDER_ENABLE'] == '0') {
GlobalEvent.log_info(`ignore update .clangd, because EIDE_CLANGD_PROVIDER_ENABLE=0 is set`);
return;
}
if (!cfg['CompileFlags']) cfg['CompileFlags'] = {};
if (!cfg['CompileFlags']['Add']) cfg['CompileFlags']['Add'] = []
//
cfg['CompileFlags']['CompilationDatabase'] = './' + File.ToUnixPath(prj.getOutputDir());
const toolchain = prj.getToolchain();
const gccLikePath = toolchain.getGccFamilyCompilerPathForCpptools();
if (gccLikePath) { // 仅兼容gcc的编译器
cfg['CompileFlags']['Compiler'] = gccLikePath;
let args: string[] = cfg['CompileFlags']['Add'];
if (/GCC/.test(toolchain.name)) {
let li = getGccSystemSearchList(File.ToLocalPath(gccLikePath));
if (li) {
li.forEach(p => {
args.push(`-I${File.normalize(p)}`);
});
}
} else {
args.push(`-I${toolchain.getToolchainDir().path}/include`);
args.push(`-I${toolchain.getToolchainDir().path}/include/libcxx`);

// ----------------------
// setup clangd config
// ----------------------
try {
let cfg: any = {};
const fclangd = File.fromArray([prj.getProjectRoot().path, '.clangd']);
if (fclangd.IsFile()) {
cfg = yaml.parse(fclangd.Read());
}
cfg['CompileFlags']['Add'] = ArrayDelRepetition(args);
if (!cfg['CompileFlags']) cfg['CompileFlags'] = {};
if (!cfg['CompileFlags']['Add']) cfg['CompileFlags']['Add'] = []
//
cfg['CompileFlags']['CompilationDatabase'] = './' + File.ToUnixPath(prj.getOutputDir());
const toolchain = prj.getToolchain();
const gccLikePath = toolchain.getGccFamilyCompilerPathForCpptools('c++');
if (gccLikePath) { // 仅兼容gcc的编译器
cfg['CompileFlags']['Compiler'] = gccLikePath;
let clangdCompileFlags = <string[]>(cfg['CompileFlags']['Add']);
let compilerArgs = prj.getCpptoolsConfig().cppCompilerArgs;
if (/GCC/.test(toolchain.name)) {
const tRoot = toolchain.getToolchainDir().path;
clangdCompileFlags = clangdCompileFlags.filter(p => !File.isSubPathOf(tRoot, p.substr(2)));
let li = getGccSystemSearchList(File.ToLocalPath(gccLikePath), ['-xc++'].concat(compilerArgs || []));
if (li) {
li.forEach(p => {
clangdCompileFlags.push(`-I${File.normalize(p)}`);
});
}
} else {
clangdCompileFlags.push(`-I${toolchain.getToolchainDir().path}/include`);
clangdCompileFlags.push(`-I${toolchain.getToolchainDir().path}/include/libcxx`);
}
// // add flags
// if (compilerArgs)
// compilerArgs.forEach(arg => clangdCompileFlags.push(arg));
// // add user includes
// prj.getCpptoolsConfig().includePath
// .forEach(path => clangdCompileFlags.push(`-I${path}`));
// // add user defines
// prj.getCpptoolsConfig().defines
// .forEach(d => clangdCompileFlags.push(`-D${d}`));
// del repeat
cfg['CompileFlags']['Add'] = ArrayDelRepetition(clangdCompileFlags);
}
fclangd.Write(yaml.stringify(cfg));
} catch (error) {
GlobalEvent.log_error(error);
}
fclangd.Write(yaml.stringify(cfg));
} catch (error) {
GlobalEvent.log_error(error);
}
});

prj.forceUpdateCpptoolsConfig();
}

// -----------------------------------------
Expand Down Expand Up @@ -4445,8 +4464,8 @@ export class ProjectExplorer implements CustomConfigurationProvider {
paramsFile.Write(JSON.stringify(cmdList));

/* launch */
const exeName = ResManager.GetInstance().getUnifyBuilderExe().noSuffixName;
const commandLine = CmdLineHandler.getCommandLine(exeName, ['-r', paramsFile.path]);
const commandLine = generateDotnetProgramCmd(
ResManager.instance().getUnifyBuilderExe(), ['-r', paramsFile.path]);
runShellCommand('build workspace', commandLine);
}

Expand Down
Loading

0 comments on commit c340dbc

Please sign in to comment.