summaryrefslogtreecommitdiff
path: root/tools/updater
diff options
context:
space:
mode:
Diffstat (limited to 'tools/updater')
-rw-r--r--tools/updater/Makefile93
-rw-r--r--tools/updater/flash.c4
-rw-r--r--tools/updater/update.c4
3 files changed, 58 insertions, 43 deletions
diff --git a/tools/updater/Makefile b/tools/updater/Makefile
index 3fa1912..e9684cb 100644
--- a/tools/updater/Makefile
+++ b/tools/updater/Makefile
@@ -1,5 +1,5 @@
#
-# (C) Copyright 2000
+# (C) Copyright 2000-2006
# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
#
# See file CREDITS for list of people who contributed to this
@@ -25,62 +25,81 @@ LOAD_ADDR = 0x40000
include $(TOPDIR)/config.mk
-PROG = updater
-IMAGE = updater.image
-SRC = update.c flash.c flash_hw.c utils.c cmd_flash.c string.c ctype.c dummy.c
-ASRC = ppcstring.S
-OBJS = $(SRC:.c=.o) $(ASRC:.S=.o)
+PROG = $(obj)updater
+IMAGE = $(obj)updater.image
-LIB = $(TOPDIR)/examples/libstubs.a
-LIBAOBJS=
-LIBCOBJS= $(TOPDIR)/examples/stubs.o
-LIBOBJS = $(LIBAOBJS) $(LIBCOBJS)
+COBJS = update.o flash.o flash_hw.o utils.o cmd_flash.o string.o ctype.o dummy.o
+COBJS_LINKS = stubs.o
+AOBJS = ppcstring.o
+AOBJS_LINKS = memio.o
+
+OBJS := $(addprefix $(obj),$(COBJS) $(COBJS_LINKS) $(AOBJS) $(AOBJS_LINKS))
+SRCS := $(COBJS:.o=.c) $(AOBJS:.o=.S) $(addprefix $(obj), $(COBJS_LINKS:.o:.c) $(AOBJS_LINKS:.o:.S))
CPPFLAGS += -I$(TOPDIR) -I$(TOPDIR)/board/MAI/AmigaOneG3SE
CFLAGS += -I$(TOPDIR)/board/MAI/AmigaOneG3SE
+AFLAGS += -I$(TOPDIR)/board/MAI/AmigaOneG3SE
+
+DEPS = $(OBJTREE)/u-boot.bin $(OBJTREE)/tools/mkimage
+ifneq ($(DEPS),$(wildcard $(DEPS)))
+$(error "updater: Missing required objects, please run regular build first")
+endif
-all: .depend $(LIB) $(PROG)
+all: $(obj).depend $(PROG) $(IMAGE)
#########################################################################
-$(LIB): .depend $(LIBOBJS)
- $(AR) crv $@ $(LIBOBJS)
-%.srec: %.o $(LIB)
+$(obj)%.srec: %.o $(LIB)
$(LD) -g -Ttext $(LOAD_ADDR) -o $(<:.o=) -e $(<:.o=) $< $(LIB)
$(OBJCOPY) -O srec $(<:.o=) $@
-%.o: %.c
- $(CC) $(CPPFLAGS) -c $<
+$(obj)%.o: %.c
+ $(CC) $(CFLAGS) -c -o $@ $<
+
+$(obj)%.o: %.S
+ $(CC) $(AFLAGS) -c -o $@ $<
+
+$(obj)memio.o: $(obj)memio.S
+ $(CC) $(AFLAGS) -c -o $@ $<
-%.o: %.S
- $(CC) $(CPPFLAGS) -c $<
+$(obj)memio.S:
+ rm -f $(obj)memio.c
+ ln -s $(SRCTREE)/board/MAI/AmigaOneG3SE/memio.S $(obj)memio.S
+
+$(obj)stubs.o: $(obj)stubs.c
+ $(CC) $(CFLAGS) -c -o $@ $<
+
+$(obj)stubs.c:
+ rm -f $(obj)stubs.c
+ ln -s $(SRCTREE)/examples/stubs.c $(obj)stubs.c
#########################################################################
-updater: $(OBJS) $(LIB) $(TOPDIR)/board/MAI/AmigaOneG3SE/memio.o
- $(LD) -g -Ttext $(LOAD_ADDR) -o updater -e _main $(OBJS) $(LIB) \
- $(TOPDIR)/board/MAI/AmigaOneG3SE/memio.o
- $(OBJCOPY) -O binary updater updater.bin
+$(obj)updater: $(OBJS)
+ $(LD) -g -Ttext $(LOAD_ADDR) -o $(obj)updater -e _main $(OBJS)
+ $(OBJCOPY) -O binary $(obj)updater $(obj)updater.bin
-updater.image: updater $(TOPDIR)/u-boot.bin
- cat >/tmp/tempimage updater.bin junk $(TOPDIR)/u-boot.bin
- $(TOPDIR)/tools/mkimage -A ppc -O u-boot -T standalone -C none -a $(LOAD_ADDR) \
- -e `ppc-elf32-nm updater | grep _main | cut --bytes=0-8` \
- -n "Firmware Updater" -d /tmp/tempimage updater.image
+$(obj)updater.image: $(obj)updater $(OBJTREE)/u-boot.bin
+ cat >/tmp/tempimage $(obj)updater.bin junk $(OBJTREE)/u-boot.bin
+ $(OBJTREE)/tools/mkimage -A ppc -O u-boot -T standalone -C none -a $(LOAD_ADDR) \
+ -e `$(NM) $(obj)updater | grep _main | cut --bytes=0-8` \
+ -n "Firmware Updater" -d /tmp/tempimage $(obj)updater.image
rm /tmp/tempimage
- cp updater.image /tftpboot
+ cp $(obj)updater.image /tftpboot
-updater.image2: updater $(TOPDIR)/u-boot.bin
- cat >/tmp/tempimage updater.bin junk ../../create_image/image
- $(TOPDIR)/tools/mkimage -A ppc -O u-boot -T standalone -C none -a $(LOAD_ADDR) \
- -e `ppc-elf32-nm updater | grep _main | cut --bytes=0-8` \
- -n "Firmware Updater" -d /tmp/tempimage updater.image
+(obj)updater.image2: $(obj)updater $(OBJTREE)/u-boot.bin
+ cat >/tmp/tempimage $(obj)updater.bin junk ../../create_image/image
+ $(OBJTREE)/tools/mkimage -A ppc -O u-boot -T standalone -C none -a $(LOAD_ADDR) \
+ -e `$(NM) $(obj)updater | grep _main | cut --bytes=0-8` \
+ -n "Firmware Updater" -d /tmp/tempimage $(obj)updater.image
rm /tmp/tempimage
- cp updater.image /tftpboot
+ cp $(obj)updater.image /tftpboot
+
+#########################################################################
-.depend: Makefile $(SRC) $(ASRC) $(LIBCOBJS:.o=.c) $(LIBAOBJS:.o=.S)
- $(CC) -M $(CFLAGS) $(SRC) $(ASRC) $(LIBCOBJS:.o=.c) $(LIBAOBJS:.o=.S) > $@
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
-sinclude .depend
+sinclude $(obj).depend
#########################################################################
diff --git a/tools/updater/flash.c b/tools/updater/flash.c
index 32a1767..1ed77b1 100644
--- a/tools/updater/flash.c
+++ b/tools/updater/flash.c
@@ -1,5 +1,5 @@
/*
- * (C) Copyright 2000
+ * (C) Copyright 2000-2006
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
*
* See file CREDITS for list of people who contributed to this
@@ -124,7 +124,7 @@ addr2info (ulong addr)
* (only some targets require alignment)
*/
int
-flash_write (uchar *src, ulong addr, ulong cnt)
+flash_write (char *src, ulong addr, ulong cnt)
{
#ifdef CONFIG_SPD823TS
return (ERR_TIMOUT); /* any other error codes are possible as well */
diff --git a/tools/updater/update.c b/tools/updater/update.c
index b6d50d5..18f122a 100644
--- a/tools/updater/update.c
+++ b/tools/updater/update.c
@@ -46,10 +46,6 @@ void _main(void)
while (1);
}
-int flash_sect_protect (int p, ulong addr_first, ulong addr_last);
-int flash_sect_erase (ulong addr_first, ulong addr_last);
-int flash_write (uchar *src, ulong addr, ulong cnt);
-
void do_updater(void)
{
unsigned long *addr = &__dummy + 65;