Import project dependencies from the command line

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Import project dependencies from the command line

496 Views
Greavesinator85
Contributor III

I am trying to set up a command line build, and thanks to the documentation I have been successful.

To improve this, I would like to not commit my dependencies, such as stacks/lwip/ gptp_stack/ and FreeRTOS/ to git.

For this to work, I need to import these dependencies from the command line, replicating one of the two steps that "Update Code" does in the S32DS GUI.

I've looked at manual copies, but it seems it is not this straight forward, especially for RTD/

Attached is my script, which works but does not import the dependencies.

Pasting here since I can't attach a powershell script!

 

param(
    [switch]$SkipMex = $false,
    [switch]$Clean = $false,
    [string]$S32DSRoot = ""
)

# Auto-detect project root (script can be in project root or scripts subdirectory)
$ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
if (Test-Path "$ScriptDir\.cproject") {
    $ProjectRoot = $ScriptDir
} elseif (Test-Path "$ScriptDir\..\.cproject") {
    $ProjectRoot = Resolve-Path "$ScriptDir\.."
} else {
    throw "Cannot find project root (no .cproject found)"
}

# S32DS installation path (check parameter, then environment variable, then default)
if (-not $S32DSRoot) {
    if ($env:S32DS_ROOT) {
        $S32DSRoot = $env:S32DS_ROOT
    } else {
        $S32DSRoot = "C:\NXP\S32DS.3.6.4"
    }
}

if (-not (Test-Path "$S32DSRoot\eclipse\s32dsc.exe")) {
    throw "S32DS not found at: $S32DSRoot`nSet S32DSRoot parameter or S32DS_ROOT environment variable"
}

# Workspace directory (must be OUTSIDE project to avoid recursive scanning)
$ProjectName = Split-Path -Leaf $ProjectRoot
$WorkspaceDir = Join-Path (Split-Path -Parent $ProjectRoot) ".s32ds_workspace_$ProjectName"

# Build output directory
$BuildOutputDir = "$ProjectRoot\Debug_FLASH"
if (-not (Test-Path $BuildOutputDir)) {
    New-Item -ItemType Directory -Path $BuildOutputDir -Force | Out-Null
}

# Set environment variables
$env:RTD_PATH = "$S32DSRoot\S32DS\software\PlatformSDK_S32K3"
$env:BASE_PLATFORMSDK_S32K3 = "$S32DSRoot\S32DS\software\PlatformSDK_S32K3\RTD\BaseNXP_TS_T40D34M60I0R0"
$env:PLATFORM_PLATFORMSDK_S32K3 = "$S32DSRoot\S32DS\software\PlatformSDK_S32K3\RTD\Platform_TS_T40D34M60I0R0"
$env:PlatformSDK_S32K3 = "$S32DSRoot\S32DS\software\PlatformSDK_S32K3"

Write-Host "`n============================================================"
Write-Host "  S32DS Headless Build Script"
Write-Host "============================================================"
Write-Host "Project:   $ProjectRoot"
Write-Host "Workspace: $WorkspaceDir"
Write-Host "Skip MEX:  $SkipMex"
Write-Host "Clean:     $Clean"
Write-Host "============================================================`n"

Push-Location "$S32DSRoot\eclipse"

