diff --git a/src/common/index.ts b/src/common/index.ts index 34c2f47..eaa8669 100644 --- a/src/common/index.ts +++ b/src/common/index.ts @@ -7,6 +7,7 @@ export * from './format'; export * from './notification'; +export * from './peripheral'; export * from './peripheral-sort'; export * from './peripheral-dto'; export * from './utils'; diff --git a/src/common/peripheral.ts b/src/common/peripheral.ts new file mode 100644 index 0000000..1c6c1f5 --- /dev/null +++ b/src/common/peripheral.ts @@ -0,0 +1,12 @@ +/******************************************************************************** + * Copyright (C) 2024 EclipseSource and others. + * + * This program and the accompanying materials are made available under the + * terms of the MIT License as outlined in the LICENSE File + ********************************************************************************/ + +/** + * Those peripheral names will be ignored in the peripheral tree. + * They will not be resolved from the SVD file. + */ +export const IGNORE_PERIPHERAL_NAMES = ['AXBS0', 'CAU3']; diff --git a/src/plugin/peripheral/nodes/peripheral-node.ts b/src/plugin/peripheral/nodes/peripheral-node.ts index 32363b7..9f01516 100644 --- a/src/plugin/peripheral/nodes/peripheral-node.ts +++ b/src/plugin/peripheral/nodes/peripheral-node.ts @@ -121,7 +121,8 @@ export class PeripheralNode extends PeripheralBaseNode { return true; } catch (e) { /* This should never happen */ - const str = `Internal error: Failed to update peripheral ${this.name} after memory reads`; + const msg = (e as Error).message || 'unknown error'; + const str = `Internal error: Failed to update peripheral ${this.name} after memory reads: ${msg}`; if (vscode.debug.activeDebugConsole) { vscode.debug.activeDebugConsole.appendLine(str); } diff --git a/src/plugin/peripheral/tree/peripheral-session-tree.ts b/src/plugin/peripheral/tree/peripheral-session-tree.ts index 090f519..15c2af3 100644 --- a/src/plugin/peripheral/tree/peripheral-session-tree.ts +++ b/src/plugin/peripheral/tree/peripheral-session-tree.ts @@ -7,7 +7,7 @@ import * as vscode from 'vscode'; import { AddrRange } from '../../../addrranges'; -import { NodeSetting, PeripheralNodeSort } from '../../../common'; +import { IGNORE_PERIPHERAL_NAMES, NodeSetting, PeripheralNodeSort } from '../../../common'; import * as manifest from '../../../manifest'; import { PeripheralInspectorAPI } from '../../../peripheral-inspector-api'; import { SVDParser } from '../../../svd-parser'; @@ -149,7 +149,7 @@ export class PeripheralTreeForSession extends PeripheralBaseNode { const provider = this.api.getPeripheralsProvider(svdPath); if (provider) { const enumTypeValuesMap = {}; - const poptions = await provider.getPeripherals(data, { gapThreshold }); + const poptions = (await provider.getPeripherals(data, { gapThreshold })).filter(p => !IGNORE_PERIPHERAL_NAMES.includes(p.name)); peripherials = poptions.map((options) => new PeripheralNode(gapThreshold, options)); peripherials.sort(PeripheralNodeSort.compare); diff --git a/src/svd-parser.ts b/src/svd-parser.ts index 93489ae..5cff5a9 100644 --- a/src/svd-parser.ts +++ b/src/svd-parser.ts @@ -9,7 +9,7 @@ import { parseStringPromise } from 'xml2js'; import { AccessType, EnumerationMap } from './api-types'; -import { PeripheralNodeSort } from './common'; +import { IGNORE_PERIPHERAL_NAMES, PeripheralNodeSort } from './common'; import { EnumeratedValue } from './enumerated-value'; import { PeripheralClusterNode, PeripheralFieldNode, PeripheralNode, PeripheralOrClusterNode, PeripheralRegisterNode } from './plugin/peripheral/nodes'; import { parseDimIndex, parseInteger } from './utils'; @@ -83,7 +83,9 @@ export class SVDParser { svdData.device.peripherals[0].peripheral.forEach((element) => { const name = element.name[0]; - peripheralMap[name] = element; + if (!IGNORE_PERIPHERAL_NAMES.includes(name)) { + peripheralMap[name] = element; + } }); for (const key in peripheralMap) {