Hi

1. without append any image CRC. boot.bin work fine

2. append any image CRC to boot.bin only 'a -- tests_images' not working and 
make system hang.

3. I try to apply this patch.(attachment) same at 2).

I tried many method. can't make boot.crc.bin works. if there a way to debug 
boot.bin?


4. is the minimac PHY id changed? now it always give 0045.

5. is there any MIDI core changed I need to know? needs update on boot.bin?


thanks.
>From 767c21064aa8a6fa826bff339e080615f8f15702 Mon Sep 17 00:00:00 2001
From: Xiangfu Liu <[email protected]>
Date: Wed, 14 Dec 2011 14:55:30 +0800
Subject: [PATCH] .h file style images crc

---
 src/Makefile          |   16 ++++++++--
 src/append_crc_len.sh |   75 -------------------------------------------------
 src/create_crc_len.sh |   46 ++++++++++++++++++++++++++++++
 src/tests_images.c    |   22 ++++++++------
 4 files changed, 70 insertions(+), 89 deletions(-)
 delete mode 100755 src/append_crc_len.sh
 create mode 100755 src/create_crc_len.sh

diff --git a/src/Makefile b/src/Makefile
index 1891d1f..68940d9 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -30,6 +30,16 @@ boot.elf: linker.ld $(OBJECTS) $(LIBS)
 	$(LD) $(LDFLAGS) $(OBJECTS) -o $@ $(LDLIBS)
 	chmod -x $@
 
+ifneq ($(IMAGES_DIR),)
+CFLAGS+= -DIMAGES_CRC
+
+tests_images.o: images_crc.h
+
+images_crc.h:
+	./create_crc_len.sh "$(IMAGES_DIR)" > $@
+endif
+
+
 load: boot.bin
 	make -C $(MMDIR)/tools/
 	$(MMDIR)/tools/flterm --port /dev/ttyUSB0 --kernel boot.bin
@@ -48,11 +58,9 @@ $(MMDIR)/software/libmath/libmath.a:
 
 .PHONY: clean depend load boot.crc.bin $(LIBS)
 
-boot.crc.bin: boot.bin
-	IMAGES_DIR=$(IMAGES_DIR) ./append_crc_len.sh
-
 depend:
 	makedepend -Y -- $(CFLAGS) -- *.c
 
 clean:
