diff --git a/README.md b/README.md index 55b1dbe..dd3cd09 100644 --- a/README.md +++ b/README.md @@ -71,6 +71,20 @@ Once you have the SVD file, specify the location of it in your `launch.json` usi } ``` +### Extending Peripheral Inspector + +It is possible to extend the Peripheral Inspector with new file extension providers in your VSCode extension. This method will provide reading new file formats and load the peripherals information into the Peripheral Inspector. + +```json +{ + ... + "definitionPath": "${workspaceFolder}/STM32F103." + ... +} +``` + +For more details about the implementation, please check the [Extending Peripheral Inspector](./docs/extending-peripheral-inspector.md) document. + ## Settings All variable key names used to extract data from debug launch configurations can be modified. This allows variable name clashes to be avoided as well as the need to duplicate configuration entries. diff --git a/api.ts b/api.ts new file mode 100644 index 0000000..a3b40f5 --- /dev/null +++ b/api.ts @@ -0,0 +1 @@ +export * from './src/api-types'; diff --git a/docs/extending-peripheral-inspector.md b/docs/extending-peripheral-inspector.md new file mode 100644 index 0000000..7e6188c --- /dev/null +++ b/docs/extending-peripheral-inspector.md @@ -0,0 +1,74 @@ +# Extending Peripheral Inspector + +It is possible to extend the Peripheral Inspector with new file extension providers in your VSCode extension. This method will provide reading new file formats and load the peripherals information into the Peripheral Inspector. + +## Building your VSCode Extension to extend Peripheral Inspector + +This is a guide about how you can register new peripheral providers to Peripheral Inspector in your VSCode extension. Please refer to [VSCode Extension API](https://code.visualstudio.com/api) for more information about developing VSCode extensions. + +### Adding Peripheral Inspector to your VSCode extension + +You need to install eclipse-cdt-cloud/vscode-peripheral-inspector to access the types information. You can use `npm` or `yarn` with the following arguments described below: + +Using with npm: +```bash +npm install github:eclipse-cdt-cloud/vscode-peripheral-inspector +``` +Using with yarn: +```bash +yarn add github:eclipse-cdt-cloud/vscode-peripheral-inspector +``` + +### Developing your extension + +To provide the peripherals information to Peripheral Inspector on debug session time, you need register your command which is going to construct the peripherals information. The command will receive `DebugSession` object as an input parameter and expects to return array of type `PeripheralOptions[]`. + +You can find the example command implementation below: + +```js +import { ExtensionContext } from 'vscode'; +import type * as api from "peripheral-inspector/api"; + + +class MyExtensionProvider implements api.IPeripheralsProvider { + public async getPeripherals (data: string, options: api.IGetPeripheralsArguments): Promise { + // Load your peripherals data + const peripherals: api.PeripheralOptions[] = ... + return peripherals; + } +} + +export async function activate(context: ExtensionContext) { + ... + // Get the eclipse-cdt.peripheral-inspector extension + const peripheralInspectorExtention = extensions.getExtension('eclipse-cdt.peripheral-inspector'); + + // Check if the eclipse-cdt.peripheral-inspector extension is installed + if (peripheralInspectorExtention) { + const peripheralInspectorAPI = await peripheralInspectorExtention.activate(); + + // Invoke registerPeripheralsProvider method in eclipse-cdt.peripheral-inspector extension api + // Register 'MyExtensionProvider' for files *.myext + peripheralInspectorAPI.registerPeripheralsProvider('myext', new MyExtensionProvider()); + } + ... +} +``` + +For further information about the api definitions, review the [Peripheral Inspector API Definitions](../src/api-types.ts). + +### Modifying your package.json + +In `package.json` of your VSCode extension project, you need to define the dependency between Peripheral Inspector and your extension. + +You need to define Peripheral Inspector in the `extensionDependencies` as shown below: + +```json +{ + ... + "extensionDependencies": [ + "eclipse-cdt.peripheral-inspector" + ], + ... +} +``` diff --git a/package.json b/package.json index 65a049c..d3f8364 100644 --- a/package.json +++ b/package.json @@ -18,6 +18,7 @@ "license": "MIT", "main": "dist/desktop/extension.js", "browser": "dist/browser/extension.js", + "types": "dist/desktop/extension.d.ts", "repository": "https://github.com/eclipse-cdt-cloud/vscode-peripheral-inspector", "qna": "https://github.com/eclipse-cdt-cloud/vscode-peripheral-inspector/issues", "icon": "media/cdtcloud.png", diff --git a/src/api-types.ts b/src/api-types.ts new file mode 100644 index 0000000..716bbcb --- /dev/null +++ b/src/api-types.ts @@ -0,0 +1,83 @@ +// Peripheral Inspector API +export interface IPeripheralInspectorAPI { + registerSVDFile: (expression: RegExp | string, path: string) => void; + getSVDFile: (device: string) => string | undefined; + getSVDFileFromCortexDebug: (device: string) => Promise; + registerPeripheralsProvider: (fileExtension: string, provider: IPeripheralsProvider) => void; +} + +export interface IPeripheralsProvider { + getPeripherals: (data: string, options: IGetPeripheralsArguments) => Promise; +} + +export interface IGetPeripheralsArguments { + gapThreshold: number; +} + +export interface PeripheralOptions { + name: string; + baseAddress: number; + totalLength: number; + description: string; + groupName?: string; + accessType?: AccessType; + size?: number; + resetValue?: number; + registers?: PeripheralRegisterOptions[]; + clusters?: ClusterOptions[]; +} + +export interface PeripheralRegisterOptions { + name: string; + description?: string; + addressOffset: number; + accessType?: AccessType; + size?: number; + resetValue?: number; + fields?: FieldOptions[]; +} + +export interface ClusterOptions { + name: string; + description?: string; + addressOffset: number; + accessType?: AccessType; + size?: number; + resetValue?: number; + registers?: PeripheralRegisterOptions[]; + clusters?: ClusterOptions[]; +} + +export interface FieldOptions { + name: string; + description: string; + offset: number; + width: number; + enumeration?: EnumerationMap; + derivedFrom?: string; // Set this if unresolved + accessType?: AccessType; +} + +export interface IGetPeripheralsArguments { + gapThreshold: number; +} + +export interface IPeripheralsProvider { + getPeripherals: (data: string, options: IGetPeripheralsArguments) => Promise; +} + +export declare enum AccessType { + ReadOnly = 1, + ReadWrite = 2, + WriteOnly = 3 +} + +export interface EnumerationMap { + [value: number]: IEnumeratedValue; +} + +export interface IEnumeratedValue { + name: string; + description: string; + value: number; +} diff --git a/src/browser/extension.ts b/src/browser/extension.ts index 5e8131a..1ed19fd 100644 --- a/src/browser/extension.ts +++ b/src/browser/extension.ts @@ -9,21 +9,23 @@ import * as vscode from 'vscode'; import { PeripheralTreeProvider } from '../views/peripheral'; import { Commands } from '../commands'; import { DebugTracker } from '../debug-tracker'; -import { SvdRegistry } from '../svd-registry'; +import { PeripheralInspectorAPI } from '../peripheral-inspector-api'; import { SvdResolver } from '../svd-resolver'; +import { IPeripheralInspectorAPI } from '../api-types'; +export * as api from '../api-types'; -export const activate = async (context: vscode.ExtensionContext): Promise => { +export const activate = async (context: vscode.ExtensionContext): Promise => { const tracker = new DebugTracker(); - const registry = new SvdRegistry(); - const resolver = new SvdResolver(registry); - const peripheralTree = new PeripheralTreeProvider(tracker, resolver, context); + const api = new PeripheralInspectorAPI(); + const resolver = new SvdResolver(api); + const peripheralTree = new PeripheralTreeProvider(tracker, resolver, api, context); const commands = new Commands(peripheralTree); await tracker.activate(context); await peripheralTree.activate(); await commands.activate(context); - return registry; + return api; }; export const deactivate = async (): Promise => { diff --git a/src/desktop/extension.ts b/src/desktop/extension.ts index 5e8131a..1ed19fd 100644 --- a/src/desktop/extension.ts +++ b/src/desktop/extension.ts @@ -9,21 +9,23 @@ import * as vscode from 'vscode'; import { PeripheralTreeProvider } from '../views/peripheral'; import { Commands } from '../commands'; import { DebugTracker } from '../debug-tracker'; -import { SvdRegistry } from '../svd-registry'; +import { PeripheralInspectorAPI } from '../peripheral-inspector-api'; import { SvdResolver } from '../svd-resolver'; +import { IPeripheralInspectorAPI } from '../api-types'; +export * as api from '../api-types'; -export const activate = async (context: vscode.ExtensionContext): Promise => { +export const activate = async (context: vscode.ExtensionContext): Promise => { const tracker = new DebugTracker(); - const registry = new SvdRegistry(); - const resolver = new SvdResolver(registry); - const peripheralTree = new PeripheralTreeProvider(tracker, resolver, context); + const api = new PeripheralInspectorAPI(); + const resolver = new SvdResolver(api); + const peripheralTree = new PeripheralTreeProvider(tracker, resolver, api, context); const commands = new Commands(peripheralTree); await tracker.activate(context); await peripheralTree.activate(); await commands.activate(context); - return registry; + return api; }; export const deactivate = async (): Promise => { diff --git a/src/enumerated-value.ts b/src/enumerated-value.ts new file mode 100644 index 0000000..142dabe --- /dev/null +++ b/src/enumerated-value.ts @@ -0,0 +1,3 @@ +export class EnumeratedValue { + constructor(public name: string, public description: string, public value: number) {} +} diff --git a/src/memreadutils.ts b/src/memreadutils.ts index a11bc24..57d22c8 100644 --- a/src/memreadutils.ts +++ b/src/memreadutils.ts @@ -38,7 +38,7 @@ export class MemUtils { storeTo[dst++] = byte; } } - } catch (e: unknown) { + } catch (e: any) { const err = e ? e.toString() : 'Unknown error'; errors.push(new Error(`readMemory failed @ ${memoryReference} for ${request.count} bytes: ${err}, session=${session.id}`)); } diff --git a/src/svd-registry.ts b/src/peripheral-inspector-api.ts similarity index 67% rename from src/svd-registry.ts rename to src/peripheral-inspector-api.ts index def31a2..eb441cd 100644 --- a/src/svd-registry.ts +++ b/src/peripheral-inspector-api.ts @@ -6,6 +6,7 @@ ********************************************************************************/ import * as vscode from 'vscode'; +import { IPeripheralsProvider, IPeripheralInspectorAPI } from './api-types'; const CORTEX_EXTENSION = 'marus25.cortex-debug'; @@ -14,8 +15,9 @@ interface SVDInfo { path: string; } -export class SvdRegistry { +export class PeripheralInspectorAPI implements IPeripheralInspectorAPI { private SVDDirectory: SVDInfo[] = []; + private PeripheralProviders: Record = {}; public registerSVDFile(expression: RegExp | string, path: string): void { if (typeof expression === 'string') { @@ -38,7 +40,7 @@ export class SvdRegistry { public async getSVDFileFromCortexDebug(device: string): Promise { try { // Try loading from device support pack registered with this extension - const cortexDebug = vscode.extensions.getExtension(CORTEX_EXTENSION); + const cortexDebug = vscode.extensions.getExtension(CORTEX_EXTENSION); if (cortexDebug) { const cdbg = await cortexDebug.activate(); if (cdbg) { @@ -51,4 +53,13 @@ export class SvdRegistry { return undefined; } + + public registerPeripheralsProvider(fileExtension: string, provider: IPeripheralsProvider) { + this.PeripheralProviders[fileExtension] = provider; + } + + public getPeripheralsProvider(svdPath: string) : IPeripheralsProvider | undefined { + const ext = Object.keys(this.PeripheralProviders).filter((extension) => svdPath.endsWith(`.${extension}`))[0]; + return ext ? this.PeripheralProviders[ext] : undefined; + } } diff --git a/src/svd-parser.ts b/src/svd-parser.ts index ff57fe3..0a79cf9 100644 --- a/src/svd-parser.ts +++ b/src/svd-parser.ts @@ -9,15 +9,13 @@ import { PeripheralRegisterNode } from './views/nodes/peripheralregisternode'; import { PeripheralClusterNode, PeripheralOrClusterNode } from './views/nodes/peripheralclusternode'; -import { PeripheralFieldNode, EnumerationMap, EnumeratedValue } from './views/nodes/peripheralfieldnode'; +import { PeripheralFieldNode } from './views/nodes/peripheralfieldnode'; import { PeripheralNode } from './views/nodes/peripheralnode'; import { parseInteger, parseDimIndex } from './utils'; +import { parseStringPromise } from 'xml2js'; +import { AccessType, EnumerationMap } from './api-types'; +import { EnumeratedValue } from './enumerated-value'; -export enum AccessType { - ReadOnly = 1, - ReadWrite, - WriteOnly -} const accessTypeFromString = (type: string): AccessType => { switch (type) { @@ -62,7 +60,8 @@ export class SVDParser { constructor() {} public async parseSVD( - svdData: SvdData, gapThreshold: number): Promise { + data: string, gapThreshold: number): Promise { + const svdData: SvdData = await parseStringPromise(data); this.gapThreshold = gapThreshold; this.enumTypeValuesMap = {}; this.peripheralRegisterMap = {}; @@ -479,3 +478,5 @@ export class SVDParser { return peripheral; } } + + diff --git a/src/svd-resolver.ts b/src/svd-resolver.ts index 0dfc79f..95ec535 100644 --- a/src/svd-resolver.ts +++ b/src/svd-resolver.ts @@ -9,13 +9,13 @@ import * as vscode from 'vscode'; import * as manifest from './manifest'; import { isAbsolute, join, normalize } from 'path'; import { parseStringPromise } from 'xml2js'; -import { SvdRegistry } from './svd-registry'; +import { PeripheralInspectorAPI } from './peripheral-inspector-api'; import { parsePackString, pdscFromPack, fileFromPack, Pack } from './cmsis-pack/pack-utils'; import { PDSC, Device, DeviceVariant, getDevices, getSvdPath, getProcessors } from './cmsis-pack/pdsc'; import { readFromUrl } from './utils'; export class SvdResolver { - public constructor(protected registry: SvdRegistry) { + public constructor(protected api: PeripheralInspectorAPI) { } public async resolve(session: vscode.DebugSession, wsFolderPath?: vscode.Uri): Promise { @@ -45,9 +45,9 @@ export class SvdResolver { } } } else if (deviceName) { - svdPath = this.registry.getSVDFile(deviceName); + svdPath = this.api.getSVDFile(deviceName); if (!svdPath) { - svdPath = await this.registry.getSVDFileFromCortexDebug(deviceName); + svdPath = await this.api.getSVDFileFromCortexDebug(deviceName); } } } catch(e) { diff --git a/src/views/nodes/basenode.ts b/src/views/nodes/basenode.ts index 4dcca61..e6799bb 100644 --- a/src/views/nodes/basenode.ts +++ b/src/views/nodes/basenode.ts @@ -8,7 +8,7 @@ import { Command, TreeItem, DebugSession } from 'vscode'; import { NumberFormat, NodeSetting } from '../../common'; import { AddrRange } from '../../addrranges'; -import { EnumerationMap } from './peripheralfieldnode'; +import { EnumerationMap } from '../../api-types'; export abstract class BaseNode { public expanded: boolean; diff --git a/src/views/nodes/peripheralclusternode.ts b/src/views/nodes/peripheralclusternode.ts index b03cf11..30d8e79 100644 --- a/src/views/nodes/peripheralclusternode.ts +++ b/src/views/nodes/peripheralclusternode.ts @@ -9,20 +9,11 @@ import * as vscode from 'vscode'; import { PeripheralBaseNode, ClusterOrRegisterBaseNode } from './basenode'; import { PeripheralRegisterNode } from './peripheralregisternode'; import { PeripheralNode } from './peripheralnode'; -import { AccessType } from '../../svd-parser'; import { NodeSetting, NumberFormat } from '../../common'; import { AddrRange } from '../../addrranges'; import { hexFormat } from '../../utils'; -import { EnumerationMap } from './peripheralfieldnode'; - -export interface ClusterOptions { - name: string; - description?: string; - addressOffset: number; - accessType?: AccessType; - size?: number; - resetValue?: number; -} +import { AccessType, ClusterOptions, EnumerationMap } from '../../api-types'; + export type PeripheralOrClusterNode = PeripheralNode | PeripheralClusterNode; export type PeripheralRegisterOrClusterNode = PeripheralRegisterNode | PeripheralClusterNode; @@ -46,6 +37,16 @@ export class PeripheralClusterNode extends ClusterOrRegisterBaseNode { this.resetValue = options.resetValue || parent.resetValue; this.children = []; this.parent.addChild(this); + + options.clusters?.forEach((clusterOptions) => { + const cluster = new PeripheralClusterNode(this, clusterOptions); + this.addChild(cluster); + }); + + options.registers?.forEach((registerOptions) => { + const register = new PeripheralRegisterNode(this, registerOptions); + this.addChild(register); + }); } public getTreeItem(): vscode.TreeItem | Promise { diff --git a/src/views/nodes/peripheralfieldnode.ts b/src/views/nodes/peripheralfieldnode.ts index 00bca28..4860b33 100644 --- a/src/views/nodes/peripheralfieldnode.ts +++ b/src/views/nodes/peripheralfieldnode.ts @@ -8,28 +8,10 @@ import * as vscode from 'vscode'; import { PeripheralBaseNode } from './basenode'; import { PeripheralRegisterNode } from './peripheralregisternode'; -import { AccessType } from '../../svd-parser'; import { AddrRange } from '../../addrranges'; import { NumberFormat, NodeSetting } from '../../common'; import { parseInteger, binaryFormat, hexFormat } from '../../utils'; - -export interface EnumerationMap { - [value: number]: EnumeratedValue; -} - -export class EnumeratedValue { - constructor(public name: string, public description: string, public value: number) {} -} - -export interface FieldOptions { - name: string; - description: string; - offset: number; - width: number; - enumeration?: EnumerationMap; - derivedFrom?: string; // Set this if unresolved - accessType?: AccessType; -} +import { AccessType, EnumerationMap, FieldOptions } from '../../api-types'; export class PeripheralFieldNode extends PeripheralBaseNode { public session: vscode.DebugSession | undefined; diff --git a/src/views/nodes/peripheralnode.ts b/src/views/nodes/peripheralnode.ts index ae2ab47..f9444ca 100644 --- a/src/views/nodes/peripheralnode.ts +++ b/src/views/nodes/peripheralnode.ts @@ -12,20 +12,8 @@ import { PeripheralClusterNode, PeripheralRegisterOrClusterNode } from './periph import { AddrRange, AddressRangesUtils } from '../../addrranges'; import { NumberFormat, NodeSetting } from '../../common'; import { MemUtils } from '../../memreadutils'; -import { AccessType } from '../../svd-parser'; import { hexFormat } from '../../utils'; -import { EnumerationMap } from './peripheralfieldnode'; - -export interface PeripheralOptions { - name: string; - baseAddress: number; - totalLength: number; - description: string; - groupName?: string; - accessType?: AccessType; - size?: number; - resetValue?: number; -} +import { AccessType, EnumerationMap, PeripheralOptions } from '../../api-types'; export class PeripheralNode extends PeripheralBaseNode { private children: Array; @@ -54,6 +42,16 @@ export class PeripheralNode extends PeripheralBaseNode { this.size = options.size || 32; this.children = []; this.addrRanges = []; + + options.clusters?.forEach((clusterOptions) => { + const cluster = new PeripheralClusterNode(this, clusterOptions); + this.addChild(cluster); + }); + + options.registers?.forEach((registerOptions) => { + const register = new PeripheralRegisterNode(this, registerOptions); + this.addChild(register); + }); } public getPeripheral(): PeripheralBaseNode { diff --git a/src/views/nodes/peripheralregisternode.ts b/src/views/nodes/peripheralregisternode.ts index d9aec28..bba4008 100644 --- a/src/views/nodes/peripheralregisternode.ts +++ b/src/views/nodes/peripheralregisternode.ts @@ -9,21 +9,12 @@ import * as vscode from 'vscode'; import { PeripheralNode } from './peripheralnode'; import { PeripheralClusterNode } from './peripheralclusternode'; import { ClusterOrRegisterBaseNode, PeripheralBaseNode } from './basenode'; -import { EnumerationMap, PeripheralFieldNode } from './peripheralfieldnode'; +import { PeripheralFieldNode } from './peripheralfieldnode'; import { extractBits, createMask, hexFormat, binaryFormat } from '../../utils'; import { NumberFormat, NodeSetting } from '../../common'; -import { AccessType } from '../../svd-parser'; import { AddrRange } from '../../addrranges'; import { MemUtils } from '../../memreadutils'; - -export interface PeripheralRegisterOptions { - name: string; - description?: string; - addressOffset: number; - accessType?: AccessType; - size?: number; - resetValue?: number; -} +import { AccessType, EnumerationMap, PeripheralRegisterOptions } from '../../api-types'; export class PeripheralRegisterNode extends ClusterOrRegisterBaseNode { public children: PeripheralFieldNode[]; @@ -59,6 +50,10 @@ export class PeripheralRegisterNode extends ClusterOrRegisterBaseNode { this.hexRegex = new RegExp(`^0x[0-9a-f]{1,${this.hexLength}}$`, 'i'); this.children = []; this.parent.addChild(this); + + options.fields?.forEach((fieldOptions) => { + this.addChild(new PeripheralFieldNode(this, fieldOptions)); + }); } public reset(): void { diff --git a/src/views/peripheral.ts b/src/views/peripheral.ts index d452f5d..3fe3a83 100644 --- a/src/views/peripheral.ts +++ b/src/views/peripheral.ts @@ -7,17 +7,17 @@ import * as vscode from 'vscode'; import * as manifest from '../manifest'; -import { parseStringPromise } from 'xml2js'; import { BaseNode, PeripheralBaseNode } from './nodes/basenode'; import { PeripheralNode } from './nodes/peripheralnode'; import { MessageNode } from './nodes/messagenode'; import { NodeSetting } from '../common'; -import { SvdData, SVDParser } from '../svd-parser'; +import { SVDParser } from '../svd-parser'; import { AddrRange } from '../addrranges'; import { DebugTracker } from '../debug-tracker'; import { SvdResolver } from '../svd-resolver'; import { readFromUrl } from '../utils'; import { PeripheralRegisterNode } from './nodes/peripheralregisternode'; +import { PeripheralInspectorAPI } from '../peripheral-inspector-api'; const pathToUri = (path: string): vscode.Uri => { try { @@ -42,6 +42,7 @@ export class PeripheralTreeForSession extends PeripheralBaseNode { constructor( public session: vscode.DebugSession, + protected api: PeripheralInspectorAPI, public state: vscode.TreeItemCollapsibleState, private fireCb: () => void) { super(); @@ -115,10 +116,9 @@ export class PeripheralTreeForSession extends PeripheralBaseNode { } private async createPeripherals(svdPath: string, gapThreshold: number): Promise { - let svdData: SvdData | undefined; - this.errMessage = `Loading ${svdPath} ...`; let fileUri: vscode.Uri | undefined = undefined; + let peripherials: PeripheralNode[] | undefined; try { let contents: ArrayBuffer | undefined; @@ -137,23 +137,38 @@ export class PeripheralTreeForSession extends PeripheralBaseNode { contents = await vscode.workspace.fs.readFile(fileUri); } - if (contents) { - const decoder = new TextDecoder(); - const xml = decoder.decode(contents); - svdData = await parseStringPromise(xml); + if (!contents) { + return; } - } catch(e) { + const decoder = new TextDecoder(); + const data = decoder.decode(contents); + const provider = this.api.getPeripheralsProvider(svdPath); + if (provider) { + const enumTypeValuesMap = {}; + const poptions = await provider.getPeripherals(data, { gapThreshold }); + peripherials = poptions.map((options) => new PeripheralNode(gapThreshold, options)); + peripherials.sort(PeripheralNode.compare); + + for (const p of peripherials) { + p.resolveDeferedEnums(enumTypeValuesMap); // This can throw an exception + p.collectRanges(); + } + } else { + const parser = new SVDParser(); + peripherials = await parser.parseSVD(data, gapThreshold); + } + + } catch(e: any) { this.errMessage = `${svdPath}: Error: ${e ? e.toString() : 'Unknown error'}`; vscode.debug.activeDebugConsole.appendLine(this.errMessage); } - if (!svdData) { + if(!peripherials || peripherials.length === 0) { return; } try { - const parser = new SVDParser(); - this.peripherials = await parser.parseSVD(svdData, gapThreshold); + this.peripherials = peripherials; this.loaded = true; await this.setSession(this.session); if (fileUri) { @@ -164,7 +179,7 @@ export class PeripheralTreeForSession extends PeripheralBaseNode { this.loaded = false; throw e; } - + this.loaded = true; this.errMessage = ''; } @@ -279,7 +294,7 @@ export class PeripheralTreeProvider implements vscode.TreeDataProvider(); protected oldState = new Map (); - constructor(tracker: DebugTracker, protected resolver: SvdResolver, protected context: vscode.ExtensionContext) { + constructor(tracker: DebugTracker, protected resolver: SvdResolver, protected api: PeripheralInspectorAPI, protected context: vscode.ExtensionContext) { tracker.onWillStartSession(session => this.debugSessionStarted(session)); tracker.onWillStopSession(session => this.debugSessionTerminated(session)); tracker.onDidStopDebug(session => this.debugStopped(session)); @@ -359,7 +374,7 @@ export class PeripheralTreeProvider implements vscode.TreeDataProvider { + const regs = new PeripheralTreeForSession(session, this.api, state, () => { this._onDidChangeTreeData.fire(undefined); }); diff --git a/tsconfig.json b/tsconfig.json index aa9655e..20a6e21 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -4,6 +4,8 @@ "module": "commonjs", "strict": true, "sourceMap": true, + "outDir": "dist", + "declaration": true, "lib": [ "dom" ]