68 lines
1.3 KiB
C++
68 lines
1.3 KiB
C++
// omf2hex.cpp : This file contains the 'main' function. Program execution begins and ends there.
|
|
//
|
|
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
|
|
#include "symfile.h"
|
|
|
|
//------------------------------------------------------------------------------
|
|
void helpText()
|
|
{
|
|
printf("blockgen - v1.0\n");
|
|
printf("--------------\n");
|
|
printf("Convert mos-llvm elf file symboles into a C header file\n");
|
|
printf("\nblock [options] <file.elf>\n");
|
|
printf(" -v verbose\n\n");
|
|
|
|
exit(-1);
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
int main(int argc, char* argv[])
|
|
{
|
|
char* pInfilePath = nullptr;
|
|
bool bVerbose = false;
|
|
|
|
for (int idx = 1; idx < argc; ++idx )
|
|
{
|
|
char* arg = argv[ idx ];
|
|
|
|
if ('-' == arg[0])
|
|
{
|
|
// Parse as an option
|
|
if ('v'==arg[1])
|
|
{
|
|
bVerbose = true;
|
|
}
|
|
}
|
|
else if (nullptr == pInfilePath)
|
|
{
|
|
// Assume the first non-option is an input file path
|
|
pInfilePath = argv[ idx ];
|
|
}
|
|
else
|
|
{
|
|
// Oh Crap, we have a non-option, but we don't know what to do with
|
|
// it
|
|
printf("ERROR: Invalid option, Arg %d = %s\n\n", idx, argv[ idx ]);
|
|
helpText();
|
|
}
|
|
}
|
|
|
|
if (pInfilePath)
|
|
{
|
|
// Load the .sym File
|
|
SYMFile *pSymFile = new SYMFile(std::string(pInfilePath));
|
|
delete pSymFile;
|
|
}
|
|
else
|
|
{
|
|
helpText();
|
|
}
|
|
|
|
|
|
return 0;
|
|
}
|
|
|