aboutsummaryrefslogtreecommitdiffstats
path: root/iceprog
diff options
context:
space:
mode:
Diffstat (limited to 'iceprog')
-rw-r--r--iceprog/Makefile8
-rw-r--r--iceprog/iceprog.c8
2 files changed, 8 insertions, 8 deletions
diff --git a/iceprog/Makefile b/iceprog/Makefile
index 578a3e3..4ffb9a5 100644
--- a/iceprog/Makefile
+++ b/iceprog/Makefile
@@ -1,8 +1,7 @@
-# CC = clang
+include ../config.mk
LDLIBS = -L/usr/local/lib -lftdi -lm
CFLAGS = -MD -O0 -ggdb -Wall -std=c99 -I/usr/local/include
MXEGCC = /usr/local/src/mxe/usr/bin/i686-pc-mingw32-gcc
-DESTDIR = /usr/local
all: iceprog
@@ -12,10 +11,11 @@ iceprog.exe: iceprog.c
$(MXEGCC) -std=c99 -o iceprog.exe -Os iceprog.c -lftdi -lusb -lm
install: all
- cp iceprog $(DESTDIR)/bin/iceprog
+ mkdir -p $(DESTDIR)$(PREFIX)/bin
+ cp iceprog $(DESTDIR)$(PREFIX)/bin/iceprog
uninstall:
- rm -f $(DESTDIR)/bin/iceprog
+ rm -f $(DESTDIR)$(PREFIX)/bin/iceprog
clean:
rm -f iceprog
diff --git a/iceprog/iceprog.c b/iceprog/iceprog.c
index d5419bd..26f893f 100644
--- a/iceprog/iceprog.c
+++ b/iceprog/iceprog.c
@@ -202,7 +202,7 @@ void flash_64kB_sector_erase(int addr)
{
fprintf(stderr, "erase 64kB sector at 0x%06X..\n", addr);
- uint8_t command[4] = { 0xd8, addr >> 16, addr >> 8, addr };
+ uint8_t command[4] = { 0xd8, (uint8_t)(addr >> 16), (uint8_t)(addr >> 8), (uint8_t)addr };
set_gpio(0, 0);
send_spi(command, 4);
set_gpio(1, 0);
@@ -213,7 +213,7 @@ void flash_prog(int addr, uint8_t *data, int n)
if (verbose)
fprintf(stderr, "prog 0x%06X +0x%03X..\n", addr, n);
- uint8_t command[4] = { 0x02, addr >> 16, addr >> 8, addr };
+ uint8_t command[4] = { 0x02, (uint8_t)(addr >> 16), (uint8_t)(addr >> 8), (uint8_t)addr };
set_gpio(0, 0);
send_spi(command, 4);
send_spi(data, n);
@@ -229,7 +229,7 @@ void flash_read(int addr, uint8_t *data, int n)
if (verbose)
fprintf(stderr, "read 0x%06X +0x%03X..\n", addr, n);
- uint8_t command[4] = { 0x03, addr >> 16, addr >> 8, addr };
+ uint8_t command[4] = { 0x03, (uint8_t)(addr >> 16), (uint8_t)(addr >> 8), (uint8_t)addr };
set_gpio(0, 0);
send_spi(command, 4);
memset(data, 0, n);
@@ -338,7 +338,7 @@ int main(int argc, char **argv)
bool test_mode = false;
const char *filename = NULL;
const char *devstr = NULL;
- int ifnum = INTERFACE_A;
+ enum ftdi_interface ifnum = INTERFACE_A;
int opt;
while ((opt = getopt(argc, argv, "d:I:rRcbnStv")) != -1)