Is it possible to automate UDE® by Windows PowerShell?
Yes, because Windows PowerShell can deal with COM objects it can also control UDE®.
Here is a small example which starts UDE®, programs the FLASH with an application, executes the program for 1 seconds and read some variables.
Example:
# UDE automation basics - PowerShell demo script
# On command line run: "powershell .\UDEAutomationDemo.ps1"
# In PowerShell console run: ".\UDEAutomationDemo.ps1"
# Note: Don't use expression '$true' together with UDE functions, use 1 instead
# Helper function to release COM objects
function Release-Ref ($ref)
{
([System.Runtime.InteropServices.Marshal]::ReleaseComObject([System.__ComObject]$ref) -gt 0)
[System.GC]::Collect()
[System.GC]::WaitForPendingFinalizers()
}
$Progid="UDELauncher"
$WspFile = "D:\UdeAutomationDemo\UdeAutomationDemo.wsx"
$CfgFile = "D:\UdeAutomationDemo\TriBoard_TC27xB_dap.cfg"
$ElfFile = "D:\UdeAutomationDemo\MulticoreDemo.elf"
write-output "Create new UDELauncher object ..."
$UDELauncher = New-Object -ComObject $ProgId
write-output "Start new UDE instance"
$UDEApplication = $UDELauncher.StartAndCreateWorkspace("UDEVisualPlatform.exe", $WspFile, $CfgFile, 1)
$Output = " UDE version: " + $UDEApplication.VersionInfo
write-output $Output
write-output "Access workspace"
$UDEWorkspace = $UDEApplication.Workspace
$Output = " Workspace: " + $UDEWorkspace.ProjectTitle
write-output $Output
write-output "Access first core debugger"
$UDEDebugger = $UDEWorkspace.CoreDebugger(0)
write-output "Wait for target connected"
while (0 -eq $UDEDebugger.Connected)
{
$UDEWorkspace.Sleep(100)
}
write-output "Load target application"
$UDEDebugger.LoadAndFlash($ElfFile)
write-output "Start target application"
$UDEDebugger.Go()
write-output "Wait a second"
$UDEWorkspace.Sleep(1000)
write-output "Read some variables"
$Seconds = $UDEDebugger.ReadVariable("g_SharedData.Seconds")
$Output = " Time: " + $Seconds
write-output $Output
write-output "Release objects and close UDE instance"
$UDELauncher.StopInstance($UDEApplication)
write-output "Release UDE launcher (optional)"
Release-Ref($UDELauncher)
write-output "Finished"
Please see the UDE Manual, the UDE® Help and UDEAutomation.chm for more details about automation with UDE®.