From b0d09aa7f43b70915c9ea258c53e51b72340d56b Mon Sep 17 00:00:00 2001 From: Shashank M Date: Sun, 5 Jul 2026 12:07:04 +0530 Subject: [PATCH 01/11] targetconfigs ccxml file addition in phase1 --- .../references/device-migration/phase-1-import.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/skills/c2000-idea/references/device-migration/phase-1-import.md b/docs/skills/c2000-idea/references/device-migration/phase-1-import.md index a8ee4ec..4a656e8 100644 --- a/docs/skills/c2000-idea/references/device-migration/phase-1-import.md +++ b/docs/skills/c2000-idea/references/device-migration/phase-1-import.md @@ -113,6 +113,12 @@ The starter project location depends on the target device: (e.g., `myApp_f28003x` → `myApp_f28p55x`, not `myApp_f28003x_f28p55x`). - This gives the target project a stable, unique name. +## 1.7a Copy target configuration files + +- If the renamed project has no `targetConfigs` folder: create it, then copy all `.ccxml` files from `/device_support//common/targetConfigs/` into it. +- If `targetConfigs` already exists: check if any `.ccxml` file inside it has the target device name in its filename. If yes, skip. If no such file exists, copy all `.ccxml` files from `/device_support//common/targetConfigs/` into it. +Do not ask the user — perform both cases automatically. + ## 1.8 Rebuild after rename - Call `buildProject` again on the **renamed** project. From c6c80ccff53f0fdb144a2c5a4dde4aee7a693a00 Mon Sep 17 00:00:00 2001 From: Shashank M Date: Sun, 5 Jul 2026 12:41:00 +0530 Subject: [PATCH 02/11] all mcp related commands along with registering with agent - added in mcp server extension UI --- src/mcp/mcp-status-bar.ts | 35 +++++++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-) diff --git a/src/mcp/mcp-status-bar.ts b/src/mcp/mcp-status-bar.ts index 18e00f4..9f19979 100644 --- a/src/mcp/mcp-status-bar.ts +++ b/src/mcp/mcp-status-bar.ts @@ -3,6 +3,7 @@ import { isRunning as isIdeaMcpRunning } from './idea-mcp'; import { isRunning as isTiAsmMcpRunning } from './ti-asm-mcp'; import { IDEA_MCP_VSCODE_CONFIG } from './idea-mcp-config'; import { MCP_VSCODE_CONFIG } from './ti-asm-mcp-config'; +import { SKILL_VSCODE_CONFIG } from '../skills/ti-asm-skills-config'; const POLL_INTERVAL_MS = 2000; @@ -15,16 +16,23 @@ const ASM_MCP_ENABLE_CMD = `${MCP_VSCODE_CONFIG}.enableTiAsmMcp`; const ASM_MCP_DISABLE_CMD = `${MCP_VSCODE_CONFIG}.disableTiAsmMcp`; const TOGGLE_CMD = `${IDEA_MCP_VSCODE_CONFIG}.mcpStatusBarToggle`; -/** QuickPick row carrying a server discriminator so we branch on identity, not label text. */ +/** QuickPick row — toggle items carry a server discriminator; register items carry a cmd string. */ interface McpServerPick extends vscode.QuickPickItem { - server: 'idea' | 'asm'; + server?: 'idea' | 'asm'; + cmd?: string; } function dot(running: boolean): string { return running ? '$(circle-filled)' : '$(circle-outline)'; } -/** QuickPick listing both MCP servers — select one to toggle it. */ +function recentTag(key: string, lastKey: string | undefined): string { + return key === lastKey ? ' $(history) recently used' : ''; +} + +let lastPickedKey: string | undefined; + +/** QuickPick listing both MCP servers — select one to toggle it, or choose a registration action. */ async function showTogglePick(): Promise { const ideaRunning = isIdeaMcpRunning(); const asmRunning = isTiAsmMcpRunning(); @@ -40,6 +48,22 @@ async function showTogglePick(): Promise { label: `${dot(asmRunning)} ${ASM_MCP_LABEL}`, description: asmRunning ? 'Running — click to disable' : 'Stopped — click to enable', }, + { kind: vscode.QuickPickItemKind.Separator, label: 'Register' }, + { + cmd: `${IDEA_MCP_VSCODE_CONFIG}.registerIdeaMcp`, + label: '$(plug) Register IDEA MCP', + description: 'Register IDEA MCP with your agent tool' + recentTag('registerIdeaMcp', lastPickedKey), + }, + { + cmd: `${MCP_VSCODE_CONFIG}.registerTiAsmMcp`, + label: '$(plug) Register TI ASM MCP', + description: 'Register TI ASM MCP with your agent tool' + recentTag('registerTiAsmMcp', lastPickedKey), + }, + { + cmd: `${SKILL_VSCODE_CONFIG}.registerSkills`, + label: '$(plug) Register Skills', + description: 'Register C2000-IDEA skills with your agent tool' + recentTag('registerSkills', lastPickedKey), + }, ]; const picked = await vscode.window.showQuickPick(items, { @@ -49,7 +73,10 @@ async function showTogglePick(): Promise { if (!picked) { return; } - if (picked.server === 'idea') { + if (picked.cmd) { + lastPickedKey = picked.cmd.split('.').pop(); + await vscode.commands.executeCommand(picked.cmd); + } else if (picked.server === 'idea') { await vscode.commands.executeCommand(ideaRunning ? IDEA_MCP_DISABLE_CMD : IDEA_MCP_ENABLE_CMD); } else { await vscode.commands.executeCommand(asmRunning ? ASM_MCP_DISABLE_CMD : ASM_MCP_ENABLE_CMD); From 228b4b0fbde5856b4030ca348e92eb7a980105ac Mon Sep 17 00:00:00 2001 From: Shashank M Date: Sun, 5 Jul 2026 12:47:37 +0530 Subject: [PATCH 03/11] C2000WARE_DLIB_ROOT warning corresponding fix --- .../references/device-migration/phase-2-settings.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/skills/c2000-idea/references/device-migration/phase-2-settings.md b/docs/skills/c2000-idea/references/device-migration/phase-2-settings.md index 895205d..6b536a9 100644 --- a/docs/skills/c2000-idea/references/device-migration/phase-2-settings.md +++ b/docs/skills/c2000-idea/references/device-migration/phase-2-settings.md @@ -66,6 +66,12 @@ found (source value vs. target value) and what you plan to apply. that component with the target device name and verify the resulting path exists on disk. - Apply settings from the source to the target, after confirmation. +**After applying include paths — macro resolution check (required):** + +For every `${MACRO_NAME}` referenced in the applied include paths, check if that macro is defined in the target project. If missing, copy its definition from the source project, replace the source device name in the value with the target device name, and add it to **all build configurations** in the target project. Record each added macro in `c2000-migration.md`. + +> **Example:** Source defines `C2000WARE_DLIB_ROOT = ${COM_TI_C2000WARE_INSTALL_DIR}/driverlib/f28003x/driverlib/`. The universal target starter does not have this macro, so the include path `--include_path="${C2000WARE_DLIB_ROOT}"` would expand to nothing. Add it to the target project as `C2000WARE_DLIB_ROOT = ${COM_TI_C2000WARE_INSTALL_DIR}/driverlib/f28p551x/driverlib/`. + ## 2.4 Linker flags - Use `getToolFlags` with toolType of `linker` to get all of the linker settings. From e4ab2f5f1d9bdc24674f07285a5b3137b7a01176 Mon Sep 17 00:00:00 2001 From: Shashank M Date: Sun, 5 Jul 2026 14:26:14 +0530 Subject: [PATCH 04/11] Wire folder exclusion to IDEA MCP, fix 6 migration scan bugs, add Register commands to MCP status bar, and enhance migration phases with ccxml/macro/build-dir steps --- .../c2000-idea/references/device-migration.md | 1 + .../device-migration/phase-4-migrate-code.md | 5 +++ src/mcp/idea-mcp-config.ts | 3 +- src/mcp/idea-mcp.ts | 45 ++++++++++++++++--- src/migration.ts | 45 ++++++++----------- src/utilities/project.ts | 6 +++ src/utilities/utils.ts | 32 +++++-------- 7 files changed, 85 insertions(+), 52 deletions(-) diff --git a/docs/skills/c2000-idea/references/device-migration.md b/docs/skills/c2000-idea/references/device-migration.md index 8657954..bfda4a8 100644 --- a/docs/skills/c2000-idea/references/device-migration.md +++ b/docs/skills/c2000-idea/references/device-migration.md @@ -40,6 +40,7 @@ Call `list_migration_devices()` from IDEA MCP immediately after collecting input **idea-mcp** (required): - `get_projects()` — detect projects, current device, configured migration devices - `list_migration_devices()` — supported migration device families +- `set_project_migration_folder_exceptions()` — set folder/file exclusions for the project migration report. Called once in Phase 4 before `get_project_migration_report()` to exclude the build output folder. Paths are relative to the project root. - `get_project_migration_report()` — run migration analysis across the whole project in one call. Called **once** at the start of Phase 4 to size the work and report total scope. - `get_device_migration_report()` — run migration analysis on a single source file. Called diff --git a/docs/skills/c2000-idea/references/device-migration/phase-4-migrate-code.md b/docs/skills/c2000-idea/references/device-migration/phase-4-migrate-code.md index 49641d5..74be518 100644 --- a/docs/skills/c2000-idea/references/device-migration/phase-4-migrate-code.md +++ b/docs/skills/c2000-idea/references/device-migration/phase-4-migrate-code.md @@ -89,6 +89,11 @@ target project name appears in the result. If it does not, call `get_projects(re once, then retry. Do not call `get_project_migration_report` until the target project is confirmed present. +**Set build directory exclusion before running the report:** +1. Call `getProjectDescriptors` requesting only `["location", "buildDirectoryLocation"]` on the target project. +2. Strip the `location` value (plus its trailing `/`) from the start of `buildDirectoryLocation` to get the relative path (e.g. `CPU1_RAM`). +3. Check `migrationFolderExceptions` from `get_projects()` for the target project. If the relative build directory path is not already in the list, call `set_project_migration_folder_exceptions` with it to exclude the build output folder and all files inside it from the migration scan. + Call `get_project_migration_report(, , [])`, passing the source and target devices from `c2000-migration.md` (matching the `list_migration_devices()` entries) so the report reflects the intended migration pair rather diff --git a/src/mcp/idea-mcp-config.ts b/src/mcp/idea-mcp-config.ts index 346c82f..b57a81a 100644 --- a/src/mcp/idea-mcp-config.ts +++ b/src/mcp/idea-mcp-config.ts @@ -1,7 +1,7 @@ import { migrationRunMigrationCheckOnUri, migrationRunMigrationCheckOnProject, exportMigrationAgentReport, exportProjectMigrationAgentReport } from '../migration'; import { registerBitfieldToDriverlibMigrationOnUri, exportRegisterBitfieldAgentReport } from '../register'; import { DEVICE_LIST } from '../deviceData'; -import { getProjects, allProjectInfos, updateProjectCurrentDevice, updateProjectMigrationDevices } from '../utilities/project'; +import { getProjects, allProjectInfos, updateProjectCurrentDevice, updateProjectMigrationDevices, updateProjectMigrationFolderExceptions } from '../utilities/project'; export const IDEA_MCP_PLATFORM = 'C2000'; export const IDEA_MCP_SERVER_NAME = 'idea-mcp'; @@ -23,4 +23,5 @@ export const IDEA_MCP_HANDLERS = { getAllProjectInfos: () => allProjectInfos, setProjectCurrentDevice: updateProjectCurrentDevice, setProjectMigrationDevices: updateProjectMigrationDevices, + setProjectMigrationFolderExceptions: updateProjectMigrationFolderExceptions, }; diff --git a/src/mcp/idea-mcp.ts b/src/mcp/idea-mcp.ts index 60be7a7..f67abf8 100644 --- a/src/mcp/idea-mcp.ts +++ b/src/mcp/idea-mcp.ts @@ -70,21 +70,23 @@ export function checkMcp() { const SERVER_INSTRUCTIONS = `${IDEA_MCP_PLATFORM} development assistant. Provides project discovery, device-to-device migration analysis, and bitfield-to-driverlib migration analysis for ${IDEA_MCP_PLATFORM} MCU projects. AVAILABLE TOOLS: -- get_projects() — Discover projects in the workspace with their device info and paths. +- get_projects() — Discover projects in the workspace with their device info, paths, and current folder exclusions (migrationFolderExceptions). - set_project_current_device() — Manually set a project's current (source) device for migration when the auto-detected device is wrong. - set_project_migration_devices() — Set a project's target (migration) device list for device-to-device migration. +- set_project_migration_folder_exceptions() — Set folder/file exclusions for the project migration report. Paths are relative to the project root. Call this before get_project_migration_report() to exclude build output folders and SysConfig-generated folders. - list_migration_devices() — Get all supported device families for migration. - get_project_migration_report() — Run a device-to-device migration check on ALL files in a project and get a complete multi-file report. Use this for project-level migration. - get_device_migration_report() — Run a device-to-device migration check on a single source file. Use this when you need per-file control (e.g. fixing one file at a time after a project report). - get_bitfield_to_driverlib_migration_report() — Run a bitfield-to-driverlib migration check on a source file. Scans for legacy bitfield register accesses and suggests driverlib function replacements. RECOMMENDED FLOW: -1. Call get_projects() to discover projects, their current devices, and migration targets. If the list is empty or the project you are looking for is missing, call get_projects(rescan: true) once to re-scan the workspace. +1. Call get_projects() to discover projects, their current devices, migration targets, and current folder exclusions (migrationFolderExceptions). 2. For device-to-device migration (project level — preferred): a. Call list_migration_devices() if you need to verify or select device names. - b. Call get_project_migration_report() with the project name to analyze all files at once. - c. Issues marked "Auto-fixable" have a concrete code replacement you can apply directly. Issues marked "Needs manual review" require reading the linked migration guide. - d. After fixing files, call get_device_migration_report() on individual files to verify the fixes are clean. + b. Check migrationFolderExceptions from get_projects(). If the build output folder and SysConfig-generated folder are not already excluded, call set_project_migration_folder_exceptions() with those relative paths before running the report. + c. Call get_project_migration_report() with the project name to analyze all files at once. + d. Issues marked "Auto-fixable" have a concrete code replacement you can apply directly. Issues marked "Needs manual review" require reading the linked migration guide. + e. After fixing files, call get_device_migration_report() on individual files to verify the fixes are clean. 3. For bitfield-to-driverlib migration: a. Use get_projects() to get the project's currentDevice. b. Call get_bitfield_to_driverlib_migration_report() with the file path and sourceDevice. @@ -152,6 +154,7 @@ function createMcpServerInstance(): McpServer { deviceVariant: p.deviceVariant, currentDevice: p.migrationState.currentDevice, migrationDevices: p.migrationState.migrationDevices, + migrationFolderExceptions: p.migrationState.migrationCheckFolderExceptions || [], hasResumeLog: fs.existsSync(resumeLogPath), }; }); @@ -231,6 +234,38 @@ Any entry equal to the project's current device is dropped automatically (you ca ); } + if (IDEA_MCP_HANDLERS.setProjectMigrationFolderExceptions && IDEA_MCP_HANDLERS.getAllProjectInfos) { + const setFolderExceptions = IDEA_MCP_HANDLERS.setProjectMigrationFolderExceptions; + const getAllProjectInfos = IDEA_MCP_HANDLERS.getAllProjectInfos; + + server.registerTool( + 'set_project_migration_folder_exceptions', + { + description: `Set the folder/file exclusion list for a ${IDEA_MCP_PLATFORM} project's migration report. Paths in this list are skipped when get_project_migration_report scans the project — use this to exclude build output folders, SysConfig-generated file folders, or any other paths that should not be analysed. Paths are relative to the project root. Pass an empty array to clear all exclusions.`, + inputSchema: { + projectName: z.string().describe('Project name from get_projects(). Identifies which project to update.'), + folderExceptions: z.array(z.string()).describe('Relative paths (from project root) to exclude from migration scanning. Can be folders or individual .c/.h files. Pass an empty array to clear all exclusions. Examples: ["CPU1_FLASH", "syscfg"]'), + } as any, + }, + async ({ projectName, folderExceptions }: any) => { + const projects = getAllProjectInfos(); + const projectInfo = projects.find((p: any) => p.name === projectName); + if (!projectInfo) { + return { content: [{ type: 'text' as const, text: `Project "${projectName}" not found. Call get_projects() to list available projects.` }] }; + } + + setFolderExceptions(projectInfo, folderExceptions); + + const applied = projectInfo.migrationState.migrationCheckFolderExceptions || []; + if (applied.length === 0) { + return { content: [{ type: 'text' as const, text: `Cleared all migration folder exceptions for project "${projectName}".` }] }; + } + + return { content: [{ type: 'text' as const, text: `Set migration folder exceptions for project "${projectName}" to [${applied.join(', ')}].` }] }; + } + ); + } + if (IDEA_MCP_HANDLERS.runMigrationCheck && IDEA_MCP_HANDLERS.generateMigrationReport) { const runCheck = IDEA_MCP_HANDLERS.runMigrationCheck; const genReport = IDEA_MCP_HANDLERS.generateMigrationReport; diff --git a/src/migration.ts b/src/migration.ts index 8d8727b..e46d6b5 100644 --- a/src/migration.ts +++ b/src/migration.ts @@ -560,9 +560,9 @@ export async function migrationRunMigrationCheckOnProject(context: vscode.Extens var projectUri = projectInfo.uri; const projectFsPath = projectUri.fsPath || projectUri.path; var projectFsPathUri = vscode.Uri.file(projectFsPath); - var projectCCodeUris = await utils.getFileTypesInFolder(projectFsPathUri, [".c", ".h"]); + var projectCCodeUris = await utils.getFileTypesInFolder(projectFsPathUri, [".c", ".h"]); var projectCCodeUrisIgnored = await utils.getIgnoredProjectCCodeUris(projectFsPath, projectInfo.migrationState.migrationCheckFolderExceptions || []); - + migrationCodeActions = []; migrationCodeLenses = []; migrationDiagnosticsCollection.clear(); @@ -572,37 +572,30 @@ export async function migrationRunMigrationCheckOnProject(context: vscode.Extens progress.report({ increment: 0, message: "Starting migration check..." }); } - const totalFilesafterignoring = (projectCCodeUris.length - projectCCodeUrisIgnored.length); + const ignoredUriSet = new Set(projectCCodeUrisIgnored.map(uri => uri.toString())); + const filesToProcess = projectCCodeUris.filter(uri => !ignoredUriSet.has(uri.toString())); + const totalFilesafterignoring = filesToProcess.length; outputChannel.appendLine("Total Project Files :"+ projectCCodeUris.length); outputChannel.appendLine("Total Project Files to Migrate:"+ totalFilesafterignoring); - if(totalFilesafterignoring < 0){ - vscode.window.showErrorMessage("Error: " + projectName + " - Wrong info on Migration Check Folders and Files Exception"); - return; - } - - let migrationFilesIndex = 0; - for (let projectCCodeUrisIndex = 0; projectCCodeUrisIndex < projectCCodeUris.length; projectCCodeUrisIndex++) { + for (let migrationFilesIndex = 0; migrationFilesIndex < filesToProcess.length; migrationFilesIndex++) { if (token?.isCancellationRequested) { outputChannel.appendLine("Migration check was cancelled."); vscode.window.showInformationMessage("Migration check cancelled on " + projectName + " project"); - return; + return; } - var ccodeUri = projectCCodeUris[projectCCodeUrisIndex]; - if(!(projectCCodeUrisIgnored.map(uri => uri.toString()).includes(ccodeUri.toString()))){ - try { - outputChannel.appendLine(`Processing file: ${ccodeUri.fsPath}`); - await migrationRunMigrationCheckOnUri(context, ccodeUri, currentDevice, migrationDevices); - outputChannel.appendLine(`Migration Time taken: ${lastMigrationCheckTimestampPerURI[ccodeUri.fsPath] || "N/A"} seconds`); - const increment = Math.round(((1) / totalFilesafterignoring) * 100); - const incrementStatus = Math.round(((migrationFilesIndex + 1) / totalFilesafterignoring) * 100); - if (progress) { - progress.report({ increment: increment, message: `Processing(${incrementStatus}%) ${ccodeUri.fsPath}` }); - } - } - catch (error) { + const ccodeUri = filesToProcess[migrationFilesIndex]; + try { + outputChannel.appendLine(`Processing file: ${ccodeUri.fsPath}`); + await migrationRunMigrationCheckOnUri(context, ccodeUri, currentDevice, migrationDevices); + outputChannel.appendLine(`Migration Time taken: ${lastMigrationCheckTimestampPerURI[ccodeUri.fsPath] || "N/A"} seconds`); + const increment = Math.round(((1) / totalFilesafterignoring) * 100); + const incrementStatus = Math.round(((migrationFilesIndex + 1) / totalFilesafterignoring) * 100); + if (progress) { + progress.report({ increment: increment, message: `Processing(${incrementStatus}%) ${ccodeUri.fsPath}` }); } - migrationFilesIndex++; + } + catch (error) { } } outputChannel.appendLine(`Migration check completed on ${selectedProject}`); @@ -874,7 +867,7 @@ function migrationFindAllLineNumbersWithCodeChange(documentText: string, allCode } } - return relevantLineNumbers.length > 0 ? relevantLineNumbers.map(lineNumber => lineNumber - 1) : [-1]; + return relevantLineNumbers.map(lineNumber => lineNumber - 1); } diff --git a/src/utilities/project.ts b/src/utilities/project.ts index 349fd7f..9e04e9c 100644 --- a/src/utilities/project.ts +++ b/src/utilities/project.ts @@ -73,6 +73,12 @@ export function addMigrationCheckFolderException(exceptionFolder: string, projec saveProjects(extensionContext); } +export function updateProjectMigrationFolderExceptions(projectInfo: ProjectInfo, folderExceptions: string[]) +{ + projectInfo.migrationState.migrationCheckFolderExceptions = folderExceptions; + saveProjects(extensionContext); +} + export function projectGetCurrentDevice() : string { const projectConfig = vscode.workspace.getConfiguration('c2000-idea.project'); diff --git a/src/utilities/utils.ts b/src/utilities/utils.ts index 9460172..4dc8307 100644 --- a/src/utilities/utils.ts +++ b/src/utilities/utils.ts @@ -277,28 +277,20 @@ export async function getFileTypesInFolder(folderUri : vscode.Uri, fileExtension export async function getIgnoredProjectCCodeUris(projectFsPath: string, migrationCheckFolderExceptions: string[]): Promise { const projectCCodeUrisIgnored: vscode.Uri[] = []; - const outputChannel = vscode.window.createOutputChannel("Ignored Files Output"); // Create output channel - // Convert exceptions to URIs - const ignoredFoldersFiles = migrationCheckFolderExceptions.map(exception => projectFsPath + "/" + exception); - const ignoredFoldersFilesUris = ignoredFoldersFiles.map(exceptionPath => vscode.Uri.file(exceptionPath)); - - for (const ignoredUri of ignoredFoldersFilesUris) { - const ignoredFsPath = ignoredUri.fsPath || ignoredUri.path; - - // Check if the ignored path is a file - if (ignoredFsPath.endsWith(".c") || ignoredFsPath.endsWith(".h")) { - projectCCodeUrisIgnored.push(ignoredUri); - outputChannel.appendLine(`Ignored file: ${ignoredFsPath}`); - } else { - // It's a folder, retrieve its .c and .h files - const projectCCodeUrisFolder = await getFileTypesInFolder(ignoredUri, [".c", ".h"]); - projectCCodeUrisIgnored.push(...projectCCodeUrisFolder); - outputChannel.appendLine(`Ignored folder: ${ignoredFsPath}`); - } + + for (const exception of migrationCheckFolderExceptions) { + const ignoredUri = vscode.Uri.file(path.join(projectFsPath, exception)); + const ignoredFsPath = ignoredUri.fsPath; + + if (ignoredFsPath.endsWith(".c") || ignoredFsPath.endsWith(".h")) { + projectCCodeUrisIgnored.push(ignoredUri); + } else { + const projectCCodeUrisFolder = await getFileTypesInFolder(ignoredUri, [".c", ".h"]); + projectCCodeUrisIgnored.push(...projectCCodeUrisFolder); + } } - outputChannel.show(); // Show the output channel if needed - return projectCCodeUrisIgnored; // Return the accumulated URIs + return projectCCodeUrisIgnored; } export async function getFileInFoldersRecursive(folderUri : vscode.Uri, fileName : string): Promise From bc6b376869ed94f6b6caf14a2328c6de91faf07d Mon Sep 17 00:00:00 2001 From: Shashank M Date: Sun, 5 Jul 2026 15:33:18 +0530 Subject: [PATCH 05/11] Lnk cmd issue fix while agent gets deviated --- .../references/device-migration/phase-2-settings.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/docs/skills/c2000-idea/references/device-migration/phase-2-settings.md b/docs/skills/c2000-idea/references/device-migration/phase-2-settings.md index 6b536a9..b051d86 100644 --- a/docs/skills/c2000-idea/references/device-migration/phase-2-settings.md +++ b/docs/skills/c2000-idea/references/device-migration/phase-2-settings.md @@ -145,7 +145,12 @@ Port user customizations from the source cmd onto the target device's cmd file: **Write the final CMD file:** -After all decisions are made, write one linker cmd file to the target project: +After all decisions are made, write exactly one linker cmd file to the target project — +the one matching the active build configuration from step 2.0. Do NOT write a second cmd +file for the other configuration; reading both reference files for context does not mean +writing both. Delete any other `_generic_ram_lnk.cmd` or `_generic_flash_lnk.cmd` files +already present in the target project directory — the imported starter ships with both, +and leaving them causes duplicate MEMORY region errors at link time. - For the name of the cmd file created in the target project, match the name with the source project's linker cmd file name (replace any device name mentions with the target device name). From cea7ab82f8e863955325c4b6aa1c6199b565588f Mon Sep 17 00:00:00 2001 From: Shashank M Date: Sun, 5 Jul 2026 15:51:35 +0530 Subject: [PATCH 06/11] Migration approach confusion which need to be listed very prior to file processing --- .../references/device-migration/phase-4-migrate-code.md | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/docs/skills/c2000-idea/references/device-migration/phase-4-migrate-code.md b/docs/skills/c2000-idea/references/device-migration/phase-4-migrate-code.md index 74be518..9633780 100644 --- a/docs/skills/c2000-idea/references/device-migration/phase-4-migrate-code.md +++ b/docs/skills/c2000-idea/references/device-migration/phase-4-migrate-code.md @@ -59,8 +59,7 @@ branch**, not the source device branch. Do not remove or alter existing markers. all argument reordering, added/removed parameters, and type changes. Do not re-derive arguments. -Record the choice in `c2000-migration.md` **under a dedicated section immediately after the -Phase 4 file list**, formatted exactly as follows — the sub-agents read this exact string: +Record the choice in `c2000-migration.md` in a dedicated section. This section MUST be placed BEFORE the Phase 4 file list section. Formatted exactly as follows — the sub-agents read this exact string: ``` ## Phase 4 — Migration Strategy Strategy: Approach 1 (shared #ifdef) @@ -89,11 +88,6 @@ target project name appears in the result. If it does not, call `get_projects(re once, then retry. Do not call `get_project_migration_report` until the target project is confirmed present. -**Set build directory exclusion before running the report:** -1. Call `getProjectDescriptors` requesting only `["location", "buildDirectoryLocation"]` on the target project. -2. Strip the `location` value (plus its trailing `/`) from the start of `buildDirectoryLocation` to get the relative path (e.g. `CPU1_RAM`). -3. Check `migrationFolderExceptions` from `get_projects()` for the target project. If the relative build directory path is not already in the list, call `set_project_migration_folder_exceptions` with it to exclude the build output folder and all files inside it from the migration scan. - Call `get_project_migration_report(, , [])`, passing the source and target devices from `c2000-migration.md` (matching the `list_migration_devices()` entries) so the report reflects the intended migration pair rather From 0f5579abc658a41b2b7ee0f8ff58997a5e15d744 Mon Sep 17 00:00:00 2001 From: Shashank M Date: Mon, 6 Jul 2026 12:21:42 +0530 Subject: [PATCH 07/11] Download html migration link into targte project --- .../device-migration/phase-4-migrate-code.md | 85 +++++++++++++++++++ .../phase-4-sub-agent-briefing.md | 3 + .../device-migration/phase-4a-headers.md | 28 +++--- .../device-migration/phase-4b-sources.md | 28 +++--- .../device-migration/phase-4c-sweep.md | 12 +++ 5 files changed, 125 insertions(+), 31 deletions(-) diff --git a/docs/skills/c2000-idea/references/device-migration/phase-4-migrate-code.md b/docs/skills/c2000-idea/references/device-migration/phase-4-migrate-code.md index 9633780..d996ae9 100644 --- a/docs/skills/c2000-idea/references/device-migration/phase-4-migrate-code.md +++ b/docs/skills/c2000-idea/references/device-migration/phase-4-migrate-code.md @@ -15,8 +15,93 @@ skip the step. Precondition: user application files are already copied into the target project (Step 2.7). +--- + +## Step 4.pre — Download migration guide collateral HTML + +Download the full driverlib diff-report HTML for this migration pair to the **target +project directory** once, so every sub-agent (4A, 4B, 4C) can read it from disk instead +of making a separate network request per symbol. + +### 4.pre.1 — Compute URL and local path + +Read `c2000-migration.md` to get `sourceDevice` and `targetDevice` in **lowercase** +(e.g. `f28003x`, `f28p65x`). Compute SDK version labels based on device families using +the same logic as the IDEA extension: + +| Migration type | `FROM_SDK` | `TO_SDK` | Base URL version | +|---|---|---|---| +| F28x → F28x | `C2000Ware_6_00_00_00` | `C2000Ware_6_00_00_00` | `C2000Ware_6_00_00_00` | +| F28x → F29x | `C2000Ware_5_04_00_00` | `F29H85X-SDK` | `C2000Ware_5_04_00_00` | + +Construct the values: +``` +BASE_URL = https://dev.ti.com/tirex/content//docs/_Migration_Guides/html_pages/ +FILENAME = __vs___driverlib.html +FULL_URL = diff_reports/ +LOCAL_OUT = / +``` + +**Example** (F28003x → F28P65x): +``` +FILENAME = C2000Ware_6_00_00_00_f28003x_vs_C2000Ware_6_00_00_00_f28p65x_driverlib.html +FULL_URL = https://dev.ti.com/tirex/content/C2000Ware_6_00_00_00/docs/C2000Ware_6_00_00_00_Migration_Guides/html_pages/diff_reports/C2000Ware_6_00_00_00_f28003x_vs_C2000Ware_6_00_00_00_f28p65x_driverlib.html +LOCAL_OUT = /C2000Ware_6_00_00_00_f28003x_vs_C2000Ware_6_00_00_00_f28p65x_driverlib.html +``` + +### 4.pre.2 — Run the download + +Run this PowerShell command with the computed values substituted: + +```powershell +powershell -Command " +\$url = '' +\$out = '' +if (-not (Test-Path \$out)) { + Invoke-WebRequest -Uri \$url -OutFile \$out -UseDefaultCredentials -TimeoutSec 60 + Write-Host 'Downloaded' +} else { Write-Host 'Already cached' }" +``` + +`-UseDefaultCredentials` passes the current Windows user's credentials to TI's server +(required when on a corporate network / VPN). `-TimeoutSec 60` aborts on a slow response. + +### 4.pre.3 — Record in c2000-migration.md + +**On success** (prints `Downloaded` or `Already cached`): add this line to `c2000-migration.md`: +``` +Migration guide HTML: +``` + +**On failure** (network error, 404, timeout): the automated download was blocked +(common on corporate networks). Ask the user to download it manually: + +> "The migration guide HTML could not be downloaded automatically. Please open the +> following URL in Chrome or Edge, save the page as: +> +> **URL:** `` +> +> **Save as (exact filename and location):** `` +> +> Once saved, type **done** to continue." + +Wait for the user's confirmation, then verify the file exists at ``. + +- **File found:** record `Migration guide HTML: ` in `c2000-migration.md` and proceed. +- **File not found or user skips:** record `Migration guide HTML: DOWNLOAD FAILED — URL: ` + in `c2000-migration.md`. Sub-agents will fall back to fetching the URL directly. + +Pass the recorded line verbatim in the `Migration guide HTML` field of every sub-agent briefing +(4A, 4B, 4C). Sub-agents use the local file when available and fall back to the URL when not. + +--- + ## Step 4.0 — Strategy and pre-migration report +> **Prerequisite:** Step 4.pre must be complete and `Migration guide HTML` must be +> recorded in `c2000-migration.md` before asking for the migration approach. Every +> sub-agent briefing requires this path. + ### 4.0a Ask the user for migration strategy **Before modifying any files, ask the user:** diff --git a/docs/skills/c2000-idea/references/device-migration/phase-4-sub-agent-briefing.md b/docs/skills/c2000-idea/references/device-migration/phase-4-sub-agent-briefing.md index 01bc22f..808c01e 100644 --- a/docs/skills/c2000-idea/references/device-migration/phase-4-sub-agent-briefing.md +++ b/docs/skills/c2000-idea/references/device-migration/phase-4-sub-agent-briefing.md @@ -39,6 +39,7 @@ Briefing: SDK version : Active build config : ← copy verbatim from c2000-migration.md sysConfigOutputLocation : + Migration guide HTML : ← copy verbatim (path or "DOWNLOAD FAILED — URL: ") Files to migrate (in order): 1. @@ -78,6 +79,7 @@ Briefing: SDK version : Active build config : ← copy verbatim from c2000-migration.md sysConfigOutputLocation : + Migration guide HTML : Deferred-errors context : @@ -112,6 +114,7 @@ Briefing: SDK version : Active build config : sysConfigOutputLocation : + Migration guide HTML : All migrated files (from 4A and 4B): .h files: diff --git a/docs/skills/c2000-idea/references/device-migration/phase-4a-headers.md b/docs/skills/c2000-idea/references/device-migration/phase-4a-headers.md index 39714cb..6083d1c 100644 --- a/docs/skills/c2000-idea/references/device-migration/phase-4a-headers.md +++ b/docs/skills/c2000-idea/references/device-migration/phase-4a-headers.md @@ -98,22 +98,18 @@ The agent must fix **every** issue — easy or complex: ## Reading Migration Collateral links Each issue may include a `Migration Collateral` URL with a `#` anchor. When -no `Suggested fix` is provided, retrieve and parse it: - -1. Fetch the URL directly. -2. If that fails, try `curl`, then `wget`, then download to a temp file. -3. Save the content locally — do not stream large HTML pages. -4. Strip `