Remove SymbolTableBuilder
This commit is contained in:
parent
27542a0e9e
commit
9259a5d339
|
@ -3,6 +3,3 @@ $pwd = $pwd.Path
|
|||
|
||||
& dotnet build tools/ScriptTool -o "$([IO.Path]::Combine($pwd, "bin/ScriptTool"))"
|
||||
if ($LASTEXITCODE -ne 0) { exit -1 }
|
||||
|
||||
& dotnet build tools/SymbolTableBuilder -o "$([IO.Path]::Combine($pwd, "bin/SymbolTableBuilder"))"
|
||||
if ($LASTEXITCODE -ne 0) { exit -1 }
|
||||
|
|
11
build.ps1
11
build.ps1
|
@ -16,7 +16,6 @@ $input_c_files =
|
|||
|
||||
$base_c_address = 0x8100000;
|
||||
$scripttool_cmd = "bin/ScriptTool/ScriptTool.dll"
|
||||
$symbuilder_cmd = "bin/SymbolTableBuilder/SymbolTableBuilder.dll"
|
||||
$gcc_cmd = "arm-none-eabi-gcc"
|
||||
$ld_cmd = "arm-none-eabi-ld"
|
||||
$objdump_cmd = "arm-none-eabi-objdump"
|
||||
|
@ -136,7 +135,7 @@ Function New-Symbol([string]$symbol_string)
|
|||
|
||||
Function Get-SymfileSymbols([string]$symbol_file)
|
||||
{
|
||||
return Get-Content $symbol_file | ForEach-Object { New-SymfileSymbol $_ } | Where-Object { $_ -ne $null }
|
||||
return Get-Content $symbol_file | ForEach-Object { New-SymfileSymbol $_ } | Where-Object { $null -ne $_ }
|
||||
}
|
||||
|
||||
$symfile_symbol_regex = "(?'value'[0-9a-fA-F]{8})\s+(?'name'(?>\.|@@|[a-zA-Z0-9_])[a-zA-Z0-9_]+):{0,1}(?'size'[0-9a-fA-F]+){0,1}"
|
||||
|
@ -332,10 +331,7 @@ is to separate the compiling and linking stages of the C code.
|
|||
- m12.sym
|
||||
|
||||
Remarks:
|
||||
- This is a merged symbol file for debugging convenience.
|
||||
- The assembler generates a dummy .byt symbol at the base address; remove it.
|
||||
- Use SymbolTableBuilder to do the merge, plus remove the undesirable namespaces that
|
||||
the assembler inserts.
|
||||
- This is just the input files concatenated (and sorted for convenience).
|
||||
#>
|
||||
|
||||
$timer = [System.Diagnostics.StopWatch]::StartNew()
|
||||
|
@ -418,8 +414,7 @@ $rom_bytes = [IO.File]::ReadAllBytes($output_rom_file)
|
|||
|
||||
# -------------------------- GENERATE SYMBOLS -----------------------
|
||||
"Generating $output_rom_sym_file..."
|
||||
& dotnet $symbuilder_cmd $output_rom_sym_file "$([IO.Path]::Combine($src_dir, $hack_sym_file))" "$([IO.Path]::Combine($working_dir, $includes_sym_file))"
|
||||
if ($LASTEXITCODE -ne 0) { exit -1 }
|
||||
($hack_symbols + $includes_symbols) | Sort-Object Name | ForEach-Object { "$($_.Value.ToString("X8")) $($_.Name)" } | Set-Content $output_rom_sym_file
|
||||
|
||||
"Finished compiling $output_rom_file in $($timer.Elapsed.TotalSeconds.ToString("F3")) s"
|
||||
|
||||
|
|
|
@ -5,8 +5,6 @@ VisualStudioVersion = 16.0.28407.52
|
|||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ScriptTool", "ScriptTool\ScriptTool.csproj", "{29AB41A8-6405-4C4B-A374-BF1BD7AF1A27}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SymbolTableBuilder", "SymbolTableBuilder\SymbolTableBuilder.csproj", "{2E0E2F98-4EB7-48C7-968D-1BEDCADA37F2}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ScriptToolGui", "ScriptToolGui\ScriptToolGui.csproj", "{BAE5CBBF-D0B3-4F82-A80A-957CEC379238}"
|
||||
EndProject
|
||||
Global
|
||||
|
@ -19,10 +17,6 @@ Global
|
|||
{29AB41A8-6405-4C4B-A374-BF1BD7AF1A27}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{29AB41A8-6405-4C4B-A374-BF1BD7AF1A27}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{29AB41A8-6405-4C4B-A374-BF1BD7AF1A27}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{2E0E2F98-4EB7-48C7-968D-1BEDCADA37F2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{2E0E2F98-4EB7-48C7-968D-1BEDCADA37F2}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{2E0E2F98-4EB7-48C7-968D-1BEDCADA37F2}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{2E0E2F98-4EB7-48C7-968D-1BEDCADA37F2}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{BAE5CBBF-D0B3-4F82-A80A-957CEC379238}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{BAE5CBBF-D0B3-4F82-A80A-957CEC379238}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{BAE5CBBF-D0B3-4F82-A80A-957CEC379238}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
|
|
|
@ -1,78 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.IO;
|
||||
|
||||
namespace SymbolTableBuilder
|
||||
{
|
||||
class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
// Arg 0: output file
|
||||
// Remaining args: input files to combine
|
||||
|
||||
if (args.Length < 1)
|
||||
{
|
||||
Usage();
|
||||
return;
|
||||
}
|
||||
|
||||
string outputFile = args[0];
|
||||
var inputFiles = args.Skip(1);
|
||||
var table = new List<string>();
|
||||
|
||||
foreach (string inputFile in inputFiles)
|
||||
{
|
||||
ParseTable(inputFile, table);
|
||||
}
|
||||
|
||||
using (var writer = File.CreateText(outputFile))
|
||||
{
|
||||
foreach (var line in table)
|
||||
writer.WriteLine(line);
|
||||
}
|
||||
}
|
||||
|
||||
static void Usage()
|
||||
{
|
||||
Console.WriteLine("Usage: symbols.exe [output] [input1] [input2] ...");
|
||||
}
|
||||
|
||||
static void ParseTable(string inputFile, List<string> outputTable)
|
||||
{
|
||||
using (var reader = File.OpenText(inputFile))
|
||||
{
|
||||
string line;
|
||||
while ((line = reader.ReadLine()) != null)
|
||||
{
|
||||
outputTable.Add(RemoveNamespace(line));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static string RemoveNamespace(string line)
|
||||
{
|
||||
int namespaceSeparatorIndex = line.IndexOf("::");
|
||||
if (namespaceSeparatorIndex >= 0)
|
||||
{
|
||||
// Backtrack to the start of the namespace
|
||||
int namespaceIndex = line.LastIndexOf(' ', namespaceSeparatorIndex);
|
||||
|
||||
// Get the address chunk
|
||||
string addressChunk = line.Substring(0, namespaceIndex);
|
||||
|
||||
// Get the remaining chunk
|
||||
string remainingChunk = line.Substring(namespaceSeparatorIndex + 2);
|
||||
|
||||
return addressChunk + " " + remainingChunk;
|
||||
}
|
||||
else
|
||||
{
|
||||
return line;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp2.1</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
Loading…
Reference in New Issue