proc exportToSDK {} {
  cd C:/a_RefDesign/MAXREFDES14_Sonoma/RD14_LX9_V01_00/Design_Files/system
  if { [ catch { xload xmp system.xmp } result ] } {
    exit 10
  }
  if { [run exporttosdk] != 0 } {
    return -1
  }
  return 0
}

if { [catch {exportToSDK} result] } {
  exit -1
}

set sExportDir [ xget sdk_export_dir ]
set sExportDir [ file join "C:/a_RefDesign/MAXREFDES14_Sonoma/RD14_LX9_V01_00/Design_Files/system" "$sExportDir" "hw" ] 
if { [ file exists C:/a_RefDesign/MAXREFDES14_Sonoma/RD14_LX9_V01_00/Design_Files/edkBmmFile_bd.bmm ] } {
   puts "Copying placed bmm file C:/a_RefDesign/MAXREFDES14_Sonoma/RD14_LX9_V01_00/Design_Files/edkBmmFile_bd.bmm to $sExportDir" 
   file copy -force "C:/a_RefDesign/MAXREFDES14_Sonoma/RD14_LX9_V01_00/Design_Files/edkBmmFile_bd.bmm" $sExportDir
}
if { [ file exists C:/a_RefDesign/MAXREFDES14_Sonoma/RD14_LX9_V01_00/Design_Files/topLevel.bit ] } {
   puts "Copying bit file C:/a_RefDesign/MAXREFDES14_Sonoma/RD14_LX9_V01_00/Design_Files/topLevel.bit to $sExportDir" 
   file copy -force "C:/a_RefDesign/MAXREFDES14_Sonoma/RD14_LX9_V01_00/Design_Files/topLevel.bit" $sExportDir
}
exit $result
