Automatically generate the fpga bit .h file

This commit is contained in:
Godzil 2014-01-16 22:24:54 +00:00
parent 1d928e7091
commit 7e0186d7a0
5 changed files with 23 additions and 8 deletions

View File

@ -198,7 +198,7 @@ ALL_ASFLAGS = -I. -x assembler-with-cpp $(ASFLAGS) $(CDEFS)
# Default target.
all: build
build: elf bin hex cfgware.h
build: cfgware.h elf bin hex
$(E) " SIZE $(TARGET).elf"
$(Q)$(ELFSIZE)|grep -v debug
cp $(TARGET).bin $(OBJDIR)/firmware.img
@ -235,6 +235,7 @@ ELFSIZE = $(SIZE) -A $(TARGET).elf
cfgware.h: $(OBJDIR)/fpga_rle.bit
$(E) " BIN2H $@"
$(Q) $(BIN2H) $< $@
$(OBJDIR)/fpga_rle.bit: sd2sneslite.bit
$(E) " RLE $@"
$(Q) $(RLE) $< $@

View File

@ -4,7 +4,7 @@
# file to a C header. No copyright claimed.
BEGIN {
print "// autoconf.h generated from " ARGV[1] " at " strftime() "\n" \
print "// autoconf.h generated from " ARGV[1] " at NOW\n" \
"#ifndef AUTOCONF_H\n" \
"#define AUTOCONF_H"
}

14
src/uncfgware.c Normal file
View File

@ -0,0 +1,14 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "cfgware.h"
int main(int argc, char *argv[])
{
int i;
for (i = 0; i < sizeof(cfgware); i++)
{
printf("%c", cfgware[i]);
}
return 0;
}

View File

@ -3,20 +3,20 @@
int main(int argc, char *argv[])
{
char var_name[30] = "cfgware"
char var_name[30] = "cfgware";
FILE *fpIn = NULL, *fpOut = NULL;
unsigned char buffer[5], i;
if ( argc == 4 )
if ( argc == 3 )
{
fpIn = fopen(argv[1], "rb");
fpOut = fopen(argv[2], "wt");
}
else if (argc == 3)
else if (argc == 2)
{
fpIn = fopen(argv[1], "rb");
fpOut = stdout;
}
else if ( argc == 2 )
else if ( argc == 1 )
{
fpIn = stdin;
fpOut = stdout;
@ -27,8 +27,8 @@ int main(int argc, char *argv[])
return -1;
}
if (argc > 1)
sprintf()
// if (argc > 1)
// sprintf()
if (fpIn == NULL) { fprintf(stderr, "Can't open '%s`: Aborting.", argv[1]); return -1; }
if (fpOut == NULL) { fprintf(stderr, "Can't open '%s`: Aborting.", argv[2]); return -1; }

Binary file not shown.