-	rm -f $(OBJECTS) boot.elf boot.bin boot.crc.*.bin .*~ *~ Makefile.bak
+	rm -f $(OBJECTS) boot.elf boot.bin boot.crc.*.bin .*~ *~ Makefile.bak \
+	  images_crc.h
diff --git a/src/append_crc_len.sh b/src/append_crc_len.sh
deleted file mode 100755
index 433720e..0000000
--- a/src/append_crc_len.sh
+++ /dev/null
@@ -1,75 +0,0 @@
-#!/bin/bash
-
-REV=$(git rev-parse HEAD | cut -b1-7)
-BOOT_CRC_BIN="boot.crc.${REV}.bin"
-
-CRC_LEN_TMP=`mktemp`
-BOOT_BIN_TMP=`mktemp`
-
-FILENAMES=\
-standby.fpg,\
-soc-rescue.fpg,\
-bios-rescue-without-CRC.bin,\
-splash-rescue.raw,\
-flickernoise.fbi,\
-soc.fpg,\
-bios.bin,\
-splash.raw,\
-flickernoise.fbi
-
-IFS=','  FILES=( ${FILENAMES} )
-
-create_crc_len_file() {
-    CRC=`mkmmimg $1 | awk '{print $3}'`
-    LEN=`ls -l   $1 | awk '{printf "%08x\n",$5}'`
-
-    if [ `basename "$1"` == "bios-rescue-without-CRC.bin" ]; then
-	CRC="00000000"
-    fi
-    if [ `basename "$1"` == "bios.bin" ]; then
-	CRC="00000000"
-	LEN=`ls -l   $1 | awk '{printf "%08x\n",$5-4}'`
-    fi
-    if [ `basename "$1"` == "flickernoise.fbi" ]; then
-	CRC="00000000"
-	LEN="00000000"
-    fi
-    # 0 mean length/crc included by themself 
-
-    CRC1=`echo $CRC | cut -b1-2`
-    CRC2=`echo $CRC | cut -b3-4`
-    CRC3=`echo $CRC | cut -b5-6`
-    CRC4=`echo $CRC | cut -b7-8`
-
-    LEN1=`echo $LEN | cut -b1-2`
-    LEN2=`echo $LEN | cut -b3-4`
-    LEN3=`echo $LEN | cut -b5-6`
-    LEN4=`echo $LEN | cut -b7-8`
-
-    printf "\\x$(printf "%x" 0x${CRC1})" >  ${CRC_LEN_TMP}
-    printf "\\x$(printf "%x" 0x${CRC2})" >> ${CRC_LEN_TMP}
-    printf "\\x$(printf "%x" 0x${CRC3})" >> ${CRC_LEN_TMP}
-    printf "\\x$(printf "%x" 0x${CRC4})" >> ${CRC_LEN_TMP}
-
-    printf "\\x$(printf "%x" 0x${LEN1})" >> ${CRC_LEN_TMP}
-    printf "\\x$(printf "%x" 0x${LEN2})" >> ${CRC_LEN_TMP}
-    printf "\\x$(printf "%x" 0x${LEN3})" >> ${CRC_LEN_TMP}
-    printf "\\x$(printf "%x" 0x${LEN4})" >> ${CRC_LEN_TMP}
-}
-
-cp boot.bin ${BOOT_CRC_BIN}
-
-for (( i=0; i<9; i++ ))
-do
-    if [ -e ${IMAGES_DIR}/${FILES[i]} ]; then
-	create_crc_len_file ${IMAGES_DIR}/${FILES[i]}
-	cp -f ${BOOT_CRC_BIN} ${BOOT_BIN_TMP}
-	cat ${BOOT_BIN_TMP} ${CRC_LEN_TMP} > ${BOOT_CRC_BIN}
-    else
-	echo "${IMAGES_DIR}/${FILES[i]} not exist, check IMAGES_DIR value"
-	exit 1
-    fi
-done
-
-echo "${BOOT_CRC_BIN} created"
-exit 0
diff --git a/src/create_crc_len.sh b/src/create_crc_len.sh
new file mode 100755
index 0000000..61d51f0
--- /dev/null
+++ b/src/create_crc_len.sh
@@ -0,0 +1,46 @@
+#!/bin/bash
+
+FILENAMES=\
+standby.fpg,\
+soc-rescue.fpg,\
+bios-rescue-without-CRC.bin,\
+splash-rescue.raw,\
+flickernoise.fbi,\
+soc.fpg,\
+bios.bin,\
+splash.raw,\
+flickernoise.fbi
+
+IFS=','  FILES=( ${FILENAMES} )
+
+create_crc_len_file() {
+    CRC=`mkmmimg $1 | awk '{print $3}'`
+    LEN=`ls -l   $1 | awk '{printf "%08x\n",$5}'`
+
+    if [ `basename "$1"` == "bios-rescue-without-CRC.bin" ]; then
+	CRC="00000000"
+    fi
+    if [ `basename "$1"` == "bios.bin" ]; then
+	CRC="00000000"
+	LEN=`ls -l   $1 | awk '{printf "%08x\n",$5-4}'`
+    fi
+    if [ `basename "$1"` == "flickernoise.fbi" ]; then
+	CRC="00000000"
+	LEN="00000000"
+    fi
+    # 0 mean length/crc included by themself 
+
+    echo "0x$CRC,"
+    echo "0x$LEN,"
+}
+
+for (( i=0; i<9; i++ ))
+do
+    if [ -e $1/${FILES[i]} ]; then
+	create_crc_len_file $1/${FILES[i]}
+    else
+	exit 1
+    fi
+done
+
+exit 0
diff --git a/src/tests_images.c b/src/tests_images.c
index 9111b4c..de9c434 100644
--- a/src/tests_images.c
+++ b/src/tests_images.c
@@ -58,15 +58,18 @@ static int compare_crc(unsigned int *flashbase, unsigned int crc, unsigned int l
 	return TEST_STATUS_PASSED;
 }
 
-extern unsigned int _edata;
-
+#define IMAGES_COUNT 9
 static int compare_loop()
 {
-	int i, ret, count;
-	unsigned int crc, len;
-	unsigned int *crc_addr = &_edata;
+	int i, j, ret, count;
+	unsigned int crc_len[IMAGES_COUNT * 2] = {
+#ifdef IMAGES_CRC
+		#include "images_crc.h"
+#else
+		0
+#endif
+	};
 
-#define IMAGES_COUNT 9
 	static char *images_name[IMAGES_COUNT] = {
 		"standby.fpg",
 		"soc-rescue.fpg",
@@ -97,13 +100,12 @@ static int compare_loop()
 	 */
 
 	count = 0;
+	j = 0;
 	for(i = 0; i < IMAGES_COUNT; i++) {
-		crc = *crc_addr++;
-		len = *crc_addr++;
-
 		printf("  %s\t", images_name[i]);
 
-		ret = compare_crc((unsigned int *)images_addr[i], crc, len);
+		ret = compare_crc((unsigned int *)images_addr[i], crc_len[j], crc_len[j + 1]);
+		j += 2;
 		if(ret == TEST_STATUS_FAILED)
 			count++;
 	}
-- 
1.7.4.1

_______________________________________________
http://lists.milkymist.org/listinfo.cgi/devel-milkymist.org
IRC: #milkymist@Freenode

Reply via email to