Skip to content

Commit e5c8327

Browse files
aap-scen-sc
authored andcommitted
[syntacore] support for platform extensions in openocd_run.exp
Add the `--platform` argument to configure the `platform` parameter of `syntacore_target.cfg`. Change-Id: I45195e09a1fce0d8763bd4d43f44f8b79a35b376 Signed-off-by: Parshintsev Anatoly <[email protected]>
1 parent df68b1e commit e5c8327

File tree

1 file changed

+19
-7
lines changed

1 file changed

+19
-7
lines changed

tools/syntacore/openocd_run.exp

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ set COMMAND_LINE_OPTIONS [dict create \
5252
--log-session "value:log_path. Path to session log" \
5353
--no-extra-scripts "flag. avoid loading of extra scripts (common routines to help with debugging)" \
5454
--no-targets "devel:flag. create only TAP, do not create OpenOCD targets" \
55+
--platform "value:name. The name of the platform. Performs platform-specific initialization if appropriate plugin is available" \
5556
--reset-adapter "flag. enforce reset of debug adapter before use" \
5657
--run-command "value:command. extra TCL command to run. Can be specified multiple times. The command is run after init phase" \
5758
--run-script "value:file. additional TCL script to run. Can be specified multiple times. The script is run after init phase" \
@@ -101,6 +102,7 @@ set SETTINGS(load_extra_scripts) 1
101102
set SETTINGS(extra_run_commands) []
102103
set SETTINGS(extra_spike_args) []
103104
set SETTINGS(no_openocd_targets) 0
105+
set SETTINGS(platform) ""
104106
set SETTINGS(reset_adapter) 0
105107

106108
set DEBUG_ADAPTER_INFO(adapter_string) ""
@@ -266,6 +268,8 @@ for { set i 0 } { $i < $argc } { incr i } {
266268
set SETTINGS(stand_db) $optarg
267269
} elseif { $option == $COMMAND_LINE_ARG(--no-targets) } {
268270
set SETTINGS(no_openocd_targets) 1
271+
} elseif { $option == $COMMAND_LINE_ARG(--platform) } {
272+
set SETTINGS(platform) $optarg
269273
} elseif { $option == $COMMAND_LINE_ARG(--reset-adapter) } {
270274
set SETTINGS(reset_adapter) 1
271275
} elseif { $option == $COMMAND_LINE_ARG(--help) } {
@@ -731,16 +735,19 @@ proc buildOpenOCDCommandLine {DebugInterfaceCfg AdapterSerial JtagTopologyString
731735
-c "sc_target_config jtag_topology ${JtagTopologyString}"]
732736
}
733737

738+
set ExtraLibraries [list]
734739
if {$SETTINGS(load_extra_scripts) == 1} {
735-
set ExtraLibraries [list]
736740
lappend ExtraLibraries "[getOpenOCDRootDir]/share/openocd/scripts/syntacore/sc_fpga_lib.tcl"
737-
foreach Lib $ExtraLibraries {
738-
if {![file exists "$Lib"]} {
739-
fatalError "unable to locate extra library: $Lib"
740-
}
741-
lappend OpenOCDArgs -f
742-
lappend OpenOCDArgs "$Lib"
741+
}
742+
if {$SETTINGS(platform) ne ""} {
743+
lappend ExtraLibraries "[getOpenOCDRootDir]/share/openocd/scripts/syntacore/scr_info.tcl"
744+
}
745+
foreach Lib $ExtraLibraries {
746+
if {![file exists "$Lib"]} {
747+
fatalError "unable to locate extra library: $Lib"
743748
}
749+
lappend OpenOCDArgs -f
750+
lappend OpenOCDArgs "$Lib"
744751
}
745752

746753
if {$SETTINGS(ide_mode) == 1} {
@@ -783,6 +790,11 @@ proc buildOpenOCDCommandLine {DebugInterfaceCfg AdapterSerial JtagTopologyString
783790
lappend OpenOCDArgs -c
784791
lappend OpenOCDArgs "sc_target_config target_type $SETTINGS(target_type)"
785792

793+
if {$SETTINGS(platform) ne ""} {
794+
lappend OpenOCDArgs -c
795+
lappend OpenOCDArgs "sc_target_config platform_extension $SETTINGS(platform)"
796+
}
797+
786798
lappend OpenOCDArgs [deriveDesiredVerbosityOption]
787799

788800
# Apparently, depending on the presence -c "init" command OpenOCD behaves

0 commit comments

Comments
 (0)