Skip to content

Commit 75d2771

Browse files
committed
v3.5.2 update (see changelog.md for details)
1 parent ce16e47 commit 75d2771

10 files changed

Lines changed: 260 additions & 194 deletions

CHANGELOG.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,18 @@
44

55
***
66

7+
### [v3.5.2]
8+
9+
**Fixed**:
10+
- Duplicated include path items: `.eide/deps` in project.
11+
- Can not parse old version `JLinkDevices.xml`.
12+
13+
**Optimized**:
14+
- Auto provide internal macros for `armcc` compiler by `--list_macros` command.
15+
- Optimize cpptools config provider for `gcc` family compilers.
16+
17+
***
18+
719
### [v3.5.1]
820

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

3345
***
3446

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

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

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

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
"homepage": "https://github.com/github0null/eide/blob/master/README.md",
3333
"license": "MIT",
3434
"description": "A mcu development environment for 8051/AVR/STM8/Cortex-M/RISC-V",
35-
"version": "3.5.1",
35+
"version": "3.5.2",
3636
"preview": false,
3737
"engines": {
3838
"vscode": "^1.63.0"

src/CodeBuilder.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,7 @@ interface MemoryText {
548548
child: MemoryText[];
549549
}
550550

551-
class ARMCodeBuilder extends CodeBuilder {
551+
export class ARMCodeBuilder extends CodeBuilder {
552552

553553
constructor(_project: AbstractProject) {
554554
super(_project);
@@ -777,10 +777,13 @@ class ARMCodeBuilder extends CodeBuilder {
777777
return sctFile;
778778
}
779779

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

782783
let suffix: string = '';
783784

785+
cpu = cpu.toLowerCase();
786+
784787
switch (hardOption) {
785788
case 'no_dsp':
786789
// nothing
@@ -859,7 +862,7 @@ class ARMCodeBuilder extends CodeBuilder {
859862
const toolchain = this.project.getToolchain();
860863
const settingManager = SettingManager.GetInstance();
861864

862-
const cpuString = this.getCpuString(
865+
const cpuString = ARMCodeBuilder.genCpuId(
863866
config.compileConfig.cpuType.toLowerCase(), config.compileConfig.floatingPointHardware
864867
);
865868

src/DependenceManager.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
import * as os from 'os';
2626
import * as fs from 'fs';
27+
import * as NodePath from 'path';
2728

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

40-
export class DependenceManager extends ManagerInterface {
41+
export class DependenceManager implements ManagerInterface {
4142

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

5556
constructor(_project: AbstractProject) {
56-
super();
5757
this.project = _project;
5858
this.componentDefines = new Map();
5959
this.compUpdateCache = new Map();
@@ -62,7 +62,7 @@ export class DependenceManager extends ManagerInterface {
6262
Init() {
6363
const rootDir = this.project.GetRootDir();
6464
this.prjType = this.project.GetConfiguration().config.type;
65-
this.depDir = File.fromArray([rootDir.path, DependenceManager.DEPENDENCE_DIR]);
65+
this.depDir = File.fromArray([rootDir.path, NodePath.normalize(DependenceManager.DEPENDENCE_DIR)]);
6666
this.LoadComponents();
6767
}
6868

src/EIDEProject.ts

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -777,7 +777,7 @@ export abstract class AbstractProject implements CustomConfigurationProvider {
777777
if (this.isOldVersionProject) {
778778

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

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

886-
if (prjConfig.config.type === 'ARM') { // force add `dependence` folder to project and include list
887-
this.dependenceManager.getDependenceRootFolder().CreateDir(false);
888-
prjConfig.addSrcDirAtFirst(this.dependenceManager.getDependenceRootFolder().path);
889-
prjConfig.CustomDep_AddIncDir(this.dependenceManager.getDependenceRootFolder());
890-
}
891-
else { // remove these folders for other mcu project
892-
platform.DeleteDir(this.dependenceManager.getDependenceRootFolder());
893-
prjConfig.RemoveSrcDir(this.dependenceManager.getDependenceRootFolder().path);
894-
prjConfig.CustomDep_RemoveIncDir(this.dependenceManager.getDependenceRootFolder().path);
886+
// auto add deps folder to project
887+
if (this.isNewProject) {
888+
if (prjConfig.config.type === 'ARM') { // force add `dependence` folder to project and include list
889+
this.dependenceManager.getDependenceRootFolder().CreateDir(false);
890+
prjConfig.addSrcDirAtFirst(this.dependenceManager.getDependenceRootFolder().path);
891+
prjConfig.CustomDep_AddIncDir(this.dependenceManager.getDependenceRootFolder());
892+
} else { // remove these folders for other mcu project
893+
platform.DeleteDir(this.dependenceManager.getDependenceRootFolder());
894+
prjConfig.RemoveSrcDir(this.dependenceManager.getDependenceRootFolder().path);
895+
prjConfig.CustomDep_RemoveIncDir(this.dependenceManager.getDependenceRootFolder().path);
896+
}
895897
}
896898
}
897899

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

25452547
// update includes and defines
@@ -2676,11 +2678,11 @@ class EIDEProject extends AbstractProject {
26762678
return new Promise((resolve) => {
26772679
const filePath = platform.realpathSync(uri.fsPath);
26782680
const prjRoot = platform.realpathSync(this.GetRootDir().path);
2679-
if (filePath.startsWith(prjRoot)) {
2680-
resolve(true);
2681-
} else {
2682-
resolve(this.vSourceList.includes(filePath));
2683-
}
2681+
resolve(
2682+
AbstractProject.headerFilter.test(filePath) ||
2683+
filePath.startsWith(prjRoot) ||
2684+
this.vSourceList.includes(filePath)
2685+
);
26842686
});
26852687
}
26862688

src/EIDEProjectExplorer.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3511,11 +3511,13 @@ export class ProjectExplorer implements CustomConfigurationProvider {
35113511
cfgList.push('riscv');
35123512
break;
35133513
default:
3514-
defList = defList.concat(toolchain.getInternalDefines(builderOpts));
3514+
defList = defList.concat(
3515+
toolchain.getInternalDefines(<any>prjConfig.config.compileConfig, builderOpts));
35153516
break;
35163517
}
35173518
} else {
3518-
defList = defList.concat(toolchain.getInternalDefines(builderOpts));
3519+
defList = defList.concat(
3520+
toolchain.getInternalDefines(<any>prjConfig.config.compileConfig, builderOpts));
35193521
}
35203522

35213523
if (toolchain.name == 'ANY_GCC' && toolchain.getToolchainPrefix) {

src/EIDETypeDefine.ts

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ export const EIDE_CONF_VERSION = '3.1';
7575

7676
////////////////////////////////////////////////////////
7777

78-
export abstract class ManagerInterface {
79-
abstract Init(): void;
78+
export interface ManagerInterface {
79+
Init(): void;
8080
}
8181

8282
export interface FileItem {
@@ -445,7 +445,9 @@ export interface VirtualFolder {
445445
folders: VirtualFolder[];
446446
}
447447

448-
export interface ProjectConfigData<T extends CompileData> {
448+
export interface BuilderConfigData { }
449+
450+
export interface ProjectConfigData<T extends BuilderConfigData> {
449451

450452
name: string;
451453
type: ProjectType;
@@ -488,7 +490,7 @@ interface ProjectConfigApi {
488490
toRelativePath: (path: string) => string;
489491
}
490492

491-
export class ProjectConfiguration<T extends CompileData>
493+
export class ProjectConfiguration<T extends BuilderConfigData>
492494
extends Configuration<ProjectConfigData<T>, ProjectConfigEvent> {
493495

494496
static readonly BUILD_IN_GROUP_NAME = 'build-in';
@@ -1537,8 +1539,6 @@ export abstract class ConfigModel<DataType> {
15371539
// Compiler Models
15381540
//////////////////////////////////////////////////////////////////////////////////
15391541

1540-
interface CompileData { }
1541-
15421542
export interface ICompileOptions {
15431543
version: number;
15441544
beforeBuildTasks?: any[];
@@ -1558,7 +1558,7 @@ export abstract class CompileConfigModel<T> extends ConfigModel<T> {
15581558
this.prjConfigData = config;
15591559
}
15601560

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

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

1650-
export interface ArmBaseCompileData extends CompileData {
1650+
// deprecated
1651+
export interface ArmBaseCompileData extends BuilderConfigData {
16511652
cpuType: string;
16521653
floatingPointHardware: FloatingHardwareOption;
16531654
useCustomScatterFile: boolean;
@@ -1656,6 +1657,8 @@ export interface ArmBaseCompileData extends CompileData {
16561657
options: string;
16571658
}
16581659

1660+
export type ArmBaseBuilderConfigData = ArmBaseCompileData;
1661+
16591662
/**
16601663
* @note We need export this class, becasue we need export internal functions
16611664
* */
@@ -2052,11 +2055,14 @@ class GccCompileConfigModel extends ArmBaseCompileConfigModel {
20522055

20532056
// -------- RISC-V --------
20542057

2055-
export interface RiscvCompileData extends CompileData {
2058+
// deprecated
2059+
export interface RiscvCompileData extends BuilderConfigData {
20562060
linkerScriptPath: string;
20572061
options: string;
20582062
}
20592063

2064+
export type RiscvBuilderConfigData = RiscvCompileData;
2065+
20602066
class RiscvCompileConfigModel extends CompileConfigModel<RiscvCompileData> {
20612067

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

21542160
// -------- ANY-GCC ---------
21552161

2156-
export interface AnyGccCompileData extends CompileData {
2162+
// deprecated
2163+
export interface AnyGccCompileData extends BuilderConfigData {
21572164
linkerScriptPath: string;
21582165
options: string;
21592166
}
21602167

2168+
export type AnyGccBuilderConfigData = AnyGccCompileData;
2169+
21612170
class AnyGccCompileConfigModel extends CompileConfigModel<AnyGccCompileData> {
21622171

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

22552264
// -------- 8Bit ----------
22562265

2257-
export interface C51BaseCompileData extends CompileData {
2266+
// deprecated
2267+
export interface C51BaseCompileData extends BuilderConfigData {
22582268
options: string;
22592269
linkerScript?: string;
22602270
}
22612271

2272+
export type C51BuilderConfigData = C51BaseCompileData;
2273+
22622274
abstract class C51BaseCompileConfigModel extends CompileConfigModel<C51BaseCompileData> {
22632275

22642276
constructor(config: ProjectConfigData<any>) {

src/ResManager.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -449,13 +449,19 @@ export class ResManager extends events.EventEmitter {
449449

450450
if (file && file.IsFile()) {
451451
const parser = new x2js({
452-
arrayAccessFormPaths: ['DataBase.Device'],
452+
arrayAccessFormPaths: ['DataBase.Device', 'Database.Device'],
453453
attributePrefix: '$'
454454
});
455455

456456
const dom = parser.xml2js<any>(file.Read());
457+
458+
// compat old DataBase version
459+
if (dom.DataBase == undefined && dom.Database) {
460+
dom.DataBase = dom.Database;
461+
}
462+
457463
if (dom.DataBase == undefined || dom.DataBase.Device == undefined) {
458-
throw Error(`'JLinkDevices.xml' format error, aborted ! [path]: '${file.path}'`);
464+
throw Error(`'JLinkDevices.xml' format error, not found 'DataBase' or 'DataBase.Device' xml node !, [path]: '${file.path}'`);
459465
}
460466

461467
const jlinkDevList: any[] = dom.DataBase.Device;

0 commit comments

Comments
 (0)