try {
    # Step 1: MEX Code Generation
    if (-not $SkipMex) {
        Write-Host "[1/3] Running MEX code generation..."

        # Delete auto-generated S32K358.mex if it exists
        $autoMexPath = "$ProjectRoot\S32K358.mex"
        if (Test-Path $autoMexPath) {
            Write-Host "  --> Removing auto-generated S32K358.mex"
            Remove-Item $autoMexPath -Force
        }

        $mexArgs = @(
            '-noSplash'
            '-application', 'com.nxp.swtools.framework.application'
            '--launcher.suppressErrors'
            '--launcher.ini', '.\s32ds.ini'
            '-HeadlessTool', 'Peripherals'
            '-data', $WorkspaceDir
            '-SDKPath', "$S32DSRoot\S32DS\software\PlatformSDK_S32K3"
            '-Load', "$ProjectRoot\dag_tactile_agg_fw.mex"
            '-ExportAll', $ProjectRoot
        )

        Write-Host "  --> Running MEX tool..."
        & .\s32dsc.exe $mexArgs 2>&1 | Tee-Object -FilePath "$BuildOutputDir\mex_generation.log" | ForEach-Object {
            if ($_ -match "Processing|Generating|ERROR|WARNING|Finished") {
                Write-Host "      $_"
            }
        }

        # Delete S32K358.mex again if it was created during generation
        if (Test-Path $autoMexPath) {
            Write-Host "  --> Removing auto-generated S32K358.mex"
            Remove-Item $autoMexPath -Force
        }

        # Move HTML report to Debug_FLASH if it exists
        $htmlReport = "$ProjectRoot\html_report_Peripherals"
        if (Test-Path $htmlReport) {
            $htmlReportDest = "$BuildOutputDir\html_report_Peripherals"
            if (Test-Path $htmlReportDest) {
                Remove-Item $htmlReportDest -Recurse -Force
            }
            Move-Item $htmlReport $htmlReportDest -Force
            Write-Host "  --> Moved html_report_Peripherals to Debug_FLASH"
        }

        Write-Host "  [OK] MEX generation completed (log: Debug_FLASH\mex_generation.log)"
    } else {
        Write-Host "[1/3] Skipping MEX code generation"
    }

    # Step 2: Import project
    Write-Host "`n[2/3] Ensuring project is imported..."

    $projectMetadata = "$WorkspaceDir\.metadata\.plugins\org.eclipse.core.resources\.projects\dag_tactile_agg_fw"
    if (-not (Test-Path $projectMetadata)) {
        Write-Host "  --> Importing project into workspace..."

        $importArgs = @(
            '-noSplash'
            '-application', 'org.eclipse.cdt.managedbuilder.core.headlessbuild'
            '-data', $WorkspaceDir
            '-import', $ProjectRoot
        )

        Write-Host "  --> Importing into workspace..."
        & .\s32dsc.exe $importArgs 2>&1 | Tee-Object -FilePath "$BuildOutputDir\import.log" | ForEach-Object {
            if ($_ -match "Importing|Project|ERROR|WARNING") {
                Write-Host "      $_"
            }
        }

        if ($LASTEXITCODE -ne 0) {
            Write-Host "  [ERROR] Import failed with exit code $LASTEXITCODE"
            Write-Host "  Check Debug_FLASH\import.log for details"
            Write-Host "`nLast 20 lines of import log:"
            Get-Content "$BuildOutputDir\import.log" -Tail 20 | ForEach-Object { Write-Host "    $_" }
            throw "Project import failed"
        }
        Write-Host "  [OK] Project imported"

        # Run prebuild script (modifies .cproject, needs to run after import)
        Write-Host "  --> Running prebuild script..."
        $prebuildScript = "$ProjectRoot\scripts\prebuild.py"
        if (Test-Path $prebuildScript) {
            Push-Location $ProjectRoot
            & python $prebuildScript
            Pop-Location
            Write-Host "  [OK] Prebuild completed"
        } else {
            Write-Host "  [WARNING] Prebuild script not found: $prebuildScript"
        }
    } else {
        Write-Host "  [OK] Project already imported"
    }

    # Step 3: Build
    Write-Host "`n[3/3] Running build..."

    $buildType = if ($Clean) { "-cleanBuild" } else { "-build" }
    $buildTypeLabel = if ($Clean) { "Clean build" } else { "Incremental build" }

    Write-Host "  --> $buildTypeLabel starting...`n"

    $buildArgs = @(
        '-noSplash'
        '-application', 'org.eclipse.cdt.managedbuilder.core.headlessbuild'
        '-data', $WorkspaceDir
        $buildType, 'dag_tactile_agg_fw/Debug_FLASH'
    )

    $buildStart = Get-Date
    $buildLogPath = "$BuildOutputDir\build_output.log"

    # Run build with real-time output
    & .\s32dsc.exe $buildArgs 2>&1 | Tee-Object -FilePath $buildLogPath | ForEach-Object {
        # Show build progress lines
        if ($_ -match "^\[|Building|Compiling|Linking|Finished|error|warning") {
            Write-Host $_
        }
    }

    $buildDuration = (Get-Date) - $buildStart

    # Check build result more accurately
    $buildContent = Get-Content $buildLogPath -Raw
    $buildFailed = $buildContent -match "Build Failed" -or $buildContent -match "\d+ error"
    $errorCount = if ($buildContent -match "(\d+) error") { [int]$matches[1] } else { 0 }

    Write-Host "`n============================================================"
    if ($buildFailed -and $errorCount -gt 0) {
        Write-Host "  [ERROR] BUILD FAILED ($errorCount errors)"
        Write-Host "============================================================"
        Write-Host "`nError details:"
        Get-Content $buildLogPath | Select-String -Pattern "error:" | Select-Object -First 10 | ForEach-Object {
            Write-Host "  $_"
        }
        Write-Host "`nFull build output: Debug_FLASH\build_output.log"
        Write-Host "Duration: $([math]::Round($buildDuration.TotalSeconds, 1)) seconds`n"
        exit 1
    } else {
        $elfPath = "$ProjectRoot\Debug_FLASH\dag_tactile_agg_fw.elf"
        if (Test-Path $elfPath) {
            $elfInfo = Get-Item $elfPath
            Write-Host "  [OK] BUILD SUCCESSFUL"
            Write-Host "============================================================"
            Write-Host "`nOutput:"
            Write-Host "  ELF file: $elfPath"
            Write-Host "  Size:     $([math]::Round($elfInfo.Length/1KB, 2)) KB"
            Write-Host "  Modified: $($elfInfo.LastWriteTime)"
            Write-Host "  Duration: $([math]::Round($buildDuration.TotalSeconds, 1)) seconds`n"
            exit 0
        } else {
            Write-Host "  [WARNING] BUILD COMPLETED (status unclear)"
            Write-Host "============================================================"
            Write-Host "`nNo errors detected but ELF file not found."
            Write-Host "Check Debug_FLASH\build_output.log for details.`n"
            exit 0
        }
    }
}
catch {
    Write-Host "`nScript failed: $_"
    Write-Host $_.ScriptStackTrace
    exit 1
}
finally {
    Pop-Location
}

 

