Skip to content

Commit

Permalink
Merge pull request #123 from github0null/dev
Browse files Browse the repository at this point in the history
v3.5.2 update (see changelog.md for details)
  • Loading branch information
github0null authored May 9, 2022
2 parents 72342ad + 75d2771 commit c5dedb0
Show file tree
Hide file tree
Showing 10 changed files with 260 additions and 194 deletions.
14 changes: 13 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,18 @@

***

### [v3.5.2]

**Fixed**:
- Duplicated include path items: `.eide/deps` in project.
- Can not parse old version `JLinkDevices.xml`.

**Optimized**:
- Auto provide internal macros for `armcc` compiler by `--list_macros` command.
- Optimize cpptools config provider for `gcc` family compilers.

***

### [v3.5.1]

**Optimized**:
Expand All @@ -28,7 +40,7 @@
**Changed**:
- Remove `extensionDependencies` and built-in auto active extensionDependencies.
- Force use unix path for virtual source path to compat old project.
- Adjust default `project templates repo`, now it's: 'https://github.com/github0null/eide-templates'.
- Adjust default `project templates repo`, now it's: https://github.com/github0null/eide-templates

***

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

> Supported Platforms: **Windows (Windows 7 SP1 and later)**, **Linux x86_64**
An embedded development environment for `8051/AVR/STM8/Cortex-M[0/0+/3/4/7]/RISC-V/Universal-Gcc` on VsCode.
A mcu development environment for `8051/AVR/STM8/Cortex-M[0/0+/3/4/7]/RISC-V/Universal-Gcc` on VsCode.

