Add argument parsing
This commit is contained in:
parent
0834cf0c0d
commit
7df813fc71
@ -9,7 +9,7 @@ int fpga_generate_bitstream(struct fpga_chain *chain,
|
||||
{
|
||||
int i;
|
||||
char *buf = NULL;
|
||||
FILE *bitstream = stderr;
|
||||
FILE *bitstream = stdout;
|
||||
|
||||
if (strcmp(filename, "-")) {
|
||||
bitstream = fopen(filename, "wb");
|
||||
|
@ -3,6 +3,8 @@
|
||||
#include "fpga_fdef_loader.h"
|
||||
#include "fpga_global.h"
|
||||
#include "fpga.h"
|
||||
#include "unistd.h"
|
||||
#include "string.h"
|
||||
|
||||
#define E_FDEF 1
|
||||
#define E_BITSTREAM 2
|
||||
@ -12,11 +14,37 @@ int development_test_main(int argc, char *argv[])
|
||||
struct fpga_cell *entry_cell;
|
||||
struct fpga_chain *chain;
|
||||
|
||||
int opt;
|
||||
char *fdef_filename = "fdef/4x4.fdef";
|
||||
char *kst_filename = "-";
|
||||
char *bitstream_filename = "-";
|
||||
|
||||
set_log_level(LL_DEBUG);
|
||||
|
||||
while((opt = getopt(argc, argv, "f:i:o:")) != -1)
|
||||
{
|
||||
switch(opt)
|
||||
{
|
||||
case 'f':
|
||||
fdef_filename = optarg;
|
||||
break;
|
||||
case 'i':
|
||||
kst_filename = optarg;
|
||||
report(LL_WARNING, "Input not yet implemented.");
|
||||
break;
|
||||
case 'o':
|
||||
bitstream_filename = optarg;
|
||||
break;
|
||||
case ':':
|
||||
case '?':
|
||||
printf("Usage: %s [-f fdef] [-i input.kst] [-o output.bin]",
|
||||
argv[0]);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
entry_cell = fpga_fdef_loader_load(fdef_filename);
|
||||
if (!entry_cell) {
|
||||
report(LL_CRITICAL, "Error loading FDEF.");
|
||||
|
Loading…
Reference in New Issue
Block a user