Skip to content

Commit

Permalink
fix wrong dir for quartus downloader
Browse files Browse the repository at this point in the history
  • Loading branch information
HendrikMennen committed Jul 23, 2024
1 parent adc2c92 commit e2bcdfb
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 7 deletions.
13 changes: 13 additions & 0 deletions oneware-extension.json
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,19 @@
"url": "https://github.com/one-ware/OneWare.Quartus/releases/download/0.7.1/OneWare.QuartusExtension_0.7.1_linux-x64.zip"
}
]
},
{
"version": "0.7.2",
"targets": [
{
"target": "win-x64",
"url": "https://github.com/one-ware/OneWare.Quartus/releases/download/0.7.2/OneWare.QuartusExtension_0.7.2_win-x64.zip"
},
{
"target": "linux-x64",
"url": "https://github.com/one-ware/OneWare.Quartus/releases/download/0.7.2/OneWare.QuartusExtension_0.7.2_linux-x64.zip"
}
]
}
]
}
2 changes: 1 addition & 1 deletion src/OneWare.Quartus/OneWare.Quartus.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<Version>0.7.1</Version>
<Version>0.7.2</Version>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
Expand Down
25 changes: 19 additions & 6 deletions src/OneWare.Quartus/QuartusLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using OneWare.Essentials.Behaviors;
using OneWare.Essentials.Enums;
using OneWare.Essentials.Services;
using OneWare.Quartus.Helper;
using OneWare.UniversalFpgaProjectSystem.Models;
using OneWare.UniversalFpgaProjectSystem.Parser;
using OneWare.UniversalFpgaProjectSystem.Services;
Expand Down Expand Up @@ -45,9 +46,21 @@ public async Task DownloadAsync(UniversalFpgaProjectRoot project)
? "1"
: "\"" + cableSetting + "\"";

var qsfPath = QsfHelper.GetQsfPath(project);
var qsf = QsfHelper.ReadQsf(qsfPath);

var outputDirRelative = qsf.GetGlobalAssignment("PROJECT_OUTPUT_DIRECTORY");

var outputDir = project.FullPath;

if (outputDirRelative != null)
{
outputDir = Path.Combine(outputDir, outputDirRelative);
}

if (!longTerm)
{
var sofFile = Path.GetFileName(FirstFileInPath(project.FullPath, ".sof") ?? "");
var sofFile = Path.GetFileName(FirstFileInPath(outputDir,".sof"));

if (string.IsNullOrEmpty(sofFile))
{
Expand All @@ -64,7 +77,7 @@ public async Task DownloadAsync(UniversalFpgaProjectRoot project)
pgmArgs.AddRange(["-o", $"{shortTermOperation};{sofFile}"]);

await childProcessService.ExecuteShellAsync("quartus_pgm", pgmArgs,
project.FullPath, "Running Quartus programmer (Short-Term)...", AppState.Loading, true);
outputDir, "Running Quartus programmer (Short-Term)...", AppState.Loading, true);
}
else
{
Expand All @@ -74,7 +87,7 @@ await childProcessService.ExecuteShellAsync("quartus_pgm", pgmArgs,

if (longTermFormat.Equals("pof", StringComparison.OrdinalIgnoreCase))
{
var pofFile = Path.GetFileName(FirstFileInPath(project.FullPath, ".pof") ?? "");
var pofFile = Path.GetFileName(FirstFileInPath(outputDir, ".pof") ?? "");

if (string.IsNullOrEmpty(pofFile))
{
Expand All @@ -87,7 +100,7 @@ await childProcessService.ExecuteShellAsync("quartus_pgm", pgmArgs,
else
{
//Use CPF to convert SOF in given format
var sofFile = Path.GetFileName(FirstFileInPath(project.FullPath, ".sof") ?? "");
var sofFile = Path.GetFileName(FirstFileInPath(outputDir, ".sof") ?? "");

if (string.IsNullOrEmpty(sofFile))
{
Expand All @@ -109,7 +122,7 @@ await childProcessService.ExecuteShellAsync("quartus_pgm", pgmArgs,
cpfArgs.AddRange(["-c", sofFile, convertedFilePath]);

var result = await childProcessService.ExecuteShellAsync("quartus_cpf", cpfArgs,
project.FullPath, $"Converting .sof to .{longTermFormat.ToLower()}...");
outputDir, $"Converting .sof to .{longTermFormat.ToLower()}...");

if (!result.success) return;

Expand All @@ -125,7 +138,7 @@ await childProcessService.ExecuteShellAsync("quartus_pgm", pgmArgs,
pgmArgs.AddRange(["-o", $"{longTermOperation};{programFile}"]);

await childProcessService.ExecuteShellAsync("quartus_pgm", pgmArgs,
project.FullPath, "Running Quartus programmer (Long-Term)...", AppState.Loading, true);
outputDir, "Running Quartus programmer (Long-Term)...", AppState.Loading, true);
}
}
}

0 comments on commit e2bcdfb

Please sign in to comment.