Skip to content

Commit

Permalink
Add: ELF Support for Web App
Browse files Browse the repository at this point in the history
  • Loading branch information
rizwan3d committed Oct 10, 2023
1 parent 2785546 commit b79d7ae
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion WebRISCV/Pages/Index.razor
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
</div>
</div>
<div class="col text-end">
<a class="btn btn-primary" @onclick="buildELF">Build Linux ELF</a>
<a class="btn btn-primary" @onclick="buildPE">Build Windows PE</a>
<a class="btn btn-primary" @onclick="buildHex">Build Hex</a>
<a class="btn btn-primary" @onclick="build">Build Console</a>
Expand Down Expand Up @@ -145,10 +146,24 @@
StateHasChanged();
}

private async void buildELF()
{
Address.SetAddress(0);
RiscVAssembler.Assamble(fileContent);
var finalData = new SharpRISCV.Core.Elf.Compile("").bytes();
string output = string.Empty;
output += $"Check You Download.{Environment.NewLine}";
this.output = output;

await DownloadFile(finalData.ToArray());

StateHasChanged();
}

private async Task DownloadFile(byte[] finalDataWithCheckSum)
{
var base64 = Convert.ToBase64String(finalDataWithCheckSum);
await JSRuntime.InvokeVoidAsync("downloadFile", "risc-v.exe", base64);
await JSRuntime.InvokeVoidAsync("downloadFile", "risc-v.elf", base64);
}
}

Expand Down

0 comments on commit b79d7ae

Please sign in to comment.