0 Kudos
Reply
1 Reply

85 Views
jiri_kral
NXP Employee
NXP Employee

Hi Jake, 

sorry for delay. As I understand it you don't wan't put into GIT the generated files like RTD, board and So on. 

I'm afraid that there is no such tool for importing dependencies. You can generate new RTD code from existing .mex or copy files from local storage into project. 

0 Kudos
Reply
%3CLINGO-SUB%20id%3D%22lingo-sub-2263791%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EImport%20project%20dependencies%20from%20the%20command%20line%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2263791%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EI%20am%20trying%20to%20set%20up%20a%20command%20line%20build%2C%20and%20thanks%20to%20the%20documentation%20I%20have%20been%20successful.%3C%2FP%3E%3CP%3ETo%20improve%20this%2C%20I%20would%20like%20to%20not%20commit%20my%20dependencies%2C%20such%20as%20stacks%2Flwip%2F%20gptp_stack%2F%20and%20FreeRTOS%2F%20to%20git.%3C%2FP%3E%3CP%3EFor%20this%20to%20work%2C%20I%20need%20to%20import%20these%20dependencies%20from%20the%20command%20line%2C%20replicating%20one%20of%20the%20two%20steps%20that%20%22Update%20Code%22%20does%20in%20the%20S32DS%20GUI.%3C%2FP%3E%3CP%3EI've%20looked%20at%20manual%20copies%2C%20but%20it%20seems%20it%20is%20not%20this%20straight%20forward%2C%20especially%20for%20RTD%2F%3C%2FP%3E%3CP%3EAttached%20is%20my%20script%2C%20which%20works%20but%20does%20not%20import%20the%20dependencies.%3C%2FP%3E%3CP%3EPasting%20here%20since%20I%20can't%20attach%20a%20powershell%20script!%3C%2FP%3E%3CBR%20%2F%3E%3CPRE%20class%3D%22lia-code-sample%20language-markup%22%3E%3CCODE%3Eparam(%0A%20%20%20%20%5Bswitch%5D%24SkipMex%20%3D%20%24false%2C%0A%20%20%20%20%5Bswitch%5D%24Clean%20%3D%20%24false%2C%0A%20%20%20%20%5Bstring%5D%24S32DSRoot%20%3D%20%22%22%0A)%0A%0A%23%20Auto-detect%20project%20root%20(script%20can%20be%20in%20project%20root%20or%20scripts%20subdirectory)%0A%24ScriptDir%20%3D%20Split-Path%20-Parent%20%24MyInvocation.MyCommand.Path%0Aif%20(Test-Path%20%22%24ScriptDir%5C.cproject%22)%20%7B%0A%20%20%20%20%24ProjectRoot%20%3D%20%24ScriptDir%0A%7D%20elseif%20(Test-Path%20%22%24ScriptDir%5C..%5C.cproject%22)%20%7B%0A%20%20%20%20%24ProjectRoot%20%3D%20Resolve-Path%20%22%24ScriptDir%5C..%22%0A%7D%20else%20%7B%0A%20%20%20%20throw%20%22Cannot%20find%20project%20root%20(no%20.cproject%20found)%22%0A%7D%0A%0A%23%20S32DS%20installation%20path%20(check%20parameter%2C%20then%20environment%20variable%2C%20then%20default)%0Aif%20(-not%20%24S32DSRoot)%20%7B%0A%20%20%20%20if%20(%24env%3AS32DS_ROOT)%20%7B%0A%20%20%20%20%20%20%20%20%24S32DSRoot%20%3D%20%24env%3AS32DS_ROOT%0A%20%20%20%20%7D%20else%20%7B%0A%20%20%20%20%20%20%20%20%24S32DSRoot%20%3D%20%22C%3A%5CNXP%5CS32DS.3.6.4%22%0A%20%20%20%20%7D%0A%7D%0A%0Aif%20(-not%20(Test-Path%20%22%24S32DSRoot%5Ceclipse%5Cs32dsc.exe%22))%20%7B%0A%20%20%20%20throw%20%22S32DS%20not%20found%20at%3A%20%24S32DSRoot%60nSet%20S32DSRoot%20parameter%20or%20S32DS_ROOT%20environment%20variable%22%0A%7D%0A%0A%23%20Workspace%20directory%20(must%20be%20OUTSIDE%20project%20to%20avoid%20recursive%20scanning)%0A%24ProjectName%20%3D%20Split-Path%20-Leaf%20%24ProjectRoot%0A%24WorkspaceDir%20%3D%20Join-Path%20(Split-Path%20-Parent%20%24ProjectRoot)%20%22.s32ds_workspace_%24ProjectName%22%0A%0A%23%20Build%20output%20directory%0A%24BuildOutputDir%20%3D%20%22%24ProjectRoot%5CDebug_FLASH%22%0Aif%20(-not%20(Test-Path%20%24BuildOutputDir))%20%7B%0A%20%20%20%20New-Item%20-ItemType%20Directory%20-Path%20%24BuildOutputDir%20-Force%20%7C%20Out-Null%0A%7D%0A%0A%23%20Set%20environment%20variables%0A%24env%3ARTD_PATH%20%3D%20%22%24S32DSRoot%5CS32DS%5Csoftware%5CPlatformSDK_S32K3%22%0A%24env%3ABASE_PLATFORMSDK_S32K3%20%3D%20%22%24S32DSRoot%5CS32DS%5Csoftware%5CPlatformSDK_S32K3%5CRTD%5CBaseNXP_TS_T40D34M60I0R0%22%0A%24env%3APLATFORM_PLATFORMSDK_S32K3%20%3D%20%22%24S32DSRoot%5CS32DS%5Csoftware%5CPlatformSDK_S32K3%5CRTD%5CPlatform_TS_T40D34M60I0R0%22%0A%24env%3APlatformSDK_S32K3%20%3D%20%22%24S32DSRoot%5CS32DS%5Csoftware%5CPlatformSDK_S32K3%22%0A%0AWrite-Host%20%22%60n%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%22%0AWrite-Host%20%22%20%20S32DS%20Headless%20Build%20Script%22%0AWrite-Host%20%22%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%22%0AWrite-Host%20%22Project%3A%20%20%20%24ProjectRoot%22%0AWrite-Host%20%22Workspace%3A%20%24WorkspaceDir%22%0AWrite-Host%20%22Skip%20MEX%3A%20%20%24SkipMex%22%0AWrite-Host%20%22Clean%3A%20%20%20%20%20%24Clean%22%0AWrite-Host%20%22%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%60n%22%0A%0APush-Location%20%22%24S32DSRoot%5Ceclipse%22%0A%0Atry%20%7B%0A%20%20%20%20%23%20Step%201%3A%20MEX%20Code%20Generation%0A%20%20%20%20if%20(-not%20%24SkipMex)%20%7B%0A%20%20%20%20%20%20%20%20Write-Host%20%22%5B1%2F3%5D%20Running%20MEX%20code%20generation...%22%0A%0A%20%20%20%20%20%20%20%20%23%20Delete%20auto-generated%20S32K358.mex%20if%20it%20exists%0A%20%20%20%20%20%20%20%20%24autoMexPath%20%3D%20%22%24ProjectRoot%5CS32K358.mex%22%0A%20%20%20%20%20%20%20%20if%20(Test-Path%20%24autoMexPath)%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20Write-Host%20%22%20%20--%26gt%3B%20Removing%20auto-generated%20S32K358.mex%22%0A%20%20%20%20%20%20%20%20%20%20%20%20Remove-Item%20%24autoMexPath%20-Force%0A%20%20%20%20%20%20%20%20%7D%0A%0A%20%20%20%20%20%20%20%20%24mexArgs%20%3D%20%40(%0A%20%20%20%20%20%20%20%20%20%20%20%20'-noSplash'%0A%20%20%20%20%20%20%20%20%20%20%20%20'-application'%2C%20'com.nxp.swtools.framework.application'%0A%20%20%20%20%20%20%20%20%20%20%20%20'--launcher.suppressErrors'%0A%20%20%20%20%20%20%20%20%20%20%20%20'--launcher.ini'%2C%20'.%5Cs32ds.ini'%0A%20%20%20%20%20%20%20%20%20%20%20%20'-HeadlessTool'%2C%20'Peripherals'%0A%20%20%20%20%20%20%20%20%20%20%20%20'-data'%2C%20%24WorkspaceDir%0A%20%20%20%20%20%20%20%20%20%20%20%20'-SDKPath'%2C%20%22%24S32DSRoot%5CS32DS%5Csoftware%5CPlatformSDK_S32K3%22%0A%20%20%20%20%20%20%20%20%20%20%20%20'-Load'%2C%20%22%24ProjectRoot%5Cdag_tactile_agg_fw.mex%22%0A%20%20%20%20%20%20%20%20%20%20%20%20'-ExportAll'%2C%20%24ProjectRoot%0A%20%20%20%20%20%20%20%20)%0A%0A%20%20%20%20%20%20%20%20Write-Host%20%22%20%20--%26gt%3B%20Running%20MEX%20tool...%22%0A%20%20%20%20%20%20%20%20%26amp%3B%20.%5Cs32dsc.exe%20%24mexArgs%202%26gt%3B%26amp%3B1%20%7C%20Tee-Object%20-FilePath%20%22%24BuildOutputDir%5Cmex_generation.log%22%20%7C%20ForEach-Object%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20if%20(%24_%20-match%20%22Processing%7CGenerating%7CERROR%7CWARNING%7CFinished%22)%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20Write-Host%20%22%20%20%20%20%20%20%24_%22%0A%20%20%20%20%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20%7D%0A%0A%20%20%20%20%20%20%20%20%23%20Delete%20S32K358.mex%20again%20if%20it%20was%20created%20during%20generation%0A%20%20%20%20%20%20%20%20if%20(Test-Path%20%24autoMexPath)%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20Write-Host%20%22%20%20--%26gt%3B%20Removing%20auto-generated%20S32K358.mex%22%0A%20%20%20%20%20%20%20%20%20%20%20%20Remove-Item%20%24autoMexPath%20-Force%0A%20%20%20%20%20%20%20%20%7D%0A%0A%20%20%20%20%20%20%20%20%23%20Move%20HTML%20report%20to%20Debug_FLASH%20if%20it%20exists%0A%20%20%20%20%20%20%20%20%24htmlReport%20%3D%20%22%24ProjectRoot%5Chtml_report_Peripherals%22%0A%20%20%20%20%20%20%20%20if%20(Test-Path%20%24htmlReport)%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%24htmlReportDest%20%3D%20%22%24BuildOutputDir%5Chtml_report_Peripherals%22%0A%20%20%20%20%20%20%20%20%20%20%20%20if%20(Test-Path%20%24htmlReportDest)%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20Remove-Item%20%24htmlReportDest%20-Recurse%20-Force%0A%20%20%20%20%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20%20%20%20%20Move-Item%20%24htmlReport%20%24htmlReportDest%20-Force%0A%20%20%20%20%20%20%20%20%20%20%20%20Write-Host%20%22%20%20--%26gt%3B%20Moved%20html_report_Peripherals%20to%20Debug_FLASH%22%0A%20%20%20%20%20%20%20%20%7D%0A%0A%20%20%20%20%20%20%20%20Write-Host%20%22%20%20%5BOK%5D%20MEX%20generation%20completed%20(log%3A%20Debug_FLASH%5Cmex_generation.log)%22%0A%20%20%20%20%7D%20else%20%7B%0A%20%20%20%20%20%20%20%20Write-Host%20%22%5B1%2F3%5D%20Skipping%20MEX%20code%20generation%22%0A%20%20%20%20%7D%0A%0A%20%20%20%20%23%20Step%202%3A%20Import%20project%0A%20%20%20%20Write-Host%20%22%60n%5B2%2F3%5D%20Ensuring%20project%20is%20imported...%22%0A%0A%20%20%20%20%24projectMetadata%20%3D%20%22%24WorkspaceDir%5C.metadata%5C.plugins%5Corg.eclipse.core.resources%5C.projects%5Cdag_tactile_agg_fw%22%0A%20%20%20%20if%20(-not%20(Test-Path%20%24projectMetadata))%20%7B%0A%20%20%20%20%20%20%20%20Write-Host%20%22%20%20--%26gt%3B%20Importing%20project%20into%20workspace...%22%0A%0A%20%20%20%20%20%20%20%20%24importArgs%20%3D%20%40(%0A%20%20%20%20%20%20%20%20%20%20%20%20'-noSplash'%0A%20%20%20%20%20%20%20%20%20%20%20%20'-application'%2C%20'org.eclipse.cdt.managedbuilder.core.headlessbuild'%0A%20%20%20%20%20%20%20%20%20%20%20%20'-data'%2C%20%24WorkspaceDir%0A%20%20%20%20%20%20%20%20%20%20%20%20'-import'%2C%20%24ProjectRoot%0A%20%20%20%20%20%20%20%20)%0A%0A%20%20%20%20%20%20%20%20Write-Host%20%22%20%20--%26gt%3B%20Importing%20into%20workspace...%22%0A%20%20%20%20%20%20%20%20%26amp%3B%20.%5Cs32dsc.exe%20%24importArgs%202%26gt%3B%26amp%3B1%20%7C%20Tee-Object%20-FilePath%20%22%24BuildOutputDir%5Cimport.log%22%20%7C%20ForEach-Object%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20if%20(%24_%20-match%20%22Importing%7CProject%7CERROR%7CWARNING%22)%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20Write-Host%20%22%20%20%20%20%20%20%24_%22%0A%20%20%20%20%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20%7D%0A%0A%20%20%20%20%20%20%20%20if%20(%24LASTEXITCODE%20-ne%200)%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20Write-Host%20%22%20%20%5BERROR%5D%20Import%20failed%20with%20exit%20code%20%24LASTEXITCODE%22%0A%20%20%20%20%20%20%20%20%20%20%20%20Write-Host%20%22%20%20Check%20Debug_FLASH%5Cimport.log%20for%20details%22%0A%20%20%20%20%20%20%20%20%20%20%20%20Write-Host%20%22%60nLast%2020%20lines%20of%20import%20log%3A%22%0A%20%20%20%20%20%20%20%20%20%20%20%20Get-Content%20%22%24BuildOutputDir%5Cimport.log%22%20-Tail%2020%20%7C%20ForEach-Object%20%7B%20Write-Host%20%22%20%20%20%20%24_%22%20%7D%0A%20%20%20%20%20%20%20%20%20%20%20%20throw%20%22Project%20import%20failed%22%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20Write-Host%20%22%20%20%5BOK%5D%20Project%20imported%22%0A%0A%20%20%20%20%20%20%20%20%23%20Run%20prebuild%20script%20(modifies%20.cproject%2C%20needs%20to%20run%20after%20import)%0A%20%20%20%20%20%20%20%20Write-Host%20%22%20%20--%26gt%3B%20Running%20prebuild%20script...%22%0A%20%20%20%20%20%20%20%20%24prebuildScript%20%3D%20%22%24ProjectRoot%5Cscripts%5Cprebuild.py%22%0A%20%20%20%20%20%20%20%20if%20(Test-Path%20%24prebuildScript)%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20Push-Location%20%24ProjectRoot%0A%20%20%20%20%20%20%20%20%20%20%20%20%26amp%3B%20python%20%24prebuildScript%0A%20%20%20%20%20%20%20%20%20%20%20%20Pop-Location%0A%20%20%20%20%20%20%20%20%20%20%20%20Write-Host%20%22%20%20%5BOK%5D%20Prebuild%20completed%22%0A%20%20%20%20%20%20%20%20%7D%20else%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20Write-Host%20%22%20%20%5BWARNING%5D%20Prebuild%20script%20not%20found%3A%20%24prebuildScript%22%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%7D%20else%20%7B%0A%20%20%20%20%20%20%20%20Write-Host%20%22%20%20%5BOK%5D%20Project%20already%20imported%22%0A%20%20%20%20%7D%0A%0A%20%20%20%20%23%20Step%203%3A%20Build%0A%20%20%20%20Write-Host%20%22%60n%5B3%2F3%5D%20Running%20build...%22%0A%0A%20%20%20%20%24buildType%20%3D%20if%20(%24Clean)%20%7B%20%22-cleanBuild%22%20%7D%20else%20%7B%20%22-build%22%20%7D%0A%20%20%20%20%24buildTypeLabel%20%3D%20if%20(%24Clean)%20%7B%20%22Clean%20build%22%20%7D%20else%20%7B%20%22Incremental%20build%22%20%7D%0A%0A%20%20%20%20Write-Host%20%22%20%20--%26gt%3B%20%24buildTypeLabel%20starting...%60n%22%0A%0A%20%20%20%20%24buildArgs%20%3D%20%40(%0A%20%20%20%20%20%20%20%20'-noSplash'%0A%20%20%20%20%20%20%20%20'-application'%2C%20'org.eclipse.cdt.managedbuilder.core.headlessbuild'%0A%20%20%20%20%20%20%20%20'-data'%2C%20%24WorkspaceDir%0A%20%20%20%20%20%20%20%20%24buildType%2C%20'dag_tactile_agg_fw%2FDebug_FLASH'%0A%20%20%20%20)%0A%0A%20%20%20%20%24buildStart%20%3D%20Get-Date%0A%20%20%20%20%24buildLogPath%20%3D%20%22%24BuildOutputDir%5Cbuild_output.log%22%0A%0A%20%20%20%20%23%20Run%20build%20with%20real-time%20output%0A%20%20%20%20%26amp%3B%20.%5Cs32dsc.exe%20%24buildArgs%202%26gt%3B%26amp%3B1%20%7C%20Tee-Object%20-FilePath%20%24buildLogPath%20%7C%20ForEach-Object%20%7B%0A%20%20%20%20%20%20%20%20%23%20Show%20build%20progress%20lines%0A%20%20%20%20%20%20%20%20if%20(%24_%20-match%20%22%5E%5C%5B%7CBuilding%7CCompiling%7CLinking%7CFinished%7Cerror%7Cwarning%22)%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20Write-Host%20%24_%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%7D%0A%0A%20%20%20%20%24buildDuration%20%3D%20(Get-Date)%20-%20%24buildStart%0A%0A%20%20%20%20%23%20Check%20build%20result%20more%20accurately%0A%20%20%20%20%24buildContent%20%3D%20Get-Content%20%24buildLogPath%20-Raw%0A%20%20%20%20%24buildFailed%20%3D%20%24buildContent%20-match%20%22Build%20Failed%22%20-or%20%24buildContent%20-match%20%22%5Cd%2B%20error%22%0A%20%20%20%20%24errorCount%20%3D%20if%20(%24buildContent%20-match%20%22(%5Cd%2B)%20error%22)%20%7B%20%5Bint%5D%24matches%5B1%5D%20%7D%20else%20%7B%200%20%7D%0A%0A%20%20%20%20Write-Host%20%22%60n%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%22%0A%20%20%20%20if%20(%24buildFailed%20-and%20%24errorCount%20-gt%200)%20%7B%0A%20%20%20%20%20%20%20%20Write-Host%20%22%20%20%5BERROR%5D%20BUILD%20FAILED%20(%24errorCount%20errors)%22%0A%20%20%20%20%20%20%20%20Write-Host%20%22%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%22%0A%20%20%20%20%20%20%20%20Write-Host%20%22%60nError%20details%3A%22%0A%20%20%20%20%20%20%20%20Get-Content%20%24buildLogPath%20%7C%20Select-String%20-Pattern%20%22error%3A%22%20%7C%20Select-Object%20-First%2010%20%7C%20ForEach-Object%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20Write-Host%20%22%20%20%24_%22%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20Write-Host%20%22%60nFull%20build%20output%3A%20Debug_FLASH%5Cbuild_output.log%22%0A%20%20%20%20%20%20%20%20Write-Host%20%22Duration%3A%20%24(%5Bmath%5D%3A%3ARound(%24buildDuration.TotalSeconds%2C%201))%20seconds%60n%22%0A%20%20%20%20%20%20%20%20exit%201%0A%20%20%20%20%7D%20else%20%7B%0A%20%20%20%20%20%20%20%20%24elfPath%20%3D%20%22%24ProjectRoot%5CDebug_FLASH%5Cdag_tactile_agg_fw.elf%22%0A%20%20%20%20%20%20%20%20if%20(Test-Path%20%24elfPath)%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%24elfInfo%20%3D%20Get-Item%20%24elfPath%0A%20%20%20%20%20%20%20%20%20%20%20%20Write-Host%20%22%20%20%5BOK%5D%20BUILD%20SUCCESSFUL%22%0A%20%20%20%20%20%20%20%20%20%20%20%20Write-Host%20%22%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%22%0A%20%20%20%20%20%20%20%20%20%20%20%20Write-Host%20%22%60nOutput%3A%22%0A%20%20%20%20%20%20%20%20%20%20%20%20Write-Host%20%22%20%20ELF%20file%3A%20%24elfPath%22%0A%20%20%20%20%20%20%20%20%20%20%20%20Write-Host%20%22%20%20Size%3A%20%20%20%20%20%24(%5Bmath%5D%3A%3ARound(%24elfInfo.Length%2F1KB%2C%202))%20KB%22%0A%20%20%20%20%20%20%20%20%20%20%20%20Write-Host%20%22%20%20Modified%3A%20%24(%24elfInfo.LastWriteTime)%22%0A%20%20%20%20%20%20%20%20%20%20%20%20Write-Host%20%22%20%20Duration%3A%20%24(%5Bmath%5D%3A%3ARound(%24buildDuration.TotalSeconds%2C%201))%20seconds%60n%22%0A%20%20%20%20%20%20%20%20%20%20%20%20exit%200%0A%20%20%20%20%20%20%20%20%7D%20else%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20Write-Host%20%22%20%20%5BWARNING%5D%20BUILD%20COMPLETED%20(status%20unclear)%22%0A%20%20%20%20%20%20%20%20%20%20%20%20Write-Host%20%22%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%22%0A%20%20%20%20%20%20%20%20%20%20%20%20Write-Host%20%22%60nNo%20errors%20detected%20but%20ELF%20file%20not%20found.%22%0A%20%20%20%20%20%20%20%20%20%20%20%20Write-Host%20%22Check%20Debug_FLASH%5Cbuild_output.log%20for%20details.%60n%22%0A%20%20%20%20%20%20%20%20%20%20%20%20exit%200%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%7D%0A%7D%0Acatch%20%7B%0A%20%20%20%20Write-Host%20%22%60nScript%20failed%3A%20%24_%22%0A%20%20%20%20Write-Host%20%24_.ScriptStackTrace%0A%20%20%20%20exit%201%0A%7D%0Afinally%20%7B%0A%20%20%20%20Pop-Location%0A%7D%3C%2FCODE%3E%3C%2FPRE%3E%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2298134%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20Import%20project%20dependencies%20from%20the%20command%20line%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2298134%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%20Jake%2C%26nbsp%3B%3C%2FP%3E%0A%3CP%3Esorry%20for%20delay.%20As%20I%20understand%20it%20you%20don't%20wan't%20put%20into%20GIT%20the%20generated%20files%20like%20RTD%2C%20board%20and%20So%20on.%26nbsp%3B%3C%2FP%3E%0A%3CP%3EI'm%20afraid%20that%20there%20is%20no%20such%20tool%20for%20importing%20dependencies.%20You%20can%20generate%20new%20RTD%20code%20from%20existing%20.mex%20or%20copy%20files%20from%20local%20storage%20into%20project.%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E