@@ -42,6 +42,7 @@ import * as utility from './utility'
4242import { CmdLineHandler } from "./CmdLineHandler" ;
4343import * as yaml from 'yaml' ;
4444import { CodeConverter } from "./CodeConverter" ;
45+ import { jsonc } from "jsonc" ;
4546
4647let resManager : ResManager | undefined ;
4748
@@ -339,9 +340,29 @@ export class ResManager extends events.EventEmitter {
339340 }
340341
341342 getCmsisLibPacks ( ) : { [ name : string ] : File } {
342- return {
343- 'libdsp' : File . fromArray ( [ ( < File > this . GetDir ( 'include' ) ) . path , 'cmsis' , 'dsp_lib.7z' ] )
343+
344+ const cmsisDir = File . fromArray ( [ ( < File > this . GetDir ( 'include' ) ) . path , 'cmsis' ] ) ;
345+ const packages : { [ name : string ] : File } = {
346+ 'libdsp' : File . fromArray ( [ cmsisDir . path , 'dsp_lib.7z' ] )
347+ } ;
348+
349+ const libsDir = File . fromArray ( [ cmsisDir . path , 'libs' ] ) ;
350+ const indexFile = File . fromArray ( [ libsDir . path , 'index.json' ] ) ;
351+ if ( indexFile . IsFile ( ) ) {
352+ try {
353+ const libs = jsonc . parse ( indexFile . Read ( ) ) ;
354+ for ( const key in libs ) {
355+ const libpath = libs [ key ] ;
356+ if ( typeof libpath == 'string' ) {
357+ packages [ key ] = File . fromArray ( [ libsDir . path , libpath ] ) ;
358+ }
359+ }
360+ } catch ( error ) {
361+ // nothing todo
362+ }
344363 }
364+
365+ return packages ;
345366 }
346367
347368 getStvpToolsDir ( ) : File {
0 commit comments