Provide `8051/AVR/STM8/Cortex-M/RISC-V` project development, compilation, burning and other functions.

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"homepage": "https://github.com/github0null/eide/blob/master/README.md",
"license": "MIT",
"description": "A mcu development environment for 8051/AVR/STM8/Cortex-M/RISC-V",
"version": "3.5.1",
"version": "3.5.2",
"preview": false,
"engines": {
"vscode": "^1.63.0"
Expand Down
9 changes: 6 additions & 3 deletions src/CodeBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ interface MemoryText {
child: MemoryText[];
}

class ARMCodeBuilder extends CodeBuilder {
export class ARMCodeBuilder extends CodeBuilder {

constructor(_project: AbstractProject) {
super(_project);
Expand Down Expand Up @@ -777,10 +777,13 @@ class ARMCodeBuilder extends CodeBuilder {
return sctFile;
}

private getCpuString(cpu: string, hardOption: FloatingHardwareOption): string {
// 用于生成带有浮点类型后缀的 cpu 系列名,用作代号
static genCpuId(cpu: string, hardOption: FloatingHardwareOption): string {

let suffix: string = '';

cpu = cpu.toLowerCase();

switch (hardOption) {
case 'no_dsp':
// nothing
Expand Down Expand Up @@ -859,7 +862,7 @@ class ARMCodeBuilder extends CodeBuilder {
const toolchain = this.project.getToolchain();
const settingManager = SettingManager.GetInstance();

const cpuString = this.getCpuString(
const cpuString = ARMCodeBuilder.genCpuId(
config.compileConfig.cpuType.toLowerCase(), config.compileConfig.floatingPointHardware
);

Expand Down
6 changes: 3 additions & 3 deletions src/DependenceManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

import * as os from 'os';
import * as fs from 'fs';
import * as NodePath from 'path';

import { File } from '../lib/node-utility/File';
import { DeleteDir, DeleteAllChildren } from './Platform';
Expand All @@ -37,7 +38,7 @@ import { ExceptionToMessage } from './Message';
import { AbstractProject } from './EIDEProject';
import { ArrayDelRepetition } from '../lib/node-utility/Utility';

export class DependenceManager extends ManagerInterface {
export class DependenceManager implements ManagerInterface {

static readonly DEPENDENCE_DIR = `.eide/deps`;
static readonly RTE_FILE_NAME = 'RTE_Components.h';
Expand All @@ -53,7 +54,6 @@ export class DependenceManager extends ManagerInterface {
private compUpdateCache: Map<string, string[]>;

constructor(_project: AbstractProject) {
super();
this.project = _project;
this.componentDefines = new Map();
this.compUpdateCache = new Map();
Expand All @@ -62,7 +62,7 @@ export class DependenceManager extends ManagerInterface {
Init() {
const rootDir = this.project.GetRootDir();
this.prjType = this.project.GetConfiguration().config.type;
this.depDir = File.fromArray([rootDir.path, DependenceManager.DEPENDENCE_DIR]);
this.depDir = File.fromArray([rootDir.path, NodePath.normalize(DependenceManager.DEPENDENCE_DIR)]);
this.LoadComponents();
}

Expand Down
38 changes: 20 additions & 18 deletions src/EIDEProject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -777,7 +777,7 @@ export abstract class AbstractProject implements CustomConfigurationProvider {
if (this.isOldVersionProject) {

// rename old 'deps' folder name for old eide version
const depsFolder = new File(this.rootDirWatcher.file.path + File.sep + DependenceManager.DEPENDENCE_DIR);
const depsFolder = File.fromArray([this.rootDirWatcher.file.path, NodePath.normalize(DependenceManager.DEPENDENCE_DIR)]);
if (!depsFolder.IsDir()) { // if 'deps' folder is not exist

// these folder is for old eide version
Expand Down Expand Up @@ -883,15 +883,17 @@ export abstract class AbstractProject implements CustomConfigurationProvider {
this.packManager.Init();
this.dependenceManager.Init();

if (prjConfig.config.type === 'ARM') { // force add `dependence` folder to project and include list
this.dependenceManager.getDependenceRootFolder().CreateDir(false);
prjConfig.addSrcDirAtFirst(this.dependenceManager.getDependenceRootFolder().path);
prjConfig.CustomDep_AddIncDir(this.dependenceManager.getDependenceRootFolder());
}
else { // remove these folders for other mcu project
platform.DeleteDir(this.dependenceManager.getDependenceRootFolder());
prjConfig.RemoveSrcDir(this.dependenceManager.getDependenceRootFolder().path);
prjConfig.CustomDep_RemoveIncDir(this.dependenceManager.getDependenceRootFolder().path);
// auto add deps folder to project
if (this.isNewProject) {
if (prjConfig.config.type === 'ARM') { // force add `dependence` folder to project and include list
this.dependenceManager.getDependenceRootFolder().CreateDir(false);
prjConfig.addSrcDirAtFirst(this.dependenceManager.getDependenceRootFolder().path);
prjConfig.CustomDep_AddIncDir(this.dependenceManager.getDependenceRootFolder());
} else { // remove these folders for other mcu project
platform.DeleteDir(this.dependenceManager.getDependenceRootFolder());
prjConfig.RemoveSrcDir(this.dependenceManager.getDependenceRootFolder().path);
prjConfig.CustomDep_RemoveIncDir(this.dependenceManager.getDependenceRootFolder().path);
}
}
}

Expand Down Expand Up @@ -2177,8 +2179,7 @@ class EIDEProject extends AbstractProject {
// combine HAL folder
if (rePath && rePath.startsWith(DependenceManager.DEPENDENCE_DIR)) {
halFiles = halFiles.concat(group.files);
}
else {
} else {
fileGroups.push(<FileGroup>{
name: File.ToUnixPath(<string>rePath).toUpperCase(),
files: group.files,
Expand Down Expand Up @@ -2539,7 +2540,8 @@ class EIDEProject extends AbstractProject {
// get project includes and defines
const depMerge = prjConfig.GetAllMergeDep();
const defMacros: string[] = ['__VSCODE_CPPTOOL']; // it's for internal force include header
const defLi = defMacros.concat(depMerge.defineList, toolchain.getInternalDefines(builderOpts));
const intrDefs = toolchain.getInternalDefines(<any>prjConfig.config.compileConfig, builderOpts);
const defLi = defMacros.concat(depMerge.defineList, intrDefs);
depMerge.incList = depMerge.incList.concat(this.getSourceIncludeList());

// update includes and defines
Expand Down Expand Up @@ -2676,11 +2678,11 @@ class EIDEProject extends AbstractProject {
return new Promise((resolve) => {
const filePath = platform.realpathSync(uri.fsPath);
const prjRoot = platform.realpathSync(this.GetRootDir().path);
if (filePath.startsWith(prjRoot)) {
resolve(true);
} else {
resolve(this.vSourceList.includes(filePath));
}
resolve(
AbstractProject.headerFilter.test(filePath) ||
filePath.startsWith(prjRoot) ||
this.vSourceList.includes(filePath)
);
});
}

Expand Down
6 changes: 4 additions & 2 deletions src/EIDEProjectExplorer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3511,11 +3511,13 @@ export class ProjectExplorer implements CustomConfigurationProvider {
cfgList.push('riscv');
break;
default:
defList = defList.concat(toolchain.getInternalDefines(builderOpts));
defList = defList.concat(
toolchain.getInternalDefines(<any>prjConfig.config.compileConfig, builderOpts));
break;
}
} else {
defList = defList.concat(toolchain.getInternalDefines(builderOpts));
defList = defList.concat(
toolchain.getInternalDefines(<any>prjConfig.config.compileConfig, builderOpts));
}

if (toolchain.name == 'ANY_GCC' && toolchain.getToolchainPrefix) {
Expand Down
34 changes: 23 additions & 11 deletions src/EIDETypeDefine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ export const EIDE_CONF_VERSION = '3.1';

////////////////////////////////////////////////////////

export abstract class ManagerInterface {
abstract Init(): void;
export interface ManagerInterface {
Init(): void;
}

export interface FileItem {
Expand Down Expand Up @@ -445,7 +445,9 @@ export interface VirtualFolder {
folders: VirtualFolder[];
}

export interface ProjectConfigData<T extends CompileData> {
export interface BuilderConfigData { }

export interface ProjectConfigData<T extends BuilderConfigData> {

name: string;
type: ProjectType;
Expand Down Expand Up @@ -488,7 +490,7 @@ interface ProjectConfigApi {
toRelativePath: (path: string) => string;
}

export class ProjectConfiguration<T extends CompileData>
export class ProjectConfiguration<T extends BuilderConfigData>
extends Configuration<ProjectConfigData<T>, ProjectConfigEvent> {

static readonly BUILD_IN_GROUP_NAME = 'build-in';
Expand Down Expand Up @@ -1537,8 +1539,6 @@ export abstract class ConfigModel<DataType> {
// Compiler Models
//////////////////////////////////////////////////////////////////////////////////

interface CompileData { }

export interface ICompileOptions {
version: number;
beforeBuildTasks?: any[];
Expand All @@ -1558,7 +1558,7 @@ export abstract class CompileConfigModel<T> extends ConfigModel<T> {
this.prjConfigData = config;
}

static getInstance<T extends CompileData>(prjConfigData: ProjectConfigData<any>): CompileConfigModel<T> {
static getInstance<T extends BuilderConfigData>(prjConfigData: ProjectConfigData<any>): CompileConfigModel<T> {
switch (prjConfigData.toolchain) {
case 'SDCC':
return <any>new SdccCompileConfigModel(prjConfigData);
Expand Down Expand Up @@ -1647,7 +1647,8 @@ export interface ARMStorageLayout {

export type FloatingHardwareOption = 'no_dsp' | 'none' | 'single' | 'double';

export interface ArmBaseCompileData extends CompileData {
// deprecated
export interface ArmBaseCompileData extends BuilderConfigData {
cpuType: string;
floatingPointHardware: FloatingHardwareOption;
useCustomScatterFile: boolean;
Expand All @@ -1656,6 +1657,8 @@ export interface ArmBaseCompileData extends CompileData {
options: string;
}

export type ArmBaseBuilderConfigData = ArmBaseCompileData;

/**
* @note We need export this class, becasue we need export internal functions
* */
Expand Down Expand Up @@ -2052,11 +2055,14 @@ class GccCompileConfigModel extends ArmBaseCompileConfigModel {

// -------- RISC-V --------

export interface RiscvCompileData extends CompileData {
// deprecated
export interface RiscvCompileData extends BuilderConfigData {
linkerScriptPath: string;
options: string;
}

export type RiscvBuilderConfigData = RiscvCompileData;

class RiscvCompileConfigModel extends CompileConfigModel<RiscvCompileData> {

GetKeyDescription(key: string): string {
Expand Down Expand Up @@ -2153,11 +2159,14 @@ class RiscvCompileConfigModel extends CompileConfigModel<RiscvCompileData> {

// -------- ANY-GCC ---------

export interface AnyGccCompileData extends CompileData {
// deprecated
export interface AnyGccCompileData extends BuilderConfigData {
linkerScriptPath: string;
options: string;
}

export type AnyGccBuilderConfigData = AnyGccCompileData;

class AnyGccCompileConfigModel extends CompileConfigModel<AnyGccCompileData> {

GetKeyDescription(key: string): string {
Expand Down Expand Up @@ -2254,11 +2263,14 @@ class AnyGccCompileConfigModel extends CompileConfigModel<AnyGccCompileData> {

// -------- 8Bit ----------

export interface C51BaseCompileData extends CompileData {
// deprecated
export interface C51BaseCompileData extends BuilderConfigData {
options: string;
linkerScript?: string;
}

export type C51BuilderConfigData = C51BaseCompileData;

abstract class C51BaseCompileConfigModel extends CompileConfigModel<C51BaseCompileData> {

constructor(config: ProjectConfigData<any>) {
Expand Down
10 changes: 8 additions & 2 deletions src/ResManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -449,13 +449,19 @@ export class ResManager extends events.EventEmitter {

if (file && file.IsFile()) {
const parser = new x2js({
arrayAccessFormPaths: ['DataBase.Device'],
arrayAccessFormPaths: ['DataBase.Device', 'Database.Device'],
attributePrefix: '$'
});

const dom = parser.xml2js<any>(file.Read());

// compat old DataBase version
if (dom.DataBase == undefined && dom.Database) {
dom.DataBase = dom.Database;
}

if (dom.DataBase == undefined || dom.DataBase.Device == undefined) {
throw Error(`'JLinkDevices.xml' format error, aborted ! [path]: '${file.path}'`);
throw Error(`'JLinkDevices.xml' format error, not found 'DataBase' or 'DataBase.Device' xml node !, [path]: '${file.path}'`);
}

const jlinkDevList: any[] = dom.DataBase.Device;
Expand Down
Loading

0 comments on commit c5dedb0

Please sign in to comment.