From aaea45bd46c7da846ec7fb5ee7bbdf89349120b8 Mon Sep 17 00:00:00 2001 From: Greg Davill Date: Sun, 19 Apr 2020 00:16:40 +0930 Subject: [PATCH] update program name --- .gitignore | 2 +- Makefile | 12 ++++++------ iceprog.c => ecpprog.c | 34 ++++++++++++---------------------- 3 files changed, 19 insertions(+), 29 deletions(-) rename iceprog.c => ecpprog.c (96%) diff --git a/.gitignore b/.gitignore index a37e2fc..5141302 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ -iceprog +ecpprog *.exe *.o *.d diff --git a/Makefile b/Makefile index 9d3e541..611d39d 100644 --- a/Makefile +++ b/Makefile @@ -48,21 +48,21 @@ LDLIBS += $(shell for pkg in libftdi1 libftdi; do $(PKG_CONFIG) --silence-errors CFLAGS += $(shell for pkg in libftdi1 libftdi; do $(PKG_CONFIG) --silence-errors --cflags $$pkg && exit; done; ) endif -all: $(PROGRAM_PREFIX)iceprog$(EXE) +all: $(PROGRAM_PREFIX)ecpprog$(EXE) -$(PROGRAM_PREFIX)iceprog$(EXE): iceprog.o mpsse.o jtag_tap.o +$(PROGRAM_PREFIX)ecpprog$(EXE): ecpprog.o mpsse.o jtag_tap.o $(CC) -o $@ $(LDFLAGS) $^ $(LDLIBS) install: all mkdir -p $(DESTDIR)$(PREFIX)/bin - cp $(PROGRAM_PREFIX)iceprog$(EXE) $(DESTDIR)$(PREFIX)/bin/$(PROGRAM_PREFIX)iceprog$(EXE) + cp $(PROGRAM_PREFIX)ecpprog$(EXE) $(DESTDIR)$(PREFIX)/bin/$(PROGRAM_PREFIX)ecpprog$(EXE) uninstall: - rm -f $(DESTDIR)$(PREFIX)/bin/$(PROGRAM_PREFIX)iceprog$(EXE) + rm -f $(DESTDIR)$(PREFIX)/bin/$(PROGRAM_PREFIX)ecpprog$(EXE) clean: - rm -f $(PROGRAM_PREFIX)iceprog - rm -f $(PROGRAM_PREFIX)iceprog.exe + rm -f $(PROGRAM_PREFIX)ecpprog + rm -f $(PROGRAM_PREFIX)ecpprog.exe rm -f *.o *.d -include *.d diff --git a/iceprog.c b/ecpprog.c similarity index 96% rename from iceprog.c rename to ecpprog.c index 7f39d70..4884a1c 100644 --- a/iceprog.c +++ b/ecpprog.c @@ -565,7 +565,7 @@ void ecp_jtag_cmd(uint8_t cmd){ static void help(const char *progname) { - fprintf(stderr, "Simple programming tool for FTDI-based Lattice iCE programmers.\n"); + fprintf(stderr, "Simple programming tool for FTDI-based Lattice ECP JTAG programmers.\n"); fprintf(stderr, "Usage: %s [-b|-n|-c] \n", progname); fprintf(stderr, " %s -r|-R \n", progname); fprintf(stderr, " %s -S \n", progname); @@ -620,20 +620,8 @@ static void help(const char *progname) fprintf(stderr, " iCE FTDI USB device),\n"); fprintf(stderr, " 3 if verification of the data failed.\n"); fprintf(stderr, "\n"); - fprintf(stderr, "Notes for iCEstick (iCE40HX-1k devel board):\n"); - fprintf(stderr, " An unmodified iCEstick can only be programmed via the serial flash.\n"); - fprintf(stderr, " Direct programming of the SRAM is not supported. For direct SRAM\n"); - fprintf(stderr, " programming the flash chip and one zero ohm resistor must be desoldered\n"); - fprintf(stderr, " and the FT2232H SI pin must be connected to the iCE SPI_SI pin, as shown\n"); - fprintf(stderr, " in this picture:\n"); - fprintf(stderr, " http://www.clifford.at/gallery/2014-elektronik/IMG_20141115_183838\n"); - fprintf(stderr, "\n"); - fprintf(stderr, "Notes for the iCE40-HX8K Breakout Board:\n"); - fprintf(stderr, " Make sure that the jumper settings on the board match the selected\n"); - fprintf(stderr, " mode (SRAM or FLASH). See the iCE40-HX8K user manual for details.\n"); - fprintf(stderr, "\n"); fprintf(stderr, "If you have a bug report, please file an issue on github:\n"); - fprintf(stderr, " https://github.com/cliffordwolf/icestorm/issues\n"); + fprintf(stderr, " https://github.com/gregdavill/ecpprog/issues\n"); } int main(int argc, char **argv) @@ -935,18 +923,20 @@ int main(int argc, char **argv) read_idcode(); read_status_register(); - /* Reset ECP5 to release SPI interface */ - ecp_jtag_cmd(ISC_ENABLE); - ecp_jtag_cmd(ISC_ERASE); - ecp_jtag_cmd(ISC_DISABLE); - - /* Put device into SPI bypass mode */ - enter_spi_background_mode(); - usleep(20000); if (test_mode) { + + + /* Reset ECP5 to release SPI interface */ + ecp_jtag_cmd(ISC_ENABLE); + ecp_jtag_cmd(ISC_ERASE); + ecp_jtag_cmd(ISC_DISABLE); + + /* Put device into SPI bypass mode */ + enter_spi_background_mode(); + flash_read_id(); } else if (prog_sram) -- 2.30.2