Skip to content

Commit

Permalink
Introduce ignore list for specific peripheral nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
haydar-metin committed Dec 9, 2024
1 parent 8d6b3da commit a467ac3
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/common/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

export * from './format';
export * from './notification';
export * from './peripheral';
export * from './peripheral-sort';
export * from './peripheral-dto';
export * from './utils';
Expand Down
12 changes: 12 additions & 0 deletions src/common/peripheral.ts
Original file line number Diff line number Diff line change
@@ -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'];
3 changes: 2 additions & 1 deletion src/plugin/peripheral/nodes/peripheral-node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
4 changes: 2 additions & 2 deletions src/plugin/peripheral/tree/peripheral-session-tree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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);

Expand Down
6 changes: 4 additions & 2 deletions src/svd-parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit a467ac3

Please sign in to comment.