File tree Expand file tree Collapse file tree 3 files changed +40
-24
lines changed
Expand file tree Collapse file tree 3 files changed +40
-24
lines changed Original file line number Diff line number Diff line change @@ -196,18 +196,22 @@ class CortexDebugConfigProvider extends IDebugConfigProvider {
196196
197197 else if ( 'openocd' == debugConfig . servertype ) {
198198 const openocdConf = < OpenOCDFlashOptions > JSON . parse ( JSON . stringify ( prjConfig . uploadConfig ) ) ;
199+ const cfgs : string [ ] = [ ] ;
199200
200- if ( ! openocdConf . interface . startsWith ( '${workspaceFolder}/' ) ) {
201- openocdConf . interface = `interface/${ openocdConf . interface } ` ;
201+ if ( openocdConf . interface ) {
202+ if ( ! openocdConf . interface . startsWith ( '${workspaceFolder}/' ) ) {
203+ openocdConf . interface = `interface/${ openocdConf . interface } ` ;
204+ }
205+ cfgs . push ( `${ openocdConf . interface } .cfg` ) ;
202206 }
203- if ( ! openocdConf . target . startsWith ( '${workspaceFolder}/' ) ) {
204- openocdConf . target = `target/${ openocdConf . target } ` ;
207+ if ( openocdConf . target ) {
208+ if ( ! openocdConf . target . startsWith ( '${workspaceFolder}/' ) ) {
209+ openocdConf . target = `target/${ openocdConf . target } ` ;
210+ }
211+ cfgs . push ( `${ openocdConf . target } .cfg` ) ;
205212 }
206213
207- debugConfig . configFiles = [
208- `${ openocdConf . interface } .cfg` ,
209- `${ openocdConf . target } .cfg`
210- ] ;
214+ debugConfig . configFiles = cfgs ;
211215 }
212216
213217 else if ( 'jlink' == debugConfig . servertype ) {
Original file line number Diff line number Diff line change @@ -2638,7 +2638,9 @@ class OpenOCDUploadModel extends UploadConfigModel<OpenOCDFlashOptions> {
26382638 private getConfigList ( configClass : string ) : { name : string , isInWorkspace ?: boolean ; } [ ] | undefined {
26392639
26402640 const openocdExe = new File ( SettingManager . GetInstance ( ) . getOpenOCDExePath ( ) ) ;
2641- const resultList : { name : string , isInWorkspace ?: boolean ; } [ ] = [ ] ;
2641+ const resultList : { name : string , isInWorkspace ?: boolean ; } [ ] = [
2642+ { name : '' } // None
2643+ ] ;
26422644
26432645 // find in workspace
26442646 const wsFolder = WorkspaceManager . getInstance ( ) . getWorkspaceRoot ( ) ;
@@ -2679,11 +2681,18 @@ class OpenOCDUploadModel extends UploadConfigModel<OpenOCDFlashOptions> {
26792681 case 'target' :
26802682 case 'interface' :
26812683 return this . getConfigList ( key ) ?. map ( ( item ) => {
2682- return {
2683- label : `${ item . name } .cfg` ,
2684- val : item . isInWorkspace ? `\${workspaceFolder}/${ item . name } ` : item . name ,
2685- description : item . isInWorkspace ? 'in workspace' : undefined
2686- } ;
2684+ if ( item . name . trim ( ) == '' ) {
2685+ return {
2686+ label : 'None' ,
2687+ val : item . name
2688+ } ;
2689+ } else {
2690+ return {
2691+ label : `${ item . name } .cfg` ,
2692+ val : item . isInWorkspace ? `\${workspaceFolder}/${ item . name } ` : item . name ,
2693+ description : item . isInWorkspace ? 'in workspace' : undefined
2694+ } ;
2695+ }
26872696 } ) ;
26882697 default :
26892698 return super . GetSelectionList ( key ) ;
Original file line number Diff line number Diff line change @@ -947,23 +947,26 @@ class OpenOCDUploader extends HexUploader<string[]> {
947947
948948 const commands : string [ ] = [ ] ;
949949
950- const interfaceFileName = option . interface . startsWith ( '${workspaceFolder}/' )
951- ? option . interface . replace ( '${workspaceFolder}/' , '' ) : `interface/${ option . interface } ` ;
952-
953- const targetFileName = option . target . startsWith ( '${workspaceFolder}/' )
954- ? option . target . replace ( '${workspaceFolder}/' , '' ) : `target/${ option . target } ` ;
955-
956950 const wsFolder = WorkspaceManager . getInstance ( ) . getWorkspaceRoot ( ) ;
957951 if ( wsFolder ) {
958952 commands . push (
959953 `-s "${ wsFolder . path } "`
960954 ) ;
961955 }
962956
963- commands . push (
964- `-f ${ interfaceFileName } .cfg` ,
965- `-f ${ targetFileName } .cfg` ,
966- ) ;
957+ const addConfig = ( typ : 'interface' | 'target' , fname : string ) => {
958+ if ( fname . trim ( ) != '' ) {
959+ let fpath : string = fname . startsWith ( '${workspaceFolder}/' )
960+ ? fname . replace ( '${workspaceFolder}/' , '' )
961+ : `${ typ } /${ fname } ` ;
962+ let cfg = `-f ${ fpath } .cfg` ;
963+ if ( ! commands . includes ( cfg ) )
964+ commands . push ( cfg ) ;
965+ }
966+ } ;
967+
968+ addConfig ( 'interface' , option . interface ) ;
969+ addConfig ( 'target' , option . target ) ;
967970
968971 programs . forEach ( file => {
969972 if ( / \. b i n $ / i. test ( file . path ) ) {
You can’t perform that action at this time.
0 commit comments