[Feature][ZXW-130]merge P50U02 version
Only Configure: No
Affected branch: master
Affected module: unknow
Is it affected on both ZXIC and MTK: only ZXIC
Self-test: Yes
Doc Update: No
Change-Id: I4f29ec5bb7c59385f23738d2b7ca84e67c100f69
diff --git a/boot/common/scripts/Makefile b/boot/common/scripts/Makefile
index f9e743a..f71c564 100755
--- a/boot/common/scripts/Makefile
+++ b/boot/common/scripts/Makefile
@@ -100,41 +100,17 @@
ram_text=0x21EF0000
endif
-ifeq ($(strip $(board)),$(filter $(board),mdl_ab))
- key_path=$(subst _ab,,$(board))
-endif
-
ifeq ($(strip $(board)),$(filter $(board),vehicle_dc))
- key_path=mdl
-endif
-
+ key_path=key/RSA_2048/private.k
+else
ifeq ($(strip $(board)),$(filter $(board),vehicle_dc_ref))
- key_path=mdl
+ key_path=key/RSA_2048/private.k
+else
+ key_path=key/RSA_1024/private.k -t md5
+endif
endif
-ifeq ($(strip $(board)),$(filter $(board),mdl_mini mifi_mini ufi_mini))
- key_path=$(subst _mini,,$(board))
-endif
-ifeq ($(strip $(board)),$(filter $(board),mifi_mini_xr819))
- key_path=$(subst _mini_xr819,,$(board))
-endif
-
-ifeq ($(strip $(board)),$(filter $(board),mdl_mini_64 mifi_mini_64))
- key_path=$(subst _mini_64,,$(board))
-endif
-
-ifeq ($(strip $(board)),$(filter $(board),watch_cap))
- key_path=$(subst _cap,,$(board))
-endif
-
-ifeq ($(strip $(board)),$(filter $(board),cpe_switch))
- key_path=$(subst _switch,,$(board))
-endif
-
-ifeq ($(strip $(board)),$(filter $(board),cpe evb fwp mdl mifi phone watch))
- key_path=$(board)
-endif
export chip board key_path ram_text V3T_RAM_TEXT_64M_UBOOT
@@ -152,7 +128,6 @@
tloader:
chmod -R 777 ../../../$(SRCROOT)
- cp -rf $(BOOTLOADER_PRJ_PATH)/../../tools/SignImage/test_key/$(key_path)/key.h $(BOOTLOADER_PATH)/src/loader/include
cd $(BOOTLOADER_PATH)/scripts/build && sh ./build_tloader.sh
@cp $(BOOTLOADER_PATH)/src/loader/z-load $(BOOTLOADER_PRJ_PATH)/$(chip)/$(board)/bin/z-load
@cp $(BOOTLOADER_PATH)/src/loader/z-load.map $(BOOTLOADER_PRJ_PATH)/$(chip)/$(board)/bin/z-load.map
@@ -161,7 +136,6 @@
zloader:
chmod -R 777 ../../../$(SRCROOT)
- cp -rf $(BOOTLOADER_PRJ_PATH)/../../tools/SignImage/test_key/$(key_path)/key.h $(BOOTLOADER_PATH)/src/loader/include
cd $(BOOTLOADER_PATH)/scripts/build && sh ./build_zloader_dlon.sh
@cp $(BOOTLOADER_PATH)/src/loader/z-load $(BOOTLOADER_PRJ_PATH)/$(chip)/$(board)/bin/dl_on/z-load
@cp $(BOOTLOADER_PATH)/src/loader/z-load.map $(BOOTLOADER_PRJ_PATH)/$(chip)/$(board)/bin/dl_on/z-load.map
diff --git a/boot/common/scripts/build/build_tloader.sh b/boot/common/scripts/build/build_tloader.sh
index a670737..326af64 100755
--- a/boot/common/scripts/build/build_tloader.sh
+++ b/boot/common/scripts/build/build_tloader.sh
@@ -24,17 +24,10 @@
if [ $is_ok -eq 1 ];then
echo "";
- echo "Configuring ["$chip"_"$board"_tloader_config] for ["$chip" "$board" "$key_path"] board ...";
+ echo "Configuring ["$chip"_"$board"_tloader_config] for ["$chip" "$board"] board ...";
- mkdir -p $KEYS_PATH/Input
- mkdir -p $KEYS_PATH/Output
chmod -R 777 $SRC_PATH/
- cp z-load.bin $KEYS_PATH/Input/tloader.bin
- cd $KEYS_PATH
- ./SignImage -z ./Input/tloader.bin ./test_key/$key_path/private.k
- cp ./Input/tloader.bin $SRC_PATH/prj/$chip/$board/bin/tloader.bin
- rm -rf Input
- rm -rf Output
+ $SRC_PATH/../tools/SignTool/SignImage -z -i z-load.bin -o $SRC_PATH/prj/$chip/$board/bin/tloader.bin -k $SRC_PATH/../tools/SignTool/key/RSA_1024/private.k
echo "--Finished build [tloader.bin ] ...";
echo "................................................OK....";
diff --git a/boot/common/scripts/build/build_uboot.sh b/boot/common/scripts/build/build_uboot.sh
index 17ce8d3..54a1b1b 100755
--- a/boot/common/scripts/build/build_uboot.sh
+++ b/boot/common/scripts/build/build_uboot.sh
@@ -48,18 +48,9 @@
cp uboot.bin tboot.bin
mv tboot.bin $BIN_PATH/tboot.bin
- mkdir -p $KEYS_PATH/Input
- mkdir -p $KEYS_PATH/Output
chmod -R 777 $SRC_PATH/
- cp uboot.bin $KEYS_PATH/Input/uboot.bin
- rm uboot.bin;
- chmod -R a+x $KEYS_PATH/
- cd $KEYS_PATH/
- ./SignImage -s ./Input/uboot.bin ./Output/uboot.bin ./test_key/"$key_path"/private.k
- cp ./Output/uboot.bin $BIN_PATH/uboot.bin
+ $SRC_PATH/../tools/SignTool/SignImage -i uboot.bin -o $BIN_PATH/uboot.bin -k $SRC_PATH/../tools/SignTool/$key_path
cp $BIN_PATH/uboot.bin $BIN_PATH/uboot-mirr.bin
- rm -rf Input
- rm -rf Output
cd $SRC_PATH/common/src/uboot;
cp ./u-boot $BIN_PATH
diff --git a/boot/common/scripts/build/build_zloader_dloff.sh b/boot/common/scripts/build/build_zloader_dloff.sh
index 9f90a34..198394e 100755
--- a/boot/common/scripts/build/build_zloader_dloff.sh
+++ b/boot/common/scripts/build/build_zloader_dloff.sh
@@ -23,21 +23,14 @@
if [ $is_ok -eq 1 ];then
echo "";
- echo "Configuring ["$chip"_"$board"_zloader_dloff_config] for ["$chip" "$board" "$key_path"] board ...";
+ echo "Configuring ["$chip"_"$board"_zloader_dloff_config] for ["$chip" "$board"] board ...";
cp z-load.bin $SRC_PATH/common/scripts/tools;
cd $SRC_PATH/common/scripts/tools;
./expand z-load.bin;
- mkdir -p $KEYS_PATH/Input
- mkdir -p $KEYS_PATH/Output
chmod -R 777 $SRC_PATH/
- mv z-load.bin $KEYS_PATH/Input/zloader.bin
- cd $KEYS_PATH
- ./SignImage -z ./Input/zloader.bin ./test_key/$key_path/private.k
- cp ./Input/zloader.bin $SRC_PATH/prj/$chip/$board/bin/dl_off/zloader.bin
- rm -rf Input
- rm -rf Output
+ $SRC_PATH/../tools/SignTool/SignImage -z -i z-load.bin -o $SRC_PATH/prj/$chip/$board/bin/dl_off/zloader.bin -k $SRC_PATH/../tools/SignTool/key/RSA_1024/private.k
echo "--Finished build [zloader.bin] ...";
echo "................................................OK....";
diff --git a/boot/common/scripts/build/build_zloader_dlon.sh b/boot/common/scripts/build/build_zloader_dlon.sh
index bfc6394..b5daa43 100755
--- a/boot/common/scripts/build/build_zloader_dlon.sh
+++ b/boot/common/scripts/build/build_zloader_dlon.sh
@@ -23,22 +23,15 @@
if [ $is_ok -eq 1 ];then
echo "";
- echo "Configuring ["$chip"_"$board"_zloader_dlon_config] for ["$chip" "$board" "$key_path"] board ...";
+ echo "Configuring ["$chip"_"$board"_zloader_dlon_config] for ["$chip" "$board"] board ...";
cp z-load.bin $SRC_PATH/common/scripts/tools;
cd $SRC_PATH/common/scripts/tools;
./expand z-load.bin;
-
- mkdir -p $KEYS_PATH/Input
- mkdir -p $KEYS_PATH/Output
+
chmod -R 777 $SRC_PATH/
- mv z-load.bin $KEYS_PATH/Input/zloader.bin
- cd $KEYS_PATH
- ./SignImage -z ./Input/zloader.bin ./test_key/$key_path/private.k
- cp ./Input/zloader.bin $SRC_PATH/prj/$chip/$board/bin/dl_on/zloader.bin
- rm -rf Input
- rm -rf Output
-
+ $SRC_PATH/../tools/SignTool/SignImage -z -i z-load.bin -o $SRC_PATH/prj/$chip/$board/bin/dl_on/zloader.bin -k $SRC_PATH/../tools/SignTool/key/RSA_1024/private.k
+
echo "--Finished build [zloader.bin] ...";
echo "................................................OK....";
echo "";
diff --git a/boot/common/src/loader/drivers/efuse.c b/boot/common/src/loader/drivers/efuse.c
old mode 100644
new mode 100755
index c4dc051..2b2cc08
--- a/boot/common/src/loader/drivers/efuse.c
+++ b/boot/common/src/loader/drivers/efuse.c
@@ -47,7 +47,9 @@
ddr_flag = CHIP_DDR_64M;
}
else if(((psEfuseInfo->secure_flag >> 8) == ZX297520V3ECOSC_GW_NYC_2G_DDR)
- ||((psEfuseInfo->secure_flag >> 8) == ZX297520V3ECOGG_GW_NYC_2G_DDR))
+ ||((psEfuseInfo->secure_flag >> 8) == ZX297520V3ECOGG_GW_NYC_2G_DDR)
+ ||((psEfuseInfo->secure_flag >> 8) == ZX297520V3ECOGG_GW_NYC_NOR_2G_DDR)
+ ||((psEfuseInfo->secure_flag >> 8) == ZX297520V3ECOSC_GW_NYC_NOR_2G_DDR))
{
ddr_flag = CHIP_DDR_256M;
}
diff --git a/boot/common/src/loader/drivers/efuse.h b/boot/common/src/loader/drivers/efuse.h
old mode 100644
new mode 100755
index 7089952..791f1b9
--- a/boot/common/src/loader/drivers/efuse.h
+++ b/boot/common/src/loader/drivers/efuse.h
@@ -43,6 +43,8 @@
#define ZX297520V3ECOSCC_GW_NYB_4G_DDR 0xF86313
#define ZX297520V3ECOGG_GW_NYC_2G_DDR 0xF86314
#define ZX297520V3ECOGG_GW_NYB_4G_DDR 0xF86315
+#define ZX297520V3ECOGG_GW_NYC_NOR_2G_DDR 0xF86316
+#define ZX297520V3ECOSC_GW_NYC_NOR_2G_DDR 0xF86317
#define ZX297520V3_ZW_NYB_1G_DDR 0x1E871E
#define ZX297520V3_ZW_NYC_1G_DDR 0x1E871F
diff --git a/boot/common/src/loader/drivers/image.c b/boot/common/src/loader/drivers/image.c
index 09c296a..4614eb2 100755
--- a/boot/common/src/loader/drivers/image.c
+++ b/boot/common/src/loader/drivers/image.c
@@ -222,7 +222,7 @@
uint32_t uiPageSize = 0;
uint32_t uiImgHdrSizeOld = sizeof(image_header_t);
- uint32_t uiImgHdrSizeNew = sizeof(sImageHeader);
+ uint32_t uiImgHdrSizeNew = sizeof(sImageNewHeader);
uint32_t uiUBootSize = 0;
uint32_t uiUBootLoadAddr = 0;
@@ -329,7 +329,7 @@
writel(remap,0x140000);
/*3¡¢½âÎöM0µÄ°æ±¾Í·£¬»ñÈ¡ÔËÐеØÖ·ÒÔ¼°´óС*/
- header = (image_header_t *)CONFIG_SYS_SDRAM_TEMP_BASE;
+ header = (image_header_t *)(CONFIG_SYS_SDRAM_TEMP_BASE + sizeof(sImageNewHeader));
m0_size = ___htonl(header->ih_size); /* m0.bin */
m0_load_addr = ___htonl(header->ih_load);
*m0_entry_point = ___htonl(header->ih_ep);
@@ -340,7 +340,7 @@
}
/*4¡¢½«M0µÄ°æ±¾´ÓIRAM0¿½±´µ½load_addr*/
- memcpy(m0_load_addr, CONFIG_SYS_SDRAM_TEMP_BASE + image_header_size, m0_size);
+ memcpy(m0_load_addr, CONFIG_SYS_SDRAM_TEMP_BASE + sizeof(sImageNewHeader)+ image_header_size, m0_size);
/*5¡¢ÐÞ¸ÄIRAM±ê¼Ç£¬Ê¹BOOT¼ÌÐøÍùÏÂÖ´ÐÐ*/
writel(0, M0_IMAGE_READY_FLAG_ADDR);
diff --git a/boot/common/src/loader/drivers/secure_verify.c b/boot/common/src/loader/drivers/secure_verify.c
old mode 100644
new mode 100755
index 98eea5c..30e8473
--- a/boot/common/src/loader/drivers/secure_verify.c
+++ b/boot/common/src/loader/drivers/secure_verify.c
@@ -7,14 +7,10 @@
#include <asm/string.h>
#include <sdio.h>
#include <image.h>
-#include <key.h>
-
-
#include "efuse.h"
#include "drv_rsa.h"
#include "drv_hash.h"
-
#define E_N_LEN 256
#define HASH_LEN 128
@@ -61,21 +57,19 @@
u32 uiLen = 0;
u32 uiRet = -1;
image_header_t *puiLegacyImgAddr = NULL;
- sImageHeader *psImageHeader = NULL;
+ sImageNewHeader *psImageHeader = NULL;
efuse_struct *psEfuseInfo = NULL;
u32 *puiDataLoadAddr = NULL;
- u32 *puiArrPubKeyEN = NULL;
u32 *puiArrHASH = NULL;
u32 uiHashResArr[4] = {0};
u32 uiHashResLen = 0;
u32 uiHashVerifySize = 0;
u32 uiRsaResArr[32] = {0};
+ u32 puiArrPubKey[64] = {0};
int guiEfuseStatus = 1;
+ int default_flag = 1;
- u32 sRamKey[5] = {SECURE_EN,SECURE_PUK_HASH0,SECURE_PUK_HASH1,
- SECURE_PUK_HASH2,SECURE_PUK_HASH3};
-
T_Rsa_Paramter sRSAInput;
u32 *puiRsaResAddr = NULL;
@@ -84,15 +78,21 @@
return -1;
}
- psImageHeader = (sImageHeader *)puiSdrmStartAddr;
- puiLegacyImgAddr = (image_header_t *)(puiSdrmStartAddr + sizeof(sImageHeader));
+ psImageHeader = (sImageNewHeader *)puiSdrmStartAddr;
+ puiLegacyImgAddr = (image_header_t *)(puiSdrmStartAddr + sizeof(sImageNewHeader));
uiHashVerifySize = ___htonl(puiLegacyImgAddr->ih_size) + sizeof(image_header_t);
guiEfuseStatus = get_secure_verify_status();
if(guiEfuseStatus == 0) //efuse secure verify.
psEfuseInfo = (efuse_struct*)EFUSE_RAM_BASE;
else
- psEfuseInfo = (efuse_struct*)sRamKey;
+ {
+ default_flag = 0;
+#if defined(CONFIG_ZX297520V3E_VEHICLE_DC) || defined(CONFIG_ZX297520V3E_VEHICLE_DC_REF)
+ return 0;
+#endif
+ }
+
/*
* 0. ¼ì²éPubKeyÊÇ·ñ±»´Û¸Ä¡£
@@ -102,11 +102,12 @@
* - ²»Í¬£¬·µ»Ø1¡£
*/
uiLen = E_N_LEN; //¹«Ô¿EºÍN£¬¹²256byte³¤¶È¡£
- puiArrPubKeyEN = psImageHeader->uiPubKeyRsaE;
-
+ memcpy((puiArrPubKey+31), psImageHeader->uiPubKeyRsaE, 4);
+ memcpy((puiArrPubKey+32), psImageHeader->uiPubKeyRsaN, 128);
+
uiRet = Hash_Calculate(HASH_MODE_MD5,
HASH_SMALL_ENDIAN,
- puiArrPubKeyEN,
+ puiArrPubKey,
uiLen,
NULL,
0,
@@ -114,18 +115,21 @@
&uiHashResLen);
if(uiRet != 0)
{
- return -1;
- }
-
- if(data_cmp_word((u32 *)psEfuseInfo->puk_hash,
- uiHashResArr, uiHashResLen))
- {
- printf("Puk hash verify fail!\n");
- return -1;
+ return 1;
}
+ if(1 == default_flag)
+ {
+ if(data_cmp_word((u32 *)psEfuseInfo->puk_hash,
+ uiHashResArr, uiHashResLen))
+ {
+ //printf("Puk hash verify fail!\n");
+ printf("2\n");
+ return 2;
+ }
+ }
+
puiArrHASH = psImageHeader->uiHashY;
- uiLen = HASH_LEN;
/*
* 1. ÀûÓù«Ô¿¶ÔuiHashY'½øÐнâÃÜ£¬µÃµ½1024bit½á¹û¡£
@@ -134,15 +138,16 @@
sRSAInput.udNbitLen = 1024;
sRSAInput.udEbitLen = 1024;
sRSAInput.pudInputM = puiArrHASH;
- sRSAInput.pudInputE = puiArrPubKeyEN;
- sRSAInput.pudInputN = (puiArrPubKeyEN + 32);
+ sRSAInput.pudInputE = puiArrPubKey;
+ sRSAInput.pudInputN = (puiArrPubKey + 32);
sRSAInput.pudOutputP = uiRsaResArr;
uiRet = Rsa_Calculate(sRSAInput);
if(uiRet != 0)
{
- printf("Rsa_Calculate fail!\n");
- return -1;
+ //printf("Rsa_Calculate fail!\n");
+ printf("3\n");
+ return 3;
}
//È¡×îºó4×Ö½Ú×÷ΪPubKey½âÃܺóµÄHASH_MD5Öµ¡£
@@ -160,7 +165,7 @@
/* Cleanup Output Buffer. */
uiHashResLen = 0;
memset(uiHashResArr, 0, 4*sizeof(uiHashResArr[0]));
-
+
uiRet = Hash_Calculate(HASH_MODE_MD5,
HASH_SMALL_ENDIAN,
puiDataLoadAddr,
@@ -171,16 +176,17 @@
&uiHashResLen);
if(uiRet != 0)
{
- printf("Hash_Calculate Fail!\n");
- return -1;
+ //printf("Hash_Calculate Fail!\n");
+ printf("4\n");
+ return 4;
}
if(data_cmp_word(puiRsaResAddr, uiHashResArr, uiHashResLen))
{
- printf("SignImage Verify Fail!\n");
- return -1;
+ //printf("SignImage Verify Fail!\n");
+ printf("5\n");
+ return 5;
}
-
return 0;
}
diff --git a/boot/common/src/loader/drivers/spifc.c b/boot/common/src/loader/drivers/spifc.c
index 61ea186..b41effc 100755
--- a/boot/common/src/loader/drivers/spifc.c
+++ b/boot/common/src/loader/drivers/spifc.c
@@ -77,6 +77,8 @@
{0x2C, 0x35, 0x77, 4096, 12, 256, 18, 2048, 0x40000, 1},
/*XTX XT26Q04D 512M SPI-NAND*/
{0x0B, 0x53, 0x77, 4096, 12, 256, 18, 2048, 0x40000, 1},
+ /*UNIM UM19A0LISW 128M SPI-NAND*/
+ {0xB0, 0x15, 0x77, 2048, 11, 64, 17, 1024, 0x20000, 1},
{0}
};
@@ -847,12 +849,19 @@
printf("spi-nand:");
boot_mode = get_boot_mode();
+#if defined(CONFIG_ZX297520V3E_VEHICLE_DC) || defined(CONFIG_ZX297520V3E_VEHICLE_DC_REF)
+ if(boot_mode == NOR_BOOT)
+ {
+ writel(CFG_START_MODE_SPI_NAND, CFG_BOOT_MODE_START_MODE_FOR_UBOOT);
+ return 0;
+ }
+#else
if(boot_mode != SPI_NAND_BOOT)
{
printf("mode err.\n");
return -1;
}
-
+#endif
writel(CFG_START_MODE_SPI_NAND, CFG_BOOT_MODE_START_MODE_FOR_UBOOT);
ret = spifc_init();
if(ret != 0)
diff --git a/boot/common/src/loader/include/configs/zx297520v3.h b/boot/common/src/loader/include/configs/zx297520v3.h
index c463be8..771f6a8 100755
--- a/boot/common/src/loader/include/configs/zx297520v3.h
+++ b/boot/common/src/loader/include/configs/zx297520v3.h
@@ -60,6 +60,7 @@
#define M0_PARTITION_NAME "cpurpm"
#define UBOOT_IMAGE "uboot"
#define UBOOT_MIRROR_IMAGE "uboot-mirr"
+#define ZLOADER_IMAGE "zloader"
#endif
diff --git a/boot/common/src/loader/include/image.h b/boot/common/src/loader/include/image.h
index a2865d8..4f2dc68 100755
--- a/boot/common/src/loader/include/image.h
+++ b/boot/common/src/loader/include/image.h
@@ -143,6 +143,33 @@
u32 uiHashY[32];
} sImageHeader;
+typedef struct
+{
+ uint16_t signtype;
+ uint16_t hashtype;
+ uint32_t uiPubKeyRsaELen;
+ uint32_t uiPubKeyRsaNLen;
+ uint8_t uiPubKeyRsaE[4];
+ uint8_t uiPubKeyRsaN[256];
+ uint8_t reserve[112]; //380 bytes
+ uint8_t uiHashY[256]; //256 bytes
+} sImageNewHeader;
+
+
+typedef struct
+{
+ u8 resv;
+ u8 uart_print;
+ u8 usb_start;
+ u8 usb_timeout;
+ u32 chip_id[2];
+ u32 zdata_length;
+ u32 puk_rsa_d[32];
+ u32 puk_rsa_n[32];
+ u32 hash_y[32];
+ u16 VID;
+ u16 PID;
+} boot_header;
extern int read_uboot_image(uint8_t *name, uint32_t *uboot_entry_point);
extern int nand_read_m0(uint32_t *m0_entry_point);
diff --git a/boot/common/src/uboot/arch/arm/include/asm/arch-zx297520v3/efuse.h b/boot/common/src/uboot/arch/arm/include/asm/arch-zx297520v3/efuse.h
old mode 100644
new mode 100755
index dce9dbd..87c3e39
--- a/boot/common/src/uboot/arch/arm/include/asm/arch-zx297520v3/efuse.h
+++ b/boot/common/src/uboot/arch/arm/include/asm/arch-zx297520v3/efuse.h
@@ -44,8 +44,8 @@
#define ZX297520V3ECOSCC_GW_NYB_4G_DDR 0xF86313
#define ZX297520V3ECOGG_GW_NYC_2G_DDR 0xF86314
#define ZX297520V3ECOGG_GW_NYB_4G_DDR 0xF86315
-
-
+#define ZX297520V3ECOGG_GW_NYC_NOR_2G_DDR 0xF86316
+#define ZX297520V3ECOSC_GW_NYC_NOR_2G_DDR 0xF86317
#define ZX297520V3_ZW_NYB_1G_DDR 0x1E871E
#define ZX297520V3_ZW_NYC_1G_DDR 0x1E871F
diff --git a/boot/common/src/uboot/arch/arm/lib/bootm.c b/boot/common/src/uboot/arch/arm/lib/bootm.c
index 57bb639..41cc4c1 100755
--- a/boot/common/src/uboot/arch/arm/lib/bootm.c
+++ b/boot/common/src/uboot/arch/arm/lib/bootm.c
@@ -68,6 +68,7 @@
extern unsigned int g_sys_kernel_sdram_size;
extern unsigned char g_ddr_size_flag;
+#define reg32(addr) (*(volatile unsigned long *)(addr))
void arch_lmb_reserve(struct lmb *lmb)
{
@@ -294,10 +295,12 @@
if(g_ddr_size_flag == CHIP_DDR_IS_128M)
{
size[bank] = DDR_BASE_LEN_CAP;
+ reg32(IRAM_BASE_ADDR_BOOT_DDR) = DDR_BASE_LEN_CAP;
}
else if(g_ddr_size_flag == CHIP_DDR_IS_256M)
{
size[bank] = DDR_BASE_LEN_CAP + 0x8000000;
+ reg32(IRAM_BASE_ADDR_BOOT_DDR) = (DDR_BASE_LEN_CAP + 0x8000000);
}
else
{
diff --git a/boot/common/src/uboot/board/zte/zx297520v3/zx297520v3_vehicle_dc_ref.c b/boot/common/src/uboot/board/zte/zx297520v3/zx297520v3_vehicle_dc_ref.c
index 11db015..e3004ae 100755
--- a/boot/common/src/uboot/board/zte/zx297520v3/zx297520v3_vehicle_dc_ref.c
+++ b/boot/common/src/uboot/board/zte/zx297520v3/zx297520v3_vehicle_dc_ref.c
@@ -906,7 +906,7 @@
#if VERSION_RELEASE
if( ret != 0 )
{
- BOOT_PRINTF(UBOOT_ERR, "load images ERROR !!!\n");
+ BOOT_PRINTF(UBOOT_ERR, "load imagefs ERROR !!!\n");
#ifdef CONFIG_ZX297520V3E_VEHICLE_DC_REF
writeback_flags();
system_reset();
diff --git a/boot/common/src/uboot/downloader/cmd_compat_read.c b/boot/common/src/uboot/downloader/cmd_compat_read.c
old mode 100644
new mode 100755
index 04c59cc..aac83a2
--- a/boot/common/src/uboot/downloader/cmd_compat_read.c
+++ b/boot/common/src/uboot/downloader/cmd_compat_read.c
@@ -33,7 +33,7 @@
/****************************************************************************
* Global Function Prototypes
****************************************************************************/
-
+extern int g_iftype;
/*******************************************************************************
* Function:do_compat_read
@@ -74,6 +74,19 @@
return -1;
}
+ if(g_nor_flag == 1)
+ {
+ if(memcmp(par,"zloader",7) == 0) {
+ g_iftype = IF_TYPE_NOR;
+ nand_init();
+ ret = do_nor_read(part, par, offset,size);
+ /*Çл»³õʼ»¯spi_nand*/
+ g_iftype = IF_TYPE_SPI_NAND;
+ nand_init();
+ return ret;
+ }
+ }
+
if((read_boot_flashtype() == IF_TYPE_NOR)
&& (strcmp((const char *)part->part_type,"nand") == 0))
diff --git a/boot/common/src/uboot/downloader/cmd_compat_write.c b/boot/common/src/uboot/downloader/cmd_compat_write.c
old mode 100644
new mode 100755
index 8ac27dd..f4db84f
--- a/boot/common/src/uboot/downloader/cmd_compat_write.c
+++ b/boot/common/src/uboot/downloader/cmd_compat_write.c
@@ -32,7 +32,8 @@
/****************************************************************************
* Global Function Prototypes
****************************************************************************/
-
+extern int g_iftype;
+extern partition_table_t * g_partition_table_dl;
/*******************************************************************************
* Function:do_compat_write
* Description:
@@ -70,6 +71,24 @@
downloader_serial_write(ack, strlen(ack)+1);
return -1;
}
+
+#if defined (CONFIG_ZX297520V3E_VEHICLE_DC) || defined (CONFIG_ZX297520V3E_VEHICLE_DC_REF)
+ if(g_nor_flag == 1)
+ {
+ if(memcmp(par,"zloader",7) == 0)
+ {
+ g_iftype = IF_TYPE_NOR;
+ nand_init();
+ ret = do_nor_write(part, par, offset,size);
+ /*Çл»³õʼ»¯spi_nand*/
+ g_iftype = IF_TYPE_SPI_NAND;
+ nand_init();
+ memcpy((char *)(DOWNLOADER_BUFFER_BASE+0x8000),g_partition_table_dl,4096);
+ ret = downloader_nand_write(part, 0, 0x9000,(unsigned char *)DOWNLOADER_BUFFER_BASE);
+ return ret;
+ }
+ }
+#endif
if((read_boot_flashtype() == IF_TYPE_NOR)
&& (strcmp((const char *)part->part_type,"nand") == 0))
diff --git a/boot/common/src/uboot/downloader/cmd_dl_nand.c b/boot/common/src/uboot/downloader/cmd_dl_nand.c
old mode 100644
new mode 100755
index d4b0e04..8105776
--- a/boot/common/src/uboot/downloader/cmd_dl_nand.c
+++ b/boot/common/src/uboot/downloader/cmd_dl_nand.c
@@ -96,9 +96,15 @@
if(memcmp(par,"zloader",7) == 0) /* ÏÂÔØzloader·ÖÇø£¬Í¬Ê±ÏÂÔØ·ÖÇø±í */
{
+#if defined (CONFIG_ZX297520V3E_VEHICLE_DC) || defined (CONFIG_ZX297520V3E_VEHICLE_DC_REF)
+ memcpy((char *)(DOWNLOADER_BUFFER_BASE+0xA000),g_partition_table_dl,4096);
+ ret = downloader_nand_write(part, offset_par, 0x3000,
+ (unsigned char *)(DOWNLOADER_BUFFER_BASE+0x8000));
+#else
memcpy((char *)(DOWNLOADER_BUFFER_BASE+8192),g_partition_table_dl,4096);
ret = downloader_nand_write(part, offset_par, 0x3000,
(unsigned char *)DOWNLOADER_BUFFER_BASE);
+#endif
}
else
{
@@ -275,6 +281,16 @@
return EINVAL; /* Invalid argument */
}
leftWriteLength = size;
+
+ if(g_nor_flag == 1)
+ {
+ ret = get_nor_null_slice_flag(&null_slice_flag);
+ if(ret)
+ {
+ printf ("nor flash read null_slice_flag error.\n");
+ return 1;
+ }
+ }
if(null_slice_flag == 1)
{
@@ -297,8 +313,17 @@
if(memcmp(par,"zloader",7) == 0) /* ÏÂÔØzloader·ÖÇø£¬Í¬Ê±ÏÂÔØ·ÖÇø±í */
{
- memcpy((char *)(DOWNLOADER_BUFFER_BASE+8192),g_partition_table_dl,4096);
- ret = downloader_nor_write( part, offset_par, 0x3000, (unsigned char *)DOWNLOADER_BUFFER_BASE);
+ if(g_nor_flag == 1)
+ {
+ memset((char *)(DOWNLOADER_BUFFER_BASE+0x8000), 0, 4096);
+ memcpy((char *)(DOWNLOADER_BUFFER_BASE+0x8000),g_partition_table_dl,4096);
+ ret = downloader_nor_write( part, offset_par, 0x9000, (unsigned char *)DOWNLOADER_BUFFER_BASE);
+ }
+ else
+ {
+ memcpy((char *)(DOWNLOADER_BUFFER_BASE+8192),g_partition_table_dl,4096);
+ ret = downloader_nor_write( part, offset_par, 0x3000, (unsigned char *)DOWNLOADER_BUFFER_BASE);
+ }
}
else
{
diff --git a/boot/common/src/uboot/downloader/cmd_efuse_program.c b/boot/common/src/uboot/downloader/cmd_efuse_program.c
old mode 100644
new mode 100755
index 3f931ba..ffd2e8f
--- a/boot/common/src/uboot/downloader/cmd_efuse_program.c
+++ b/boot/common/src/uboot/downloader/cmd_efuse_program.c
@@ -243,7 +243,9 @@
board_type = BOARD_TYPE_ZX297520V3E64M;
}
else if((chip_flag == ZX297520V3ECOSC_GW_NYC_2G_DDR)
- ||(chip_flag == ZX297520V3ECOGG_GW_NYC_2G_DDR))
+ ||(chip_flag == ZX297520V3ECOGG_GW_NYC_2G_DDR)
+ ||(chip_flag == ZX297520V3ECOGG_GW_NYC_NOR_2G_DDR)
+ ||(chip_flag == ZX297520V3ECOSC_GW_NYC_NOR_2G_DDR))
{
printf("chip_flag=0x%x board_type is V3E.\n", chip_flag);
board_type = BOARD_TYPE_ZX297520V3E256M;
diff --git a/boot/common/src/uboot/downloader/downloader_nand.c b/boot/common/src/uboot/downloader/downloader_nand.c
old mode 100644
new mode 100755
index d28cfbc..fe24aaa
--- a/boot/common/src/uboot/downloader/downloader_nand.c
+++ b/boot/common/src/uboot/downloader/downloader_nand.c
@@ -476,7 +476,7 @@
*
* Others:
********************************************************************************/
-int downloader_nand_write(partition_entry_t * part, uint offset, uint size, unchar * buffer)
+int downloader_nand_write(partition_entry_t * part, uint offset, uint size, unchar * buffer)
{
nand_info_t * pNandInfo = NULL;
uint nandPhyBase = 0;
@@ -502,24 +502,40 @@
/* רÃÅдZ-LOADʱʹÓ㬲»Ê¹ÓÃECC*/
if( strcmp((const char *)part->part_name , "zloader") == 0 )
- {
- if( size != 12*1024 )
- {
- printf("downloader_nand_write z-load size != 12k...\n");
- return -1;
- }
- int times = 12*1024/pNandInfo->writesize;
- int i = 0;
+ {
+ if(g_nor_flag == 1)
+ {
+ int times = 0x9000/pNandInfo->writesize;
+ int i = 0;
- for(; i<times; i++)
- {
-
- ret += nand_write_page_with_ecc(pNandInfo,
- ((loff_t)i*(pNandInfo->writesize)),
- buf );
- buf += pNandInfo->writesize;
- }
-
+ for(; i<times; i++)
+ {
+
+ ret += nand_write_page_with_ecc(pNandInfo,
+ ((loff_t)i*(pNandInfo->writesize)),
+ buf );
+ buf += pNandInfo->writesize;
+ }
+ }
+ else
+ {
+ if( size != 12*1024 )
+ {
+ printf("downloader_nand_write z-load size != 12k...\n");
+ return -1;
+ }
+ int times = 12*1024/pNandInfo->writesize;
+ int i = 0;
+
+ for(; i<times; i++)
+ {
+
+ ret += nand_write_page_with_ecc(pNandInfo,
+ ((loff_t)i*(pNandInfo->writesize)),
+ buf );
+ buf += pNandInfo->writesize;
+ }
+ }
}
else
diff --git a/boot/common/src/uboot/downloader/downloader_nand.h b/boot/common/src/uboot/downloader/downloader_nand.h
old mode 100644
new mode 100755
index ec638d4..806700e
--- a/boot/common/src/uboot/downloader/downloader_nand.h
+++ b/boot/common/src/uboot/downloader/downloader_nand.h
@@ -41,6 +41,7 @@
/****************************************************************************
* Global Variables
****************************************************************************/
+extern unsigned char g_nor_flag;
/****************************************************************************
* Function Prototypes
diff --git a/boot/common/src/uboot/drivers/efuse/efuse.c b/boot/common/src/uboot/drivers/efuse/efuse.c
old mode 100644
new mode 100755
index 46bc303..96e4901
--- a/boot/common/src/uboot/drivers/efuse/efuse.c
+++ b/boot/common/src/uboot/drivers/efuse/efuse.c
@@ -25,10 +25,10 @@
#include <../drivers/hash/drv_hash.h>
#include <../drivers/rsa/drv_rsa.h>
+#include <../drivers/hash/sha256.h>
#include <secure_verify.h>
#include <asm/arch/efuse.h>
-
-
+#include <boot_mode.h>
/****************************************************************************
* Local Macros
@@ -51,6 +51,14 @@
static unsigned char gbEfuseReadFlag = 0;
+otp_struct otpInfo;
+unsigned int guiOtpStatus = 1;
+extern int rootfs_flag;
+extern int m0_flag;
+extern int zsp_flag;
+extern int g_iftype;
+extern unsigned char g_nor_flag;
+
/****************************************************************************
* Local Funcs
****************************************************************************/
@@ -129,6 +137,62 @@
return 1;
}
#endif
+
+/*
+* Convert BIGENDIAN To SMALLENDIAN.
+*/
+void BIG2SMALL(u32 *pBuffer, u32 uiLen)
+{
+ u32 uiLoop;
+ u32 uiTmp = 0;
+
+ for (uiLoop = 0; uiLoop < uiLen/sizeof(u32); uiLoop++)
+ {
+ uiTmp = pBuffer[uiLoop];
+ pBuffer[uiLoop] = 0;
+ pBuffer[uiLoop] += (uiTmp & 0x000000FF) << 24;
+ pBuffer[uiLoop] += (uiTmp & 0x0000FF00) << 8;
+ pBuffer[uiLoop] += (uiTmp & 0x00FF0000) >> 8;
+ pBuffer[uiLoop] += (uiTmp & 0xFF000000) >> 24;
+ }
+}
+
+void get_otp_secure_verify_status(void)
+{
+ u32 uiLen;
+ otp_struct *psEfuseInfo = NULL;
+
+ /*
+ * 0. Èç¹ûsecure flag²»µÈÓÚ0£¬Í˳ö°²È«boot¡£
+ */
+ psEfuseInfo = (otp_struct*)&otpInfo;
+ if(psEfuseInfo->secure_flag != 0)
+ {
+ guiOtpStatus = 1; //Disable.
+ BOOT_PRINTF(UBOOT_NOTICE, "secure_flag!=0xFF, SecureVerify->Disable.\n");
+ return ;
+ }
+
+ /*
+ * 1.´ÓefuseÖжÁ³öpuk_hash[255:0], ÅжÏÈç¹ûÈ«²¿Îª0Í˳ö°²È«boot¡£
+ */
+ for(uiLen = 0; uiLen < 8; uiLen++)
+ {
+ if(psEfuseInfo->puk_hash[uiLen] != 0)
+ {
+ break;
+ }
+ if(uiLen == 7)
+ {
+ guiOtpStatus = 1; //Disable.
+ BOOT_PRINTF(UBOOT_NOTICE, "PubKey_HASH=Invalid, SecureVerify->Disable.\n");
+ return ;
+ }
+ }
+ BOOT_PRINTF(UBOOT_NOTICE, "All Flag & Param is Valid, SecureVerify->ENABLE.\n");
+ guiOtpStatus = 0; //Enable.
+}
+
static void efuse_get_data(void)
{
efuse_struct *psEfuseInfo = NULL;
@@ -168,7 +232,9 @@
BOOT_PRINTF(UBOOT_NOTICE, "secure_flag=0x%x.\n", psEfuseInfo->secure_flag);
}
else if(((psEfuseInfo->secure_flag >> 8) == ZX297520V3ECOSC_GW_NYC_2G_DDR)
- ||((psEfuseInfo->secure_flag >> 8) == ZX297520V3ECOGG_GW_NYC_2G_DDR))
+ ||((psEfuseInfo->secure_flag >> 8) == ZX297520V3ECOGG_GW_NYC_2G_DDR)
+ ||((psEfuseInfo->secure_flag >> 8) == ZX297520V3ECOGG_GW_NYC_NOR_2G_DDR)
+ ||((psEfuseInfo->secure_flag >> 8) == ZX297520V3ECOSC_GW_NYC_NOR_2G_DDR))
{
g_ddr_size_flag = CHIP_DDR_IS_256M;
BOOT_PRINTF(UBOOT_NOTICE, "secure_flag=0x%x.\n", psEfuseInfo->secure_flag);
@@ -217,98 +283,440 @@
return 0;
}
+u8 rootfs_secure_verify(u32 addr)
+{
+ if(g_nor_flag == 1)
+ {
+
+ u32 uiLen = 0;
+ u32 uiRet = -1;
+ u32 uiLoop = 0;
+ image_header_t *puiLegacyRootfsAddr = NULL;
+ sImageNewHeader *psRootfsHeader = NULL;
+ u32 *puiDataLoadAddr = NULL;
+ u32 *puiArrPubKeyEN = NULL;
+ u32 *puiArrPubKey = NULL;
+ u32 *puiArrHASH = NULL;
+ otp_struct *psEfuseInfo = NULL;
+ u32 uiHashResArr[8] = {0};
+ u32 uiHashResLen = 0;
+ u32 uiHashVerifySize = 0;
+ u32 uiRsaResArr[64] = {0};
+ u32 puiArrPubKeyE[64] = {0};
+ T_Rsa_Paramter sRSAInput;
+ u32 *puiRsaResAddr = NULL;
+ u32 sRamKey[9] = {0x0,0x33fa3e31,0x90d8d15a,0x073cee04,0x82ac24aa,0x2262748e,0x1a3663c7,0x4b603f6f,0xd098e0d8};
+ if(NULL == addr)
+ {
+ BOOT_PRINTF(UBOOT_ERR, "Bad Parameter(Empty Pointer)!\n");
+ return -1;
+ }
+
+ psRootfsHeader = (sImageNewHeader *)addr;
+ puiLegacyRootfsAddr = (image_header_t *)(addr + sizeof(sImageNewHeader));
+ uiHashVerifySize = ___htonl(puiLegacyRootfsAddr->ih_size) + sizeof(image_header_t);
+
+ //psEfuseInfo = (otp_struct*)sRamKey;
+ psEfuseInfo = (otp_struct*)&otpInfo;
+
+ /*
+ * step 0
+ */
+ puiArrPubKeyEN = psRootfsHeader->uiPubKeyRsaE;
+ uiLen = 380;
+ puiArrPubKey = &(psRootfsHeader->uiPubKeyRsaELen);
+ sha256_csum_wd((const unsigned char *)puiArrPubKey, uiLen, (unsigned char *)uiHashResArr);
+ uiHashResLen = 8;
+ /*´óС¶Ëת»»*/
+ BIG2SMALL(uiHashResArr, 32);
+
+ BOOT_PRINTF(UBOOT_DBG, "secure_flag=0x%x.\n", psEfuseInfo->secure_flag);
+
+ if(efuse_cmp_word(psEfuseInfo->puk_hash, uiHashResArr, uiHashResLen))
+ {
+ BOOT_PRINTF(UBOOT_ERR, "PubKey Hash Verify -> Failed !\n");
+ return 1;
+ }
+ puiArrHASH = psRootfsHeader->uiHashY;
+
+ /*
+ * step 1
+ */
+ memcpy(puiArrPubKeyE+63, puiArrPubKeyEN, 4);
+ sRSAInput.udCalMode = RSA_MOD_EXPO_WITH_INIT;
+ sRSAInput.udNbitLen = 2048;
+ sRSAInput.udEbitLen = 2048;
+ sRSAInput.pudInputM = puiArrHASH;
+ sRSAInput.pudInputE = puiArrPubKeyE;
+ sRSAInput.pudInputN = psRootfsHeader->uiPubKeyRsaN;
+ sRSAInput.pudOutputP = uiRsaResArr;
+
+ uiRet = Rsa_Calculate(sRSAInput);
+ if(uiRet != 0)
+ {
+ BOOT_PRINTF(UBOOT_ERR, "Rsa_Calculate ERROR(0x%x)!\n", uiRet);
+ return 2;
+ }
+ puiRsaResAddr = sRSAInput.pudOutputP + (64 - uiHashResLen);
+
+ /*
+ * step 2
+ */
+ uiLen = uiHashVerifySize;
+ puiDataLoadAddr = CONFIG_SYS_SDRAM_ROOTFS_BASE - sizeof(image_header_t);
+
+ /* Cleanup Output Buffer. */
+ uiHashResLen = 0;
+ memset(uiHashResArr, 0, 8*sizeof(uiHashResArr[0]));
+
+ sha256_csum_wd((const unsigned char *)puiDataLoadAddr, uiLen, (unsigned char *)uiHashResArr);
+ uiHashResLen = 8;
+ /*´óС¶Ëת»»*/
+ BIG2SMALL(uiHashResArr, 32);
+
+ if(efuse_cmp_word(puiRsaResAddr, uiHashResArr, uiHashResLen))
+ {
+ BOOT_PRINTF(UBOOT_ERR, "LegacyRootfs Verify -> Failed !\n");
+ return 3;
+ }
+
+ }
+ else
+ {
+
+ u32 uiLen = 0;
+ u32 uiRet = -1;
+ u32 uiLoop = 0;
+ image_header_t *puiLegacyRootfsAddr = NULL;
+ sImageNewHeader *psRootfsHeader = NULL;
+ u32 *puiDataLoadAddr = NULL;
+ u32 *puiArrPubKeyEN = NULL;
+ u32 *puiArrHASH = NULL;
+ efuse_struct *psEfuseInfo = NULL;
+ u32 uiHashResArr[4] = {0};
+ u32 uiHashResLen = 0;
+ u32 uiHashVerifySize = 0;
+ u32 uiRsaResArr[32] = {0};
+ u32 puiArrPubKeyE[32] = {0};
+ u32 puiArrPubKey[64] = {0};
+ T_Rsa_Paramter sRSAInput;
+ u32 *puiRsaResAddr = NULL;
+ {
+ BOOT_PRINTF(UBOOT_ERR, "Bad Parameter(Empty Pointer)!\n");
+ return -1;
+ }
+
+ psRootfsHeader = (sImageNewHeader *)addr;
+ puiLegacyRootfsAddr = (image_header_t *)(addr + sizeof(sImageNewHeader));
+ uiHashVerifySize = ___htonl(puiLegacyRootfsAddr->ih_size) + sizeof(image_header_t);
+
+ psEfuseInfo = (efuse_struct*)EFUSE_RAM_BASE;
+
+ /*
+ * step 0
+ */
+
+ uiLen = E_N_LEN;
+ puiArrPubKeyEN = psRootfsHeader->uiPubKeyRsaE;
+ memcpy(puiArrPubKeyE+31, puiArrPubKeyEN, 4);
+ memcpy(puiArrPubKey+31, puiArrPubKeyEN, 4);
+ memcpy(puiArrPubKey+32, psRootfsHeader->uiPubKeyRsaN, 128);
+
+ Hash_Calculate(HASH_MODE_MD5, HASH_SMALL_ENDIAN, puiArrPubKey, uiLen, NULL, 0, uiHashResArr, &uiHashResLen);
+
+ BOOT_PRINTF(UBOOT_DBG, "secure_flag=0x%x.\n", psEfuseInfo->secure_flag);
+
+ if(efuse_cmp_word(psEfuseInfo->puk_hash, uiHashResArr, uiHashResLen))
+ {
+ BOOT_PRINTF(UBOOT_ERR, "PubKey Hash Verify -> Failed !\n");
+ return 1;
+ }
+ puiArrHASH = psRootfsHeader->uiHashY;
+
+ /*
+ * step 1
+ */
+ sRSAInput.udCalMode = RSA_MOD_EXPO_WITH_INIT;
+ sRSAInput.udNbitLen = 1024;
+ sRSAInput.udEbitLen = 1024;
+ sRSAInput.pudInputM = puiArrHASH;
+ sRSAInput.pudInputE = puiArrPubKeyE;
+ sRSAInput.pudInputN = psRootfsHeader->uiPubKeyRsaN;
+ sRSAInput.pudOutputP = uiRsaResArr;
+
+ uiRet = Rsa_Calculate(sRSAInput);
+ if(uiRet != 0)
+ {
+ BOOT_PRINTF(UBOOT_ERR, "Rsa_Calculate ERROR(0x%x)!\n", uiRet);
+ return 2;
+ }
+ puiRsaResAddr = sRSAInput.pudOutputP + (32 - uiHashResLen);
+
+ /*
+ * step 2
+ */
+ uiLen = uiHashVerifySize;
+ puiDataLoadAddr = CONFIG_SYS_SDRAM_ROOTFS_BASE - sizeof(image_header_t);
+
+ /* Cleanup Output Buffer. */
+ uiHashResLen = 0;
+ memset(uiHashResArr, 0, 4*sizeof(uiHashResArr[0]));
+
+ uiRet = Hash_Calculate(HASH_MODE_MD5, HASH_SMALL_ENDIAN, puiDataLoadAddr, uiLen, NULL, 0, uiHashResArr, &uiHashResLen);
+ if(uiRet != 0)
+ {
+ BOOT_PRINTF(UBOOT_ERR, "Hash_Calculate ERROR(0x%x)!\n", uiRet);
+ return -1;
+ }
+
+ if(efuse_cmp_word(puiRsaResAddr, uiHashResArr, uiHashResLen))
+ {
+ BOOT_PRINTF(UBOOT_ERR, "LegacyRootfs Verify -> Failed !\n");
+ return 3;
+ }
+ }
+
+ return 0;
+}
+
u8 secure_verify(u32 addr)
{
- u32 uiLen = 0;
- u32 uiRet = -1;
- u32 uiLoop = 0;
- image_header_t *puiLegacyImgAddr = NULL;
- sImageHeader *psImageHeader = NULL;
- u32 *puiDataLoadAddr = NULL;
- u32 *puiArrPubKeyEN = NULL;
- u32 *puiArrHASH = NULL;
+ if(g_nor_flag != 1){
+ u32 uiLen = 0;
+ u32 uiRet = -1;
+ u32 uiLoop = 0;
+ image_header_t *puiLegacyImgAddr = NULL;
+ sImageNewHeader *psImageHeader = NULL;
+ u32 *puiDataLoadAddr = NULL;
+ u32 *puiArrPubKeyEN = NULL;
+ u32 *puiArrHASH = NULL;
- efuse_struct *psEfuseInfo = NULL;
+ efuse_struct *psEfuseInfo = NULL;
- u32 uiHashResArr[4] = {0};
- u32 uiHashResLen = 0;
- u32 uiHashVerifySize = 0;
- u32 uiRsaResArr[32] = {0};
+ u32 uiHashResArr[4] = {0};
+ u32 uiHashResLen = 0;
+ u32 uiHashVerifySize = 0;
+ u32 uiRsaResArr[32] = {0};
+ u32 puiArrPubKeyE[32] = {0};
+ u32 puiArrPubKey[64] = {0};
- T_Rsa_Paramter sRSAInput;
- u32 *puiRsaResAddr = NULL;
+ T_Rsa_Paramter sRSAInput;
+ u32 *puiRsaResAddr = NULL;
- if(NULL == addr)
- {
- BOOT_PRINTF(UBOOT_ERR, "Bad Parameter(Empty Pointer)!\n");
- return -1;
+ if(NULL == addr)
+ {
+ BOOT_PRINTF(UBOOT_ERR, "Bad Parameter(Empty Pointer)!\n");
+ return -1;
+ }
+
+ psImageHeader = (sImageNewHeader *)addr;
+
+ if(rootfs_flag == 1)
+ {
+ puiLegacyImgAddr = (image_header_t *)(addr + sizeof(sImageNewHeader) + sizeof(sImageNewHeader) + sizeof(image_header_t));
+ uiHashVerifySize = ___htonl(puiLegacyImgAddr->ih_size) + sizeof(image_header_t) + sizeof(image_header_t) + sizeof(sImageNewHeader);
+ }
+ else
+ {
+ puiLegacyImgAddr = (image_header_t *)(addr + sizeof(sImageNewHeader));
+ uiHashVerifySize = ___htonl(puiLegacyImgAddr->ih_size) + sizeof(image_header_t);
+ }
+
+ psEfuseInfo = (efuse_struct*)EFUSE_RAM_BASE;
+
+ BOOT_PRINTF(UBOOT_NOTICE, "uiHashVerifySize=0x%x, EFUSE_RAM_BASE=0x%x.\n", uiHashVerifySize, EFUSE_RAM_BASE);
+
+ /*
+ * step 0
+ */
+ uiLen = E_N_LEN;
+ puiArrPubKeyEN = psImageHeader->uiPubKeyRsaE;
+ memcpy(puiArrPubKeyE+31, puiArrPubKeyEN, 4);
+ memcpy(puiArrPubKey+31, puiArrPubKeyEN, 4);
+ memcpy(puiArrPubKey+32, psImageHeader->uiPubKeyRsaN, 128);
+
+ Hash_Calculate(HASH_MODE_MD5, HASH_SMALL_ENDIAN, puiArrPubKey, uiLen, NULL, 0, uiHashResArr, &uiHashResLen);
+
+ BOOT_PRINTF(UBOOT_DBG, "secure_flag=0x%x.\n", psEfuseInfo->secure_flag);
+
+ if(efuse_cmp_word(psEfuseInfo->puk_hash, uiHashResArr, uiHashResLen))
+ {
+ BOOT_PRINTF(UBOOT_ERR, "PubKey Hash Verify -> Failed !\n");
+ return 1;
+ }
+ puiArrHASH = psImageHeader->uiHashY;
+
+ /*
+ * step 1
+ */
+ sRSAInput.udCalMode = RSA_MOD_EXPO_WITH_INIT;
+ sRSAInput.udNbitLen = 1024;
+ sRSAInput.udEbitLen = 1024;
+ sRSAInput.pudInputM = puiArrHASH;
+ sRSAInput.pudInputE = puiArrPubKeyE;
+ sRSAInput.pudInputN = psImageHeader->uiPubKeyRsaN;
+ sRSAInput.pudOutputP = uiRsaResArr;
+
+ uiRet = Rsa_Calculate(sRSAInput);
+ if(uiRet != 0)
+ {
+ BOOT_PRINTF(UBOOT_ERR, "Rsa_Calculate ERROR(0x%x)!\n", uiRet);
+ return 2;
+ }
+ puiRsaResAddr = sRSAInput.pudOutputP + (32 - uiHashResLen);
+
+ /*
+ * step 2
+ */
+ uiLen = uiHashVerifySize;
+ if(rootfs_flag == 1)
+ {
+ puiDataLoadAddr = ___htonl(puiLegacyImgAddr->ih_load) - sizeof(image_header_t) - sizeof(image_header_t) - sizeof(sImageNewHeader);
+ }
+ else
+ {
+ if(1 == m0_flag || 1 == zsp_flag){
+ puiDataLoadAddr = (uchar *)addr + sizeof(sImageNewHeader);
+
+ }else{
+ puiDataLoadAddr = ___htonl(puiLegacyImgAddr->ih_load) - sizeof(image_header_t);
+ }
+
+ }
+
+ /* Cleanup Output Buffer. */
+ uiHashResLen = 0;
+ memset(uiHashResArr, 0, 4*sizeof(uiHashResArr[0]));
+
+ uiRet = Hash_Calculate(HASH_MODE_MD5, HASH_SMALL_ENDIAN, puiDataLoadAddr, uiLen, NULL, 0, uiHashResArr, &uiHashResLen);
+ if(uiRet != 0)
+ {
+ BOOT_PRINTF(UBOOT_ERR, "Hash_Calculate ERROR(0x%x)!\n", uiRet);
+ return -1;
+ }
+
+ if(efuse_cmp_word(puiRsaResAddr, uiHashResArr, uiHashResLen))
+ {
+ BOOT_PRINTF(UBOOT_ERR, "LegacyImg Verify -> Failed !\n");
+ return 3;
+ }
+
}
+ else
+ {
+ u32 uiLen = 0;
+ u32 uiRet = -1;
+ u32 uiLoop = 0;
+ image_header_t *puiLegacyImgAddr = NULL;
+ sImageNewHeader *psImageHeader = NULL;
+ u32 *puiDataLoadAddr = NULL;
+ u32 *puiArrPubKeyEN = NULL;
+ u32 *puiArrPubKey = NULL;
+ u32 *puiArrHASH = NULL;
+ otp_struct *psEfuseInfo = NULL;
+ u32 uiHashResArr[8] = {0};
+ u32 uiHashResLen = 0;
+ u32 uiHashVerifySize = 0;
+ u32 uiRsaResArr[64] = {0};
+ u32 puiArrPubKeyE[64] = {0};
+ T_Rsa_Paramter sRSAInput;
+ u32 *puiRsaResAddr = NULL;
+ u32 sRamKey[9] = {0x0,0x33fa3e31,0x90d8d15a,0x073cee04,0x82ac24aa,0x2262748e,0x1a3663c7,0x4b603f6f,0xd098e0d8};
+ if(NULL == addr)
+ {
+ BOOT_PRINTF(UBOOT_ERR, "Bad Parameter(Empty Pointer)!\n");
+ return -1;
+ }
- psImageHeader = (sImageHeader *)addr;
- puiLegacyImgAddr = (image_header_t *)(addr + sizeof(sImageHeader));
- uiHashVerifySize = ___htonl(puiLegacyImgAddr->ih_size) + sizeof(image_header_t);
+ psImageHeader = (sImageNewHeader *)addr;
- psEfuseInfo = (efuse_struct*)EFUSE_RAM_BASE;
+ if(rootfs_flag == 1)
+ {
+ puiLegacyImgAddr = (image_header_t *)(addr + sizeof(sImageNewHeader) + sizeof(sImageNewHeader) + sizeof(image_header_t));
+ uiHashVerifySize = ___htonl(puiLegacyImgAddr->ih_size) + sizeof(image_header_t) + sizeof(image_header_t) + sizeof(sImageNewHeader);
+ }
+ else
+ {
+ puiLegacyImgAddr = (image_header_t *)(addr + sizeof(sImageNewHeader));
+ uiHashVerifySize = ___htonl(puiLegacyImgAddr->ih_size) + sizeof(image_header_t);
+ }
- BOOT_PRINTF(UBOOT_NOTICE, "uiHashVerifySize=0x%x, EFUSE_RAM_BASE=0x%x.\n", uiHashVerifySize, EFUSE_RAM_BASE);
+ psEfuseInfo = (otp_struct*)&otpInfo;
+ //psEfuseInfo = (otp_struct*)sRamKey;
+
+ /*
+ * step 0
+ */
+ uiLen = 380;
+ puiArrPubKey = &(psImageHeader->uiPubKeyRsaELen);
+ puiArrPubKeyEN = psImageHeader->uiPubKeyRsaE;
+ sha256_csum_wd((const unsigned char *)puiArrPubKey, uiLen, (unsigned char *)uiHashResArr);
+ uiHashResLen = 8;
+ /*´óС¶Ëת»»*/
+ BIG2SMALL(uiHashResArr, 32);
- /*
- * step 0
- */
- uiLen = E_N_LEN;
- puiArrPubKeyEN = psImageHeader->uiPubKeyRsaE;
+ BOOT_PRINTF(UBOOT_DBG, "secure_flag=0x%x.\n", psEfuseInfo->secure_flag);
- Hash_Calculate(HASH_MODE_MD5, HASH_SMALL_ENDIAN, puiArrPubKeyEN, uiLen, NULL, 0, uiHashResArr, &uiHashResLen);
+ if(efuse_cmp_word(psEfuseInfo->puk_hash, uiHashResArr, uiHashResLen))
+ {
+ BOOT_PRINTF(UBOOT_ERR, "PubKey Hash Verify -> Failed !\n");
+ return 1;
+ }
+ puiArrHASH = psImageHeader->uiHashY;
- BOOT_PRINTF(UBOOT_DBG, "secure_flag=0x%x.\n", psEfuseInfo->secure_flag);
+ /*
+ * step 1
+ */
+ memcpy(puiArrPubKeyE+63, puiArrPubKeyEN, 4);
+ sRSAInput.udCalMode = RSA_MOD_EXPO_WITH_INIT;
+ sRSAInput.udNbitLen = 2048;
+ sRSAInput.udEbitLen = 2048;
+ sRSAInput.pudInputM = puiArrHASH;
+ sRSAInput.pudInputE = puiArrPubKeyE;
+ sRSAInput.pudInputN = psImageHeader->uiPubKeyRsaN;
+ sRSAInput.pudOutputP = uiRsaResArr;
- if(efuse_cmp_word(psEfuseInfo->puk_hash, uiHashResArr, uiHashResLen))
- {
- BOOT_PRINTF(UBOOT_ERR, "PubKey Hash Verify -> Failed !\n");
- return 1;
- }
- puiArrHASH = psImageHeader->uiHashY;
+ uiRet = Rsa_Calculate(sRSAInput);
+ if(uiRet != 0)
+ {
+ BOOT_PRINTF(UBOOT_ERR, "Rsa_Calculate ERROR(0x%x)!\n", uiRet);
+ return 2;
+ }
+ puiRsaResAddr = sRSAInput.pudOutputP + (64 - uiHashResLen);
- /*
- * step 1
- */
- sRSAInput.udCalMode = RSA_MOD_EXPO_WITH_INIT;
- sRSAInput.udNbitLen = 1024;
- sRSAInput.udEbitLen = 1024;
- sRSAInput.pudInputM = puiArrHASH;
- sRSAInput.pudInputE = puiArrPubKeyEN;
- sRSAInput.pudInputN = (puiArrPubKeyEN + 32);
- sRSAInput.pudOutputP = uiRsaResArr;
+ /*
+ * step 2
+ */
+ uiLen = uiHashVerifySize;
+ if(rootfs_flag == 1)
+ {
+ puiDataLoadAddr = ___htonl(puiLegacyImgAddr->ih_load) - sizeof(image_header_t) - sizeof(image_header_t) - sizeof(sImageNewHeader);
+ }
+ else
+ {
+ if(1 == m0_flag || 1 == zsp_flag){
+ puiDataLoadAddr = (uchar *)addr + sizeof(sImageNewHeader);
+
+ }else{
+ puiDataLoadAddr = ___htonl(puiLegacyImgAddr->ih_load) - sizeof(image_header_t);
- uiRet = Rsa_Calculate(sRSAInput);
- if(uiRet != 0)
- {
- BOOT_PRINTF(UBOOT_ERR, "Rsa_Calculate ERROR(0x%x)!\n", uiRet);
- return 2;
- }
- puiRsaResAddr = sRSAInput.pudOutputP + (32 - uiHashResLen);
+ }
+ }
+
+ uiHashResLen = 0;
+ memset(uiHashResArr, 0, 8*sizeof(uiHashResArr[0]));
- /*
- * step 2
- */
- uiLen = uiHashVerifySize;
- puiDataLoadAddr = ___htonl(puiLegacyImgAddr->ih_load) - sizeof(image_header_t);
+ sha256_csum_wd((const unsigned char *)puiDataLoadAddr, uiLen, (unsigned char *)uiHashResArr);
+ uiHashResLen = 8;
+ /*´óС¶Ëת»»*/
+ BIG2SMALL(uiHashResArr, 32);
- /* Cleanup Output Buffer. */
- uiHashResLen = 0;
- memset(uiHashResArr, 0, 4*sizeof(uiHashResArr[0]));
+ if(efuse_cmp_word(puiRsaResAddr, uiHashResArr, uiHashResLen))
+ {
+ BOOT_PRINTF(UBOOT_ERR, "LegacyImg Verify -> Failed !\n");
+ return 3;
+ }
- uiRet = Hash_Calculate(HASH_MODE_MD5, HASH_SMALL_ENDIAN, puiDataLoadAddr, uiLen, NULL, 0, uiHashResArr, &uiHashResLen);
- if(uiRet != 0)
- {
- BOOT_PRINTF(UBOOT_ERR, "Hash_Calculate ERROR(0x%x)!\n", uiRet);
- return -1;
- }
-
- if(efuse_cmp_word(puiRsaResAddr, uiHashResArr, uiHashResLen))
- {
- BOOT_PRINTF(UBOOT_ERR, "LegacyImg Verify -> Failed !\n");
- return 3;
}
return 0;
@@ -360,6 +768,19 @@
/* Efuse Status decide ENABLE/DISABLE SecureVerify. */
efuse_get_data();
+ /*OTP status*/
+
+ if(g_nor_flag == 1)
+ {
+ g_iftype = IF_TYPE_NOR;
+ nand_init();
+ /*Çл»³õʼ»¯spi_nand*/
+ g_iftype = IF_TYPE_SPI_NAND;
+ nand_init();
+
+ get_otp_secure_verify_status();
+ }
+
return 0;
}
diff --git a/boot/common/src/uboot/drivers/hash/Makefile b/boot/common/src/uboot/drivers/hash/Makefile
old mode 100644
new mode 100755
index da7afab..bc1ab96
--- a/boot/common/src/uboot/drivers/hash/Makefile
+++ b/boot/common/src/uboot/drivers/hash/Makefile
@@ -26,6 +26,7 @@
LIB := $(obj)libdrv_hash.o
COBJS-y += drv_hash.o
+COBJS-y += sha256.o
COBJS := $(COBJS-y)
SRCS := $(COBJS:.o=.c)
diff --git a/boot/common/src/uboot/drivers/hash/sha256.c b/boot/common/src/uboot/drivers/hash/sha256.c
new file mode 100755
index 0000000..65c7e3d
--- /dev/null
+++ b/boot/common/src/uboot/drivers/hash/sha256.c
@@ -0,0 +1,273 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * FIPS-180-2 compliant SHA-256 implementation
+ *
+ * Copyright (C) 2001-2003 Christophe Devine
+ */
+
+#ifndef USE_HOSTCC
+#include <common.h>
+#include <linux/string.h>
+#else
+#include <string.h>
+#endif /* USE_HOSTCC */
+#include <watchdog.h>
+#include "sha256.h"
+
+const uint8_t sha256_der_prefix[SHA256_DER_LEN] = {
+ 0x30, 0x31, 0x30, 0x0d, 0x06, 0x09, 0x60, 0x86,
+ 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x01, 0x05,
+ 0x00, 0x04, 0x20
+};
+
+/*
+ * 32-bit integer manipulation macros (big endian)
+ */
+#ifndef GET_UINT32_BE
+#define GET_UINT32_BE(n,b,i) { \
+ (n) = ( (unsigned long) (b)[(i) ] << 24 ) \
+ | ( (unsigned long) (b)[(i) + 1] << 16 ) \
+ | ( (unsigned long) (b)[(i) + 2] << 8 ) \
+ | ( (unsigned long) (b)[(i) + 3] ); \
+}
+#endif
+#ifndef PUT_UINT32_BE
+#define PUT_UINT32_BE(n,b,i) { \
+ (b)[(i) ] = (unsigned char) ( (n) >> 24 ); \
+ (b)[(i) + 1] = (unsigned char) ( (n) >> 16 ); \
+ (b)[(i) + 2] = (unsigned char) ( (n) >> 8 ); \
+ (b)[(i) + 3] = (unsigned char) ( (n) ); \
+}
+#endif
+
+void sha256_starts(sha256_context * ctx)
+{
+ ctx->total[0] = 0;
+ ctx->total[1] = 0;
+
+ ctx->state[0] = 0x6A09E667;
+ ctx->state[1] = 0xBB67AE85;
+ ctx->state[2] = 0x3C6EF372;
+ ctx->state[3] = 0xA54FF53A;
+ ctx->state[4] = 0x510E527F;
+ ctx->state[5] = 0x9B05688C;
+ ctx->state[6] = 0x1F83D9AB;
+ ctx->state[7] = 0x5BE0CD19;
+}
+
+static void sha256_process(sha256_context *ctx, const uint8_t data[64])
+{
+ uint32_t temp1, temp2;
+ uint32_t W[64];
+ uint32_t A, B, C, D, E, F, G, H;
+
+ GET_UINT32_BE(W[0], data, 0);
+ GET_UINT32_BE(W[1], data, 4);
+ GET_UINT32_BE(W[2], data, 8);
+ GET_UINT32_BE(W[3], data, 12);
+ GET_UINT32_BE(W[4], data, 16);
+ GET_UINT32_BE(W[5], data, 20);
+ GET_UINT32_BE(W[6], data, 24);
+ GET_UINT32_BE(W[7], data, 28);
+ GET_UINT32_BE(W[8], data, 32);
+ GET_UINT32_BE(W[9], data, 36);
+ GET_UINT32_BE(W[10], data, 40);
+ GET_UINT32_BE(W[11], data, 44);
+ GET_UINT32_BE(W[12], data, 48);
+ GET_UINT32_BE(W[13], data, 52);
+ GET_UINT32_BE(W[14], data, 56);
+ GET_UINT32_BE(W[15], data, 60);
+
+#define SHR(x,n) ((x & 0xFFFFFFFF) >> n)
+#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
+
+#define S0(x) (ROTR(x, 7) ^ ROTR(x,18) ^ SHR(x, 3))
+#define S1(x) (ROTR(x,17) ^ ROTR(x,19) ^ SHR(x,10))
+
+#define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
+#define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
+
+#define F0(x,y,z) ((x & y) | (z & (x | y)))
+#define F1(x,y,z) (z ^ (x & (y ^ z)))
+
+#define R(t) \
+( \
+ W[t] = S1(W[t - 2]) + W[t - 7] + \
+ S0(W[t - 15]) + W[t - 16] \
+)
+
+#define P(a,b,c,d,e,f,g,h,x,K) { \
+ temp1 = h + S3(e) + F1(e,f,g) + K + x; \
+ temp2 = S2(a) + F0(a,b,c); \
+ d += temp1; h = temp1 + temp2; \
+}
+
+ A = ctx->state[0];
+ B = ctx->state[1];
+ C = ctx->state[2];
+ D = ctx->state[3];
+ E = ctx->state[4];
+ F = ctx->state[5];
+ G = ctx->state[6];
+ H = ctx->state[7];
+
+ P(A, B, C, D, E, F, G, H, W[0], 0x428A2F98);
+ P(H, A, B, C, D, E, F, G, W[1], 0x71374491);
+ P(G, H, A, B, C, D, E, F, W[2], 0xB5C0FBCF);
+ P(F, G, H, A, B, C, D, E, W[3], 0xE9B5DBA5);
+ P(E, F, G, H, A, B, C, D, W[4], 0x3956C25B);
+ P(D, E, F, G, H, A, B, C, W[5], 0x59F111F1);
+ P(C, D, E, F, G, H, A, B, W[6], 0x923F82A4);
+ P(B, C, D, E, F, G, H, A, W[7], 0xAB1C5ED5);
+ P(A, B, C, D, E, F, G, H, W[8], 0xD807AA98);
+ P(H, A, B, C, D, E, F, G, W[9], 0x12835B01);
+ P(G, H, A, B, C, D, E, F, W[10], 0x243185BE);
+ P(F, G, H, A, B, C, D, E, W[11], 0x550C7DC3);
+ P(E, F, G, H, A, B, C, D, W[12], 0x72BE5D74);
+ P(D, E, F, G, H, A, B, C, W[13], 0x80DEB1FE);
+ P(C, D, E, F, G, H, A, B, W[14], 0x9BDC06A7);
+ P(B, C, D, E, F, G, H, A, W[15], 0xC19BF174);
+ P(A, B, C, D, E, F, G, H, R(16), 0xE49B69C1);
+ P(H, A, B, C, D, E, F, G, R(17), 0xEFBE4786);
+ P(G, H, A, B, C, D, E, F, R(18), 0x0FC19DC6);
+ P(F, G, H, A, B, C, D, E, R(19), 0x240CA1CC);
+ P(E, F, G, H, A, B, C, D, R(20), 0x2DE92C6F);
+ P(D, E, F, G, H, A, B, C, R(21), 0x4A7484AA);
+ P(C, D, E, F, G, H, A, B, R(22), 0x5CB0A9DC);
+ P(B, C, D, E, F, G, H, A, R(23), 0x76F988DA);
+ P(A, B, C, D, E, F, G, H, R(24), 0x983E5152);
+ P(H, A, B, C, D, E, F, G, R(25), 0xA831C66D);
+ P(G, H, A, B, C, D, E, F, R(26), 0xB00327C8);
+ P(F, G, H, A, B, C, D, E, R(27), 0xBF597FC7);
+ P(E, F, G, H, A, B, C, D, R(28), 0xC6E00BF3);
+ P(D, E, F, G, H, A, B, C, R(29), 0xD5A79147);
+ P(C, D, E, F, G, H, A, B, R(30), 0x06CA6351);
+ P(B, C, D, E, F, G, H, A, R(31), 0x14292967);
+ P(A, B, C, D, E, F, G, H, R(32), 0x27B70A85);
+ P(H, A, B, C, D, E, F, G, R(33), 0x2E1B2138);
+ P(G, H, A, B, C, D, E, F, R(34), 0x4D2C6DFC);
+ P(F, G, H, A, B, C, D, E, R(35), 0x53380D13);
+ P(E, F, G, H, A, B, C, D, R(36), 0x650A7354);
+ P(D, E, F, G, H, A, B, C, R(37), 0x766A0ABB);
+ P(C, D, E, F, G, H, A, B, R(38), 0x81C2C92E);
+ P(B, C, D, E, F, G, H, A, R(39), 0x92722C85);
+ P(A, B, C, D, E, F, G, H, R(40), 0xA2BFE8A1);
+ P(H, A, B, C, D, E, F, G, R(41), 0xA81A664B);
+ P(G, H, A, B, C, D, E, F, R(42), 0xC24B8B70);
+ P(F, G, H, A, B, C, D, E, R(43), 0xC76C51A3);
+ P(E, F, G, H, A, B, C, D, R(44), 0xD192E819);
+ P(D, E, F, G, H, A, B, C, R(45), 0xD6990624);
+ P(C, D, E, F, G, H, A, B, R(46), 0xF40E3585);
+ P(B, C, D, E, F, G, H, A, R(47), 0x106AA070);
+ P(A, B, C, D, E, F, G, H, R(48), 0x19A4C116);
+ P(H, A, B, C, D, E, F, G, R(49), 0x1E376C08);
+ P(G, H, A, B, C, D, E, F, R(50), 0x2748774C);
+ P(F, G, H, A, B, C, D, E, R(51), 0x34B0BCB5);
+ P(E, F, G, H, A, B, C, D, R(52), 0x391C0CB3);
+ P(D, E, F, G, H, A, B, C, R(53), 0x4ED8AA4A);
+ P(C, D, E, F, G, H, A, B, R(54), 0x5B9CCA4F);
+ P(B, C, D, E, F, G, H, A, R(55), 0x682E6FF3);
+ P(A, B, C, D, E, F, G, H, R(56), 0x748F82EE);
+ P(H, A, B, C, D, E, F, G, R(57), 0x78A5636F);
+ P(G, H, A, B, C, D, E, F, R(58), 0x84C87814);
+ P(F, G, H, A, B, C, D, E, R(59), 0x8CC70208);
+ P(E, F, G, H, A, B, C, D, R(60), 0x90BEFFFA);
+ P(D, E, F, G, H, A, B, C, R(61), 0xA4506CEB);
+ P(C, D, E, F, G, H, A, B, R(62), 0xBEF9A3F7);
+ P(B, C, D, E, F, G, H, A, R(63), 0xC67178F2);
+
+ ctx->state[0] += A;
+ ctx->state[1] += B;
+ ctx->state[2] += C;
+ ctx->state[3] += D;
+ ctx->state[4] += E;
+ ctx->state[5] += F;
+ ctx->state[6] += G;
+ ctx->state[7] += H;
+}
+
+void sha256_update(sha256_context *ctx, const uint8_t *input, uint32_t length)
+{
+ uint32_t left, fill;
+
+ if (!length)
+ return;
+
+ left = ctx->total[0] & 0x3F;
+ fill = 64 - left;
+
+ ctx->total[0] += length;
+ ctx->total[0] &= 0xFFFFFFFF;
+
+ if (ctx->total[0] < length)
+ ctx->total[1]++;
+
+ if (left && length >= fill) {
+ memcpy((void *) (ctx->buffer + left), (void *) input, fill);
+ sha256_process(ctx, ctx->buffer);
+ length -= fill;
+ input += fill;
+ left = 0;
+ }
+
+ while (length >= 64) {
+ sha256_process(ctx, input);
+ length -= 64;
+ input += 64;
+ }
+
+ if (length)
+ memcpy((void *) (ctx->buffer + left), (void *) input, length);
+}
+
+static uint8_t sha256_padding[64] = {
+ 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+};
+
+void sha256_finish(sha256_context * ctx, uint8_t digest[32])
+{
+ uint32_t last, padn;
+ uint32_t high, low;
+ uint8_t msglen[8];
+
+ high = ((ctx->total[0] >> 29)
+ | (ctx->total[1] << 3));
+ low = (ctx->total[0] << 3);
+
+ PUT_UINT32_BE(high, msglen, 0);
+ PUT_UINT32_BE(low, msglen, 4);
+
+ last = ctx->total[0] & 0x3F;
+ padn = (last < 56) ? (56 - last) : (120 - last);
+
+ sha256_update(ctx, sha256_padding, padn);
+ sha256_update(ctx, msglen, 8);
+
+ PUT_UINT32_BE(ctx->state[0], digest, 0);
+ PUT_UINT32_BE(ctx->state[1], digest, 4);
+ PUT_UINT32_BE(ctx->state[2], digest, 8);
+ PUT_UINT32_BE(ctx->state[3], digest, 12);
+ PUT_UINT32_BE(ctx->state[4], digest, 16);
+ PUT_UINT32_BE(ctx->state[5], digest, 20);
+ PUT_UINT32_BE(ctx->state[6], digest, 24);
+ PUT_UINT32_BE(ctx->state[7], digest, 28);
+}
+
+/*
+ * Output = SHA-256( input buffer ). Trigger the watchdog every 'chunk_sz'
+ * bytes of input processed.
+ */
+void sha256_csum_wd(const unsigned char *input, unsigned int ilen,
+ unsigned char *output)
+{
+ sha256_context ctx;
+
+ sha256_starts(&ctx);
+
+ sha256_update(&ctx, input, ilen);
+
+ sha256_finish(&ctx, output);
+}
diff --git a/boot/common/src/uboot/drivers/hash/sha256.h b/boot/common/src/uboot/drivers/hash/sha256.h
new file mode 100755
index 0000000..2da2952
--- /dev/null
+++ b/boot/common/src/uboot/drivers/hash/sha256.h
@@ -0,0 +1,25 @@
+#ifndef _SHA256_H
+#define _SHA256_H
+
+#define SHA256_SUM_LEN 32
+#define SHA256_DER_LEN 19
+
+extern const uint8_t sha256_der_prefix[];
+
+/* Reset watchdog each time we process this many bytes */
+#define CHUNKSZ_SHA256 (64 * 1024)
+
+typedef struct {
+ uint32_t total[2];
+ uint32_t state[8];
+ uint8_t buffer[64];
+} sha256_context;
+
+void sha256_starts(sha256_context * ctx);
+void sha256_update(sha256_context *ctx, const uint8_t *input, uint32_t length);
+void sha256_finish(sha256_context * ctx, uint8_t digest[SHA256_SUM_LEN]);
+
+void sha256_csum_wd(const unsigned char *input, unsigned int ilen,
+ unsigned char *output);
+
+#endif /* _SHA256_H */
diff --git a/boot/common/src/uboot/drivers/misc/load.c b/boot/common/src/uboot/drivers/misc/load.c
index bbb6c27..2c9c8e7 100755
--- a/boot/common/src/uboot/drivers/misc/load.c
+++ b/boot/common/src/uboot/drivers/misc/load.c
@@ -47,6 +47,9 @@
#define time_debug_printf(fmt, val)
#endif /* TIME_DEBUG */
#define reg16(addr) (*(volatile unsigned short*)(addr))
+#define reg32(addr) (*(volatile unsigned long *)(addr))
+#define RSA_1024 10
+#define RSA_2048 11
DECLARE_GLOBAL_DATA_PTR;
@@ -79,6 +82,7 @@
/* Secure Verify Flag. 1->Disable, 0->Enable */
extern unsigned int guiEfuseStatus;
+extern unsigned int guiOtpStatus;
uint32_t arm_ps_ep = 0; /* Entry Point Address */
uint32_t arm_cpucap_ep = 0;
@@ -100,7 +104,9 @@
int rd_offset = 0;
int rd_size = 0;
-
+int rootfs_flag = 0;
+int m0_flag = 0;
+int zsp_flag = 0;
/* ================================================================================
* page_align : Ò³¶ÔÆë
*/
@@ -325,8 +331,8 @@
memcpy((uchar *)DDR_BASE_CAP_DTB_ADDR,
(uchar *)(CONFIG_SYS_SDRAM_TEMP_BASE),
CAP_DTB_LEN);
-
- BOOT_PRINTF(UBOOT_NOTICE, "dtb load image finished\n");
+
+ BOOT_PRINTF(UBOOT_NOTICE, "dtb load image finished.\n");
return 0;
}
@@ -336,7 +342,8 @@
{
char cmd[64] = {0};
int remap = 0;
-
+ int ret = 0;
+ u8 ucRet = 0;
remap = readl(0x140000);
remap |= 0x800000;
writel(remap,0x140000);
@@ -351,9 +358,54 @@
#else
sprintf(cmd, "fsload imagefs 0x%x %s", (ulong)CONFIG_SYS_SDRAM_TEMP_BASE, M0_IMAGE_PATH);
#endif
- run_command(cmd, 0);
+ ret = run_command(cmd, 0);
+ if(ret < 0)
+ return ret;
flush_dcache_all();
-
+
+#if defined(CONFIG_ZX297520V3E_VEHICLE_DC) || defined(CONFIG_ZX297520V3E_VEHICLE_DC_REF)
+ m0_flag = 1;
+ if(g_nor_flag == 1)
+ {
+ if(guiOtpStatus == 0) //Secure Verify.
+ {
+ BOOT_PRINTF(UBOOT_DBG, "rpm image Start Secure Verify...\n");
+
+ ucRet = secure_verify((u32 )CONFIG_SYS_SDRAM_TEMP_BASE);
+ if(ucRet != 0)
+ {
+ BOOT_PRINTF(UBOOT_ERR, "rpm image Secure Verify FAILED!\n");
+ return 1;
+ }
+ BOOT_PRINTF(UBOOT_NOTICE, "rpm image Secure Verify PASS!\n");
+ }
+ else
+ {
+ BOOT_PRINTF(UBOOT_NOTICE, "rpm image Skip Secure Verify...\n");
+ }
+ }
+ else
+ {
+ if(guiEfuseStatus == 0) //Secure Verify.
+ {
+ BOOT_PRINTF(UBOOT_DBG, "rpm image Start Secure Verify...\n");
+
+ ucRet = secure_verify((u32 )CONFIG_SYS_SDRAM_TEMP_BASE);
+ if(ucRet != 0)
+ {
+ BOOT_PRINTF(UBOOT_ERR, "rpm image Secure Verify FAILED!\n");
+ return 1;
+ }
+ BOOT_PRINTF(UBOOT_NOTICE, "rpm image Secure Verify PASS!\n");
+ }
+ else
+ {
+ BOOT_PRINTF(UBOOT_NOTICE, "rpm image Skip Secure Verify...\n");
+ }
+ }
+ m0_flag = 0;
+#endif
+
/*2¡¢ÉèÖÃM0µÄÈë¿ÚµØÖ·ÒÔ¼°M0°æ±¾°áÔËÍê³Éflagµ½iramÖÐ */
writel(1, M0_IMAGE_READY_FLAG_ADDR);
@@ -365,6 +417,76 @@
return 0;
}
+int load_rootfs(void)
+{
+ int ret = 0;
+ int type = 0;
+ struct flash_ops *flash = NULL;
+ uint32_t i = 0;
+ uint32_t bad_nums = 0;
+ uint32_t part_block_nums = 0;
+ uint32_t part_offset = 0;
+ uint32_t part_size = 0;
+ uchar * part_name = "rootfs";;
+ nand_info_t *nand = &nand_info[nand_curr_device];
+ flush_dcache_all();
+
+ flash_dmabuf_disable_flag = 1;
+ flash = get_flash_ops();
+ type = read_boot_flashtype();
+
+#if defined(CONFIG_ZX297520V3E_MDL_AB) || defined(CONFIG_ZX297520V3E_VEHICLE_DC) || defined(CONFIG_ZX297520V3E_VEHICLE_DC_REF)
+
+ if(imagefs_flag == 1)
+ {
+ part_name = "rootfs";
+ }
+ else
+ {
+ part_name = "rootfs2";
+ }
+
+#endif
+ /* ѰÕÒ·ÖÇø */
+ partition_entry_t * entry = find_partition_para(part_name);
+ if( entry == NULL )
+ {
+ BOOT_PRINTF(UBOOT_ERR, "[%s]: can't find the partition...\n", part_name);
+ return 1;
+ }
+
+ /* »ñµÃ·ÖÇøÊ×µØÖ· */
+ part_offset = entry->part_offset;
+ part_size = entry->part_size;
+
+ /* ²éѯµ±Ç°·ÖÇø»µ¿éÊý*/
+ bad_nums = 0;
+ part_block_nums = entry->part_size / nand->erasesize;
+ for(i = 0; i < part_block_nums; i++)
+ {
+ if(nand_block_isbad (nand, entry->part_offset + (loff_t)i * nand->erasesize))
+ {
+ printf("bad block addr = 0x%x\n", (entry->part_offset + i * nand->erasesize));
+ bad_nums++;
+ }
+ }
+
+ part_size = part_size - bad_nums * nand->erasesize;
+ ret = flash->read(nand,(loff_t)part_offset,
+ &part_size,(u_char *)CONFIG_SYS_SDRAM_ROOTFS_BASE);
+ if( ret != 0 )
+ {
+ BOOT_PRINTF(UBOOT_ERR, "[%s]: read the rootfs error!\n", part_name);
+ return 1;
+ }
+ memcpy((uchar *)(CONFIG_SYS_SDRAM_ROOTFS_BASE - sizeof(image_header_t)),
+ (uchar *)(CONFIG_SYS_SDRAM_TEMP_BASE + sizeof(sImageNewHeader) + sizeof(sImageNewHeader)),
+ sizeof(image_header_t));
+ flash_dmabuf_disable_flag = 0;
+ flush_dcache_all();
+
+ return 0;
+}
#if defined(CONFIG_ZX297520V3E_JFFS2_COMPRESS)
uint32_t lzma_header(uint32_t *ztelzma_dict,
@@ -484,7 +606,7 @@
}
/* °´ÕÕZSPµÄ¸ñÊ½ÖØÅÅ */
- reform_zsp_image(image_tmp_buf);
+ reform_zsp_image(image_tmp_buf + sizeof(sImageNewHeader) + sizeof(image_header_t));
BOOT_PRINTF(UBOOT_NOTICE, "zsp image load finished.\n");
return 0;
@@ -514,6 +636,8 @@
#endif
uint32_t uiImgHdrSizeOld = sizeof(image_header_t);
uint32_t uiImgHdrSizeNew = 0;
+ uint32_t uiRootfsHdrSizeOld = sizeof(image_header_t);
+ uint32_t uiRootfsHdrSizeNew = sizeof(sImageNewHeader);
uint32_t uiImgHdrlzma = 13;
uint32_t lastlzmaSize = 0;
@@ -522,7 +646,7 @@
BOOT_PRINTF(UBOOT_NOTICE, "AP image load begin...\n");
- uiImgHdrSizeNew = sizeof(sImageHeader);
+ uiImgHdrSizeNew = sizeof(sImageNewHeader);
image_header_t *psImgHdrOld = NULL;
@@ -582,20 +706,27 @@
return -1;
}
- /*»ñÈ¡¹«Ô¿´«µÝ¸ø´ó°æ±¾Ê¹ÓÃ*/
- memcpy(CFG_SECURE_PUK_ADDR,CONFIG_SYS_SDRAM_TEMP_LZMA,256);
+ /*»ñÈ¡¹«Ô¿´«µÝ¸ø´ó°æ±¾Ê¹ÓÃ*/
+ if(reg16(CONFIG_SYS_SDRAM_TEMP_LZMA)== RSA_1024)
+ {
+ memset(CFG_SECURE_PUK_ADDR,0,256);
+ memcpy(CFG_SECURE_PUK_ADDR+124,CONFIG_SYS_SDRAM_TEMP_BASE+12,132);
+ }else{
+ printf("signtype is %s\n", reg16(CONFIG_SYS_SDRAM_TEMP_BASE)== RSA_2048 ? "RSA2048":"UNKNOWN");
+ }
- psImgHdrOld = (image_header_t *)(CONFIG_SYS_SDRAM_TEMP_LZMA + uiImgHdrSizeNew);
+ psImgHdrOld = (image_header_t *)(CONFIG_SYS_SDRAM_TEMP_LZMA + uiImgHdrSizeNew + uiRootfsHdrSizeNew + uiRootfsHdrSizeOld);
if(___htonl(psImgHdrOld->ih_magic) != IH_MAGIC)
{
BOOT_PRINTF(UBOOT_ERR, "Magic Num Check Failed,Maybe no AP bin !!!\n");
return 1;
- }
-
+ }
+
uiImgSize = ___htonl(psImgHdrOld->ih_size);
uiEntryPoint = ___htonl(psImgHdrOld->ih_ep);
- uiLoadPoint = ___htonl(psImgHdrOld->ih_load) - uiImgHdrSizeOld; /* ÕâÀïʹÓÃLOADµØÖ· */
+ uiLoadPoint = ___htonl(psImgHdrOld->ih_load) - uiImgHdrSizeOld - uiRootfsHdrSizeOld - uiRootfsHdrSizeNew; /* ÕâÀïʹÓÃLOADµØÖ· */
+
lzmaLoadPoint = uiLoadPoint;
BOOT_PRINTF(UBOOT_NOTICE, "Load AP image, Size=0x%0x, to 0x%0x.\n",
uiImgSize, uiLoadPoint);
@@ -657,6 +788,7 @@
{
sys_ddr_kernel_start = uiEntryPoint - 0x8000; /* usually */
gd->bd->bi_boot_params = sys_ddr_kernel_start + 0x100;
+ uiLoadPoint += (uiRootfsHdrSizeOld + uiRootfsHdrSizeNew);
sprintf((char *)cmd," bootm 0x%0x", uiLoadPoint);
setenv("bootcmd", (char *)cmd);
}
@@ -680,7 +812,8 @@
{
char cmd[64] = {0};
uint32_t image_tmp_buf = 0;
-
+ int ret = 0;
+ u8 ucRet = 0;
BOOT_PRINTF(UBOOT_NOTICE, "zsp image load begin...\n");
image_tmp_buf = CONFIG_SYS_SDRAM_TEMP_BASE;
//#ifdef CONFIG_ZX297520V3E_MDL_AB
@@ -692,9 +825,56 @@
#else
sprintf(cmd, "fsload imagefs 0x%x %s", (ulong)image_tmp_buf, ZSP_IMAGE_PATH);
#endif
- run_command(cmd, 0);
+ ret = run_command(cmd, 0);
+ if(ret < 0)
+ return ret;
+
+#if defined(CONFIG_ZX297520V3E_VEHICLE_DC) || defined(CONFIG_ZX297520V3E_VEHICLE_DC_REF)
+ zsp_flag = 1;
+ if(g_nor_flag == 1)
+ {
+ if(guiOtpStatus == 0) //Secure Verify.
+ {
+ BOOT_PRINTF(UBOOT_DBG, "zsp image Start Secure Verify...\n");
+
+ ucRet = secure_verify((u32 )image_tmp_buf);
+ if(ucRet != 0)
+ {
+ BOOT_PRINTF(UBOOT_ERR, "zsp image Secure Verify FAILED!\n");
+ return 1;
+ }
+ BOOT_PRINTF(UBOOT_NOTICE, "zsp image Secure Verify PASS!\n");
+ }
+ else
+ {
+ BOOT_PRINTF(UBOOT_NOTICE, "zsp image Skip Secure Verify...\n");
+ }
+ }
+ else
+ {
+ if(guiEfuseStatus == 0) //Secure Verify.
+ {
+ BOOT_PRINTF(UBOOT_DBG, "zsp image Start Secure Verify...\n");
+
+ ucRet = secure_verify((u32 )image_tmp_buf);
+ if(ucRet != 0)
+ {
+ BOOT_PRINTF(UBOOT_ERR, "zsp image Secure Verify FAILED!\n");
+ return 1;
+ }
+ BOOT_PRINTF(UBOOT_NOTICE, "zsp image Secure Verify PASS!\n");
+ }
+ else
+ {
+ BOOT_PRINTF(UBOOT_NOTICE, "zsp image Skip Secure Verify...\n");
+ }
+ }
+ zsp_flag = 0;
- reform_zsp_image(image_tmp_buf);
+#endif
+
+ reform_zsp_image(image_tmp_buf + sizeof(sImageNewHeader) + sizeof(image_header_t));
+
BOOT_PRINTF(UBOOT_NOTICE, "zsp image load finished.\n");
return 0;
@@ -714,11 +894,13 @@
uint32_t uiCRCCalRes = 0;
#endif
uint32_t uiImgHdrSizeOld = sizeof(image_header_t);
- uint32_t uiImgHdrSizeNew = 0;
+ uint32_t uiRootfsHdrSizeOld = sizeof(image_header_t);
- uiImgHdrSizeNew = sizeof(sImageHeader);
+ uint32_t uiImgHdrSizeNew = sizeof(sImageNewHeader);
+ uint32_t uiRootfsHdrSizeNew = sizeof(sImageNewHeader);
image_header_t *psImgHdrOld = NULL;
+ image_header_t *psRootfsHdrOld = NULL;
/*1¡¢½«ap imgÎļþloadµ½ÁÙʱµØÖ·*/
//#ifdef CONFIG_ZX297520V3E_MDL_AB
@@ -733,57 +915,185 @@
sprintf(cmd, "fsload imagefs 0x%x /ap_%s.bin",
(ulong)CONFIG_SYS_SDRAM_TEMP_BASE, image_name);
#endif
- run_command(cmd, 0);
-
- /*»ñÈ¡¹«Ô¿´«µÝ¸ø´ó°æ±¾Ê¹ÓÃ*/
- memcpy(CFG_SECURE_PUK_ADDR,CONFIG_SYS_SDRAM_TEMP_BASE,256);
+ ret = run_command(cmd, 0);
+ if(ret < 0)
+ return ret;
- /*2¡¢»ñÈ¡°æ±¾µÄ´óСºÍÔËÐеØÖ· */
- psImgHdrOld = (image_header_t *)(CONFIG_SYS_SDRAM_TEMP_BASE + uiImgHdrSizeNew);
- if(___htonl(psImgHdrOld->ih_magic) != IH_MAGIC)
+ if(strncmp((const char *)image_name, "cpuap", 5) == 0)
{
- BOOT_PRINTF(UBOOT_ERR, "Magic Num Check Failed,Maybe no AP bin !!!\n");
- return 1;
- }
+ rootfs_flag = 1;
- uiImgSize = ___htonl(psImgHdrOld->ih_size);
- uiEntryPoint = ___htonl(psImgHdrOld->ih_ep);
- uiLoadPoint = ___htonl(psImgHdrOld->ih_load) - uiImgHdrSizeOld; /* ÕâÀïʹÓÃLOADµØÖ· */
-
- BOOT_PRINTF(UBOOT_NOTICE, "Load AP image, Size=0x%0x, to 0x%0x.\n",
- uiImgSize, uiLoadPoint);
-
-#if LOAD_IMAGE_CRC
- uiCRCChkSum = ___htonl(psImgHdrOld->ih_dcrc);
- BOOT_PRINTF(UBOOT_NOTICE, "AP image CRC Checksum=0x%0x.\n", uiCRCChkSum);
-#endif
- BOOT_PRINTF(UBOOT_NOTICE, "AP image uiLoadPoint=0x%0x.\n", uiLoadPoint);
-
- /*3¡¢¿½±´°æ±¾Êý¾Ýµ½ÔËÐеØÖ· */
- memcpy((uchar *)uiLoadPoint,
- (uchar *)(CONFIG_SYS_SDRAM_TEMP_BASE + uiImgHdrSizeNew),
- uiImgSize +uiImgHdrSizeOld);
-
- BOOT_PRINTF(UBOOT_NOTICE, "AP image load image finished\n");
-
- if(guiEfuseStatus == 0) //Secure Verify.
- {
- BOOT_PRINTF(UBOOT_DBG, "AP image Start Secure Verify...\n");
-
- ucRet = secure_verify((u32 )CONFIG_SYS_SDRAM_TEMP_BASE);
- if(ucRet != 0)
+ if(g_nor_flag == 1)
{
- BOOT_PRINTF(UBOOT_ERR, "AP image Secure Verify FAILED!\n");
+ /*»ñÈ¡¹«Ô¿´«µÝ¸ø´ó°æ±¾Ê¹ÓÃ*/
+ memcpy(OTP_SECURE_PUK_BASE,(uchar *)CONFIG_SYS_SDRAM_TEMP_BASE+4,380);
+ //printf("OTP_SECURE_PUK_BASE is 0x%x\n",OTP_SECURE_PUK_BASE);
+
+ /*°²È«Ð£Ñérootfs*/
+ if(guiOtpStatus == 0) //Secure Verify.
+ {
+ BOOT_PRINTF(UBOOT_DBG, "AP rootfs Start Secure Verify...\n");
+
+ /*¼ÓÔØrootfs¾µÏñ*/
+ ret = load_rootfs();
+ if(ret != 0)
+ {
+ printf("rootfs load error.\n");
+ return 1;
+ }
+
+ ucRet = rootfs_secure_verify((u32 )(CONFIG_SYS_SDRAM_TEMP_BASE + uiImgHdrSizeNew));
+ if(ucRet != 0)
+ {
+ BOOT_PRINTF(UBOOT_ERR, "AP rootfs Secure Verify FAILED!\n");
+ return 1;
+ }
+ BOOT_PRINTF(UBOOT_NOTICE, "AP rootfs Secure Verify PASS!\n");
+ }
+ else
+ {
+ BOOT_PRINTF(UBOOT_NOTICE, "AP rootfs Skip Secure Verify...\n");
+ }
+ }
+ else
+ {
+ /*»ñÈ¡¹«Ô¿´«µÝ¸ø´ó°æ±¾Ê¹ÓÃ*/
+ if(reg16(CONFIG_SYS_SDRAM_TEMP_BASE)== RSA_1024)
+ {
+ memset(CFG_SECURE_PUK_ADDR,0,256);
+ memcpy(CFG_SECURE_PUK_ADDR+124,CONFIG_SYS_SDRAM_TEMP_BASE+12,132);
+ }else{
+ printf("signtype is %s\n", reg16(CONFIG_SYS_SDRAM_TEMP_BASE)== RSA_2048 ? "RSA2048":"UNKNOWN");
+ //printf("pub key is illegal...\n");
+ }
+ /*°²È«Ð£Ñérootfs*/
+ if(guiEfuseStatus == 0) //Secure Verify.
+ {
+ BOOT_PRINTF(UBOOT_DBG, "AP rootfs Start Secure Verify...\n");
+
+ /*¼ÓÔØrootfs¾µÏñ*/
+ ret = load_rootfs();
+ if(ret != 0)
+ {
+ printf("rootfs load error.\n");
+ return 1;
+ }
+
+ ucRet = rootfs_secure_verify((u32 )(CONFIG_SYS_SDRAM_TEMP_BASE + uiImgHdrSizeNew));
+ if(ucRet != 0)
+ {
+ BOOT_PRINTF(UBOOT_ERR, "AP rootfs Secure Verify FAILED!\n");
+ return 1;
+ }
+ BOOT_PRINTF(UBOOT_NOTICE, "AP rootfs Secure Verify PASS!\n");
+ }
+ else
+ {
+ BOOT_PRINTF(UBOOT_NOTICE, "AP rootfs Skip Secure Verify...\n");
+ }
+
+ }
+
+
+ /*2¡¢»ñÈ¡°æ±¾µÄ´óСºÍÔËÐеØÖ· */
+ psImgHdrOld = (image_header_t *)(CONFIG_SYS_SDRAM_TEMP_BASE + uiImgHdrSizeNew + uiRootfsHdrSizeNew + uiRootfsHdrSizeOld);
+ if(___htonl(psImgHdrOld->ih_magic) != IH_MAGIC)
+ {
+ BOOT_PRINTF(UBOOT_ERR, "Magic Num Check Failed,Maybe no AP bin !!!\n");
return 1;
}
- BOOT_PRINTF(UBOOT_NOTICE, "AP image Secure Verify PASS!\n");
+
+ uiImgSize = ___htonl(psImgHdrOld->ih_size);
+ uiEntryPoint = ___htonl(psImgHdrOld->ih_ep);
+ uiLoadPoint = ___htonl(psImgHdrOld->ih_load) - uiImgHdrSizeOld - uiRootfsHdrSizeOld - uiRootfsHdrSizeNew; /* ÕâÀïʹÓÃLOADµØÖ· */
+
+ BOOT_PRINTF(UBOOT_NOTICE, "Load AP image, Size=0x%0x, to 0x%0x.\n",
+ uiImgSize, uiLoadPoint);
+
+#if LOAD_IMAGE_CRC
+ uiCRCChkSum = ___htonl(psImgHdrOld->ih_dcrc);
+ BOOT_PRINTF(UBOOT_NOTICE, "AP image CRC Checksum=0x%0x.\n", uiCRCChkSum);
+#endif
+ BOOT_PRINTF(UBOOT_NOTICE, "AP image uiLoadPoint=0x%0x.\n", uiLoadPoint);
+
+ /*3¡¢¿½±´°æ±¾Êý¾Ýµ½ÔËÐеØÖ· */
+ memcpy((uchar *)uiLoadPoint,
+ (uchar *)(CONFIG_SYS_SDRAM_TEMP_BASE + uiImgHdrSizeNew),
+ uiImgSize + uiImgHdrSizeOld + uiRootfsHdrSizeOld + uiRootfsHdrSizeNew);
+
+ BOOT_PRINTF(UBOOT_NOTICE, "AP image load image finished\n");
+ }
+ else
+ {
+ /*2¡¢»ñÈ¡°æ±¾µÄ´óСºÍÔËÐеØÖ· */
+ psImgHdrOld = (image_header_t *)(CONFIG_SYS_SDRAM_TEMP_BASE + uiImgHdrSizeNew);
+ if(___htonl(psImgHdrOld->ih_magic) != IH_MAGIC)
+ {
+ BOOT_PRINTF(UBOOT_ERR, "Magic Num Check Failed,Maybe no AP bin !!!\n");
+ return 1;
+ }
+
+ uiImgSize = ___htonl(psImgHdrOld->ih_size);
+ uiEntryPoint = ___htonl(psImgHdrOld->ih_ep);
+ uiLoadPoint = ___htonl(psImgHdrOld->ih_load) - uiImgHdrSizeOld; /* ÕâÀïʹÓÃLOADµØÖ· */
+
+ BOOT_PRINTF(UBOOT_NOTICE, "Load AP image, Size=0x%0x, to 0x%0x.\n",
+ uiImgSize, uiLoadPoint);
+
+#if LOAD_IMAGE_CRC
+ uiCRCChkSum = ___htonl(psImgHdrOld->ih_dcrc);
+ BOOT_PRINTF(UBOOT_NOTICE, "AP image CRC Checksum=0x%0x.\n", uiCRCChkSum);
+#endif
+ BOOT_PRINTF(UBOOT_NOTICE, "AP image uiLoadPoint=0x%0x.\n", uiLoadPoint);
+
+ /*3¡¢¿½±´°æ±¾Êý¾Ýµ½ÔËÐеØÖ· */
+ memcpy((uchar *)uiLoadPoint,
+ (uchar *)(CONFIG_SYS_SDRAM_TEMP_BASE + uiImgHdrSizeNew),
+ uiImgSize +uiImgHdrSizeOld);
+
+ BOOT_PRINTF(UBOOT_NOTICE, "AP image load image finished\n");
+ }
+
+ if(g_nor_flag == 1)
+ {
+ if(guiOtpStatus == 0) //Secure Verify.
+ {
+ BOOT_PRINTF(UBOOT_DBG, "AP image Start Secure Verify...\n");
+
+ ucRet = secure_verify((u32 )CONFIG_SYS_SDRAM_TEMP_BASE);
+ if(ucRet != 0)
+ {
+ BOOT_PRINTF(UBOOT_ERR, "AP image Secure Verify FAILED!\n");
+ return 1;
+ }
+ BOOT_PRINTF(UBOOT_NOTICE, "AP image Secure Verify PASS!\n");
+ }
+ else
+ {
+ BOOT_PRINTF(UBOOT_NOTICE, "AP image Skip Secure Verify...\n");
+ }
}
else
{
- BOOT_PRINTF(UBOOT_NOTICE, "AP image Skip Secure Verify...\n");
- }
+ if(guiEfuseStatus == 0) //Secure Verify.
+ {
+ BOOT_PRINTF(UBOOT_DBG, "AP image Start Secure Verify...\n");
- if(strncmp((const char *)image_name, "cpucap", 6) == 0)
+ ucRet = secure_verify((u32 )CONFIG_SYS_SDRAM_TEMP_BASE);
+ if(ucRet != 0)
+ {
+ BOOT_PRINTF(UBOOT_ERR, "AP image Secure Verify FAILED!\n");
+ return 1;
+ }
+ BOOT_PRINTF(UBOOT_NOTICE, "AP image Secure Verify PASS!\n");
+ }
+ else
+ {
+ BOOT_PRINTF(UBOOT_NOTICE, "AP image Skip Secure Verify...\n");
+ }
+ }
+
+ if(strncmp((const char *)image_name, "cpucap", 6) == 0)
{
arm_cpucap_ep = uiEntryPoint; /* usually */
printf("cpucap load finish....\n");
@@ -792,7 +1102,8 @@
{
sys_ddr_kernel_start = uiEntryPoint - 0x8000; /* usually */
gd->bd->bi_boot_params = sys_ddr_kernel_start + 0x100;
-
+ if(1 == rootfs_flag)
+ uiLoadPoint += (uiRootfsHdrSizeOld + uiRootfsHdrSizeNew);
sprintf((char *)cmd," bootm 0x%0x", uiLoadPoint);
setenv("bootcmd", (char *)cmd);
}
diff --git a/boot/common/src/uboot/drivers/mtd/nand/nand.c b/boot/common/src/uboot/drivers/mtd/nand/nand.c
index ec3f79a..7abfca0 100755
--- a/boot/common/src/uboot/drivers/mtd/nand/nand.c
+++ b/boot/common/src/uboot/drivers/mtd/nand/nand.c
@@ -26,13 +26,14 @@
#include <linux/mtd/mtd.h>
#include <linux/mtd/partitions.h>
#include <part.h>
-
+#include <secure_verify.h>
#include <boot_mode.h>
-
+#include <asm/arch/efuse.h>
#ifndef CONFIG_SYS_NAND_BASE_LIST
#define CONFIG_SYS_NAND_BASE_LIST { CONFIG_SYS_NAND_BASE }
#endif
+#define reg32(addr) (*(volatile unsigned long *)(addr))
DECLARE_GLOBAL_DATA_PTR;
@@ -47,7 +48,7 @@
static const char default_nand_name[] = "nand";
struct flash_ops flash;
-
+unsigned char g_nor_flag = 0;
/*******************************************************************************
* Function:
* Description:
@@ -161,6 +162,15 @@
{
int i;
unsigned int size = 0;
+
+ /*¶ÁȡоƬid*/
+ if((reg32(0x0121b040)>>8) == ZX297520V3ECOGG_GW_NYC_NOR_2G_DDR
+ ||(reg32(0x0121b040)>>8) == ZX297520V3ECOSC_GW_NYC_NOR_2G_DDR)
+ {
+ g_nor_flag = 1;
+ printf("g_nor_flag is %d.\n",g_nor_flag);
+ }
+
for (i = 0; i < CONFIG_SYS_MAX_NAND_DEVICE; i++)
{
nand_init_chip(&nand_info[i], &nand_chip[i], base_address[i]);
diff --git a/boot/common/src/uboot/drivers/mtd/nand/nand_ids.c b/boot/common/src/uboot/drivers/mtd/nand/nand_ids.c
index ae834a8..6d54c1e 100755
--- a/boot/common/src/uboot/drivers/mtd/nand/nand_ids.c
+++ b/boot/common/src/uboot/drivers/mtd/nand/nand_ids.c
@@ -92,6 +92,8 @@
{0xC8,0x45,0x00,0,2048,128,0,0,0x20000,64,4096,1,1,0,{2,1,1,9,0,0,0,0,0,0},{0,0}},
/*XTX XT26Q04D-B 512M SPI-NAND*/
{0x0B,0x53,0x00,0,4096,256,0,0,0x40000,64,2048,1,1,0,{2,1,1,9,0,0,0,0,0,0},{0,0}},
+ /*UNIM UM19A0LISW 128M SPI-NAND*/
+ {0xB0,0x15,0x00,0,2048,64,0,0,0x20000,64,1024,1,1,0,{2,1,1,9,0,0,0,0,0,0},{0,0}},
{0,}
};
/*
@@ -133,6 +135,7 @@
{"SPI-NAND 512MiB 1,8V", 0x35, 4096, 512, 0x40000, 0}, //F50D44G41XB (2X)
{"SPI-NAND 512MiB 1,8V", 0x45, 2048, 512, 0x20000, 0}, //GD5F4GQ6REY2G
{"SPI-NAND 512MiB 1,8V", 0x53, 4096, 512, 0x40000, 0}, //XT26Q04D-B
+ {"SPI-NAND 128MiB 1,8V", 0x15, 2048, 128, 0x20000, 0}, //UM19A0LISW
{NULL,}
};
@@ -160,6 +163,7 @@
{NAND_MFR_EMST, "emst"},
{NAND_MFR_FORESEE, "foresee"},
{NAND_MFR_XTX, "xtx"},
+ {NAND_MFR_UNIM, "unim"},
{0x0, "Unknown"}
};
diff --git a/boot/common/src/uboot/drivers/mtd/nand/spi_nand_devices.c b/boot/common/src/uboot/drivers/mtd/nand/spi_nand_devices.c
index 09556f6..4062428 100755
--- a/boot/common/src/uboot/drivers/mtd/nand/spi_nand_devices.c
+++ b/boot/common/src/uboot/drivers/mtd/nand/spi_nand_devices.c
@@ -116,6 +116,10 @@
.oobfree = {{2,62}}
};
+ static struct nand_ecclayout nand_unim_oob_64= {
+ .oobfree = {{2,62}}
+ };
+
static void spi_nand_winbond_init(struct spi_nand_info *spi_nand)
{
uint8_t dev_id = spi_nand->para->device_id;
@@ -203,6 +207,7 @@
||((g_maf_id == NAND_MFR_EMST) && (g_dev_id == NAND_DEVID_EMST_F50D1G41LB_1G))
|| (g_maf_id == NAND_MFR_FORESEE)
|| (g_maf_id == NAND_MFR_XTX)
+ || (g_maf_id == NAND_MFR_UNIM)
|| (g_maf_id == NAND_MFR_MICRON))
return RDX4_MODE;
else
@@ -334,6 +339,12 @@
chip->ecc.layout =&nand_xtx_oob_256;
}
break;
+ case NAND_MFR_UNIM:
+ if(mtd->oobsize==64 && mtd->writesize==2048)
+ {
+ chip->ecc.layout =&nand_unim_oob_64;
+ }
+ break;
default:
break;
}
diff --git a/boot/common/src/uboot/drivers/mtd/nand/zxic_spifc.c b/boot/common/src/uboot/drivers/mtd/nand/zxic_spifc.c
index 683b2a3..844b288 100755
--- a/boot/common/src/uboot/drivers/mtd/nand/zxic_spifc.c
+++ b/boot/common/src/uboot/drivers/mtd/nand/zxic_spifc.c
@@ -39,6 +39,7 @@
extern struct nand_flash_device_para *g_nand_dev_info;
extern unsigned char g_maf_id;
extern unsigned char g_dev_id;
+extern g_nor_flag;
struct spi_nand_info spifc_nand;
struct spi_nand_info *g_spifc = &spifc_nand;
@@ -595,6 +596,10 @@
};
do
{
+ if(g_nor_flag == 1)
+ {
+ zDrvGpio_SetOutputValue(GPIO86,GPIO_LOW);
+ }
spi_fc_clear_fifo();
spi_fc_clear_int();
spi_fc_config_ctrl(FC_DMA_NONE);
@@ -611,7 +616,12 @@
{
continue; /* ´«Êäʧ°Ü£¬½áÊø±¾´ÎÑ»·²¢ÖØ´« */
}
-
+
+ if(g_nor_flag == 1)
+ {
+ zDrvGpio_SetOutputValue(GPIO86,GPIO_HIGH);
+ }
+
break;
} while( --retries != 0 );
@@ -651,6 +661,10 @@
};
do
{
+ if(g_nor_flag == 1)
+ {
+ zDrvGpio_SetOutputValue(GPIO86,GPIO_LOW);
+ }
spi_fc_clear_fifo();
spi_fc_clear_int();
spi_fc_config_ctrl(FC_DMA_NONE);
@@ -662,6 +676,12 @@
{
continue; /* ´«Êäʧ°Ü£¬½áÊø±¾´ÎÑ»·²¢ÖØ´« */
}
+
+ if(g_nor_flag == 1)
+ {
+ zDrvGpio_SetOutputValue(GPIO86,GPIO_HIGH);
+ }
+
break;
} while( --retries != 0 );
@@ -697,11 +717,22 @@
};
do
{
+ if(g_nor_flag == 1)
+ {
+ zDrvGpio_SetOutputValue(GPIO86,GPIO_LOW);
+ }
spi_fc_setup_cmd(&cmd, 0, 0); /* ÃüÁîÅäÖà */
spi_fc_start(); /* ¿ªÊ¼´«Êä */
ret = spi_fc_wait_cmd_end(); /* µÈ´ýÃüÁî½áÊø */
if( ret != SUCCESS )
continue; /* ´«Êäʧ°Ü£¬½áÊø±¾´ÎÑ»·²¢ÖØ´« */
+
+ if(g_nor_flag == 1)
+ {
+ zDrvGpio_SetOutputValue(GPIO86,GPIO_HIGH);
+ udelay(5);
+ }
+
/* µÈ´ýRESETÖ´ÐÐÍê³É */ //sunzhaoxing must wait
do
{
@@ -735,6 +766,10 @@
do
{
+ if(g_nor_flag == 1)
+ {
+ zDrvGpio_SetOutputValue(GPIO86,GPIO_LOW);
+ }
spi_fc_clear_fifo();
spi_fc_clear_int();
spi_fc_config_ctrl(FC_DMA_NONE);
@@ -746,6 +781,12 @@
{
continue; /* ¡ä?¨º?¨º¡ì¡ã¨¹¡ê??¨¢¨º?¡À?¡ä??-?¡¤2¡é??¡ä? */
}
+
+ if(g_nor_flag == 1)
+ {
+ zDrvGpio_SetOutputValue(GPIO86,GPIO_HIGH);
+ }
+
break;
} while( --retries != 0 );
@@ -781,6 +822,11 @@
};
while(1)
{
+ if(g_nor_flag == 1)
+ {
+ zDrvGpio_SetOutputValue(GPIO86,GPIO_LOW);
+ }
+
do
{
spi_fc_clear_fifo();
@@ -797,7 +843,13 @@
break;
}
while ( --retries != 0 );
-
+
+ if(g_nor_flag == 1)
+ {
+ zDrvGpio_SetOutputValue(GPIO86,GPIO_HIGH);
+ udelay(5);
+ }
+
/* µÈ´ýÉÏ´ÎÃüÁîÖ´ÐÐÍê³É */
do
{
@@ -844,6 +896,10 @@
};
do
{
+ if(g_nor_flag == 1)
+ {
+ zDrvGpio_SetOutputValue(GPIO86,GPIO_LOW);
+ }
spi_fc_clear_fifo();
spi_fc_clear_int();
spi_fc_config_ctrl(FC_DMA_NONE);
@@ -854,6 +910,11 @@
{
continue; /* ´«Êäʧ°Ü£¬½áÊø±¾´ÎÑ»·²¢ÖØ´« */
}
+
+ if(g_nor_flag == 1)
+ {
+ zDrvGpio_SetOutputValue(GPIO86,GPIO_HIGH);
+ }
break;
} while( --retries != 0 );
@@ -940,6 +1001,10 @@
do
{
+ if(g_nor_flag == 1)
+ {
+ zDrvGpio_SetOutputValue(GPIO86,GPIO_LOW);
+ }
spi_fc_clear_fifo();
spi_fc_clear_int();
spi_fc_config_ctrl(FC_DMA_NONE);
@@ -958,6 +1023,11 @@
//spi_fc_disable();
continue; /* ´«Êäʧ°Ü£¬½áÊø±¾´ÎÑ»·²¢ÖØ´« */
}
+
+ if(g_nor_flag == 1)
+ {
+ zDrvGpio_SetOutputValue(GPIO86,GPIO_HIGH);
+ }
break;
} while( --retries != 0 );
@@ -1001,6 +1071,11 @@
};
do
{
+ if(g_nor_flag == 1)
+ {
+ zDrvGpio_SetOutputValue(GPIO86,GPIO_LOW);
+ }
+
spi_fc_clear_fifo();
spi_fc_clear_int();
spi_fc_config_ctrl(FC_DMA_NONE);
@@ -1012,6 +1087,12 @@
continue; /* ´«Êäʧ°Ü£¬½áÊø±¾´ÎÑ»·²¢ÖØ´« */
}
+ if(g_nor_flag == 1)
+ {
+ zDrvGpio_SetOutputValue(GPIO86,GPIO_HIGH);
+ udelay(5);
+ }
+
/* µÈ´ýÃüÁîÖ´ÐÐÍê³É */
do
{
@@ -1065,6 +1146,10 @@
};
do
{
+ if(g_nor_flag == 1)
+ {
+ zDrvGpio_SetOutputValue(GPIO86,GPIO_LOW);
+ }
spi_fc_clear_fifo();
spi_fc_clear_int();
spi_fc_config_ctrl(FC_DMA_NONE);
@@ -1075,7 +1160,12 @@
{
continue; /* ´«Êäʧ°Ü£¬½áÊø±¾´ÎÑ»·²¢ÖØ´« */
}
-
+
+ if(g_nor_flag == 1)
+ {
+ zDrvGpio_SetOutputValue(GPIO86,GPIO_HIGH);
+ udelay(5);
+ }
/* µÈ´ýÃüÁîÖ´ÐÐÍê³É */
do
{
@@ -1213,6 +1303,10 @@
do
{
+ if(g_nor_flag == 1)
+ {
+ zDrvGpio_SetOutputValue(GPIO86,GPIO_LOW);
+ }
spi_fc_clear_fifo();
spi_fc_clear_int();
spi_fc_setup_cmd(&cmd, column_addr, len); /* ÃüÁîÅäÖà */
@@ -1243,6 +1337,13 @@
spifc_wait_dma_done(FC_DMA_RX);
spi_fc_config_ctrl(FC_DMA_NONE);
#endif
+
+ if(g_nor_flag == 1)
+ {
+ zDrvGpio_SetOutputValue(GPIO86,GPIO_HIGH);
+ }
+
+
break;
} while( --retries != 0 );
@@ -1295,6 +1396,10 @@
do
{
+ if(g_nor_flag == 1)
+ {
+ zDrvGpio_SetOutputValue(GPIO86,GPIO_LOW);
+ }
spi_fc_clear_fifo();
spi_fc_clear_int();
spi_fc_setup_cmd(&cmd, column_addr, page_len+oob_len); /* ÃüÁîÅäÖà */
@@ -1321,7 +1426,13 @@
spifc_wait_dma_done(FC_DMA_TX);
spi_fc_config_ctrl(FC_DMA_NONE);
#endif
-
+
+ if(g_nor_flag == 1)
+ {
+ zDrvGpio_SetOutputValue(GPIO86,GPIO_HIGH);
+ }
+
+
break;
} while( --retries != 0 );
@@ -1362,6 +1473,10 @@
};
do
{
+ if(g_nor_flag == 1)
+ {
+ zDrvGpio_SetOutputValue(GPIO86,GPIO_LOW);
+ }
spi_fc_clear_fifo();
spi_fc_clear_int();
spi_fc_config_ctrl(FC_DMA_NONE);
@@ -1373,6 +1488,12 @@
continue; /* ´«Êäʧ°Ü£¬½áÊø±¾´ÎÑ»·²¢ÖØ´« */
}
+ if(g_nor_flag == 1)
+ {
+ zDrvGpio_SetOutputValue(GPIO86,GPIO_HIGH);
+ udelay(5);
+ }
+
/* µÈ´ýÃüÁîÖ´ÐÐÍê³É */
do
{
@@ -1416,6 +1537,13 @@
zDrvGpio_SetFunc(GPIO96, GPIO96_SPIFC_DATA1);
zDrvGpio_SetFunc(GPIO95, GPIO95_SPIFC_DATA0);
zDrvGpio_SetFunc(GPIO93,GPIO93_SPIFC_CS);
+ if(g_nor_flag == 1)
+ {
+ zDrvGpio_SetFunc(GPIO93,GPIO93_GPIO93);
+ zDrvGpio_SetOutputValue(GPIO93, GPIO_HIGH);
+ zDrvGpio_SetFunc(GPIO86,GPIO86_GPIO86);
+ zDrvGpio_SetDirection(GPIO86, GPIO_OUT);
+ }
zDrvGpio_SetFunc(GPIO94,GPIO94_SPIFC_CLK);
spi_fc_enable();
diff --git a/boot/common/src/uboot/drivers/mtd/partition/partition.c b/boot/common/src/uboot/drivers/mtd/partition/partition.c
index 0da27ea..7b200e6 100755
--- a/boot/common/src/uboot/drivers/mtd/partition/partition.c
+++ b/boot/common/src/uboot/drivers/mtd/partition/partition.c
@@ -32,8 +32,12 @@
#include <load_image.h>
#include <boot_mode.h>
#include <config.h>
-
-
+#include <boot_mode.h>
+#include <../drivers/hash/drv_hash.h>
+#include <../drivers/rsa/drv_rsa.h>
+#include <../drivers/hash/sha256.h>
+#include <secure_verify.h>
+#include <asm/arch/efuse.h>
#define DEFINE_PARTITION_TABLE
#include <partition_table.h>
@@ -51,11 +55,32 @@
partition_table_t * g_partition_table = NULL; /* Ö¸Ïò·ÖÇø±íÐÅÏ¢ */
extern partition_table_t * g_partition_table_dl;
extern struct fsl_qspi spi_nor_flash;
+extern unsigned int guiOtpStatus;
+extern unsigned int guiEfuseStatus;
+
//#ifdef CONFIG_ZX297520V3E_MDL_AB
#if defined(CONFIG_ZX297520V3E_MDL_AB) || defined(CONFIG_ZX297520V3E_VEHICLE_DC) || defined(CONFIG_ZX297520V3E_VEHICLE_DC_REF)
extern int imagefs_flag;
#endif
+unsigned char key_hash[128] = {0};
+unsigned char *bin2hex(const unsigned char *old, const size_t oldlen)
+{
+ size_t i, j;
+ int b = 0;
+
+ for (i = j = 0; i < oldlen; i++)
+ {
+ b = old[i] >> 4;
+ key_hash[j++] = (char)(87 + b + (((b - 10) >> 31) & -39));
+ b = old[i] & 0xf;
+ key_hash[j++] = (char)(87 + b + (((b - 10) >> 31) & -39));
+ }
+ key_hash[j] = '\0';
+ return key_hash;
+}
+
+
/* ================================================================================
* add_partition_to_bootargs : Ôö¼Ó·ÖÇøÐÅÏ¢µ½ bootargs
*/
@@ -71,15 +96,51 @@
uchar bootargs_cmd_cap[1024] = {0};
uchar boot_reason_para[32] = {0};
uchar boot_mode_para[16] = {0};
+ uint32_t otp_pubkey_hash[8] = {0};
+ uint32_t efuse_pubkey_hash[4] = {0};
+ uint32_t uiHashResLen = 0;
unsigned int *poweron_type = (unsigned int *)POWERON_TYPE_ADDR; //ÁÙʱʹÓÃ
part_nums = g_partition_table->entrys;
partition_entry_t * entry = &g_partition_table->table[0];
+ if(g_nor_flag == 1)
+ {
+ sha256_csum_wd((const unsigned char *)OTP_SECURE_PUK_BASE, 380, (unsigned char *)otp_pubkey_hash);
+ bin2hex((unsigned char *)otp_pubkey_hash, 32);
+ }
+ else
+ {
+ Hash_Calculate(HASH_MODE_MD5, HASH_SMALL_ENDIAN, CFG_SECURE_PUK_ADDR, 256, NULL, 0, efuse_pubkey_hash, &uiHashResLen);
+ bin2hex((unsigned char *)efuse_pubkey_hash, 16);
+ }
+
/* console=ttyS1,115200 no_console_suspend */
- sprintf((char *)bootargs_cmd, "console=ttyS1,921600 no_console_suspend");
- sprintf((char *)bootargs_cmd_cap, "console=ttyS1,921600n8 earlycon no_console_suspend");
+ sprintf((char *)bootargs_cmd, "console=ttyS1,921600 no_console_suspend ");
+ sprintf((char *)bootargs_cmd_cap, "console=ttyS1,921600n8 earlycon no_console_suspend ");
+
+ if(g_nor_flag == 1)
+ {
+ sprintf((char *)bootargs_cmd + strlen(bootargs_cmd), "EnhancedSecurity=1 ");
+ sprintf((char *)bootargs_cmd_cap + strlen(bootargs_cmd_cap), "EnhancedSecurity=1 ");
+ if(guiOtpStatus == 0)
+ {
+ sprintf((char *)bootargs_cmd_cap + strlen(bootargs_cmd_cap), "pubkeyhash=");
+ sprintf((char *)bootargs_cmd_cap + strlen(bootargs_cmd_cap), key_hash);
+
+ }
+ }
+ else
+ {
+ sprintf((char *)bootargs_cmd + strlen(bootargs_cmd), "EnhancedSecurity=0 ");
+ sprintf((char *)bootargs_cmd_cap + strlen(bootargs_cmd_cap), "EnhancedSecurity=0 ");
+ if(guiEfuseStatus == 0)
+ {
+ sprintf((char *)bootargs_cmd_cap + strlen(bootargs_cmd_cap), "pubkeyhash=");
+ sprintf((char *)bootargs_cmd_cap + strlen(bootargs_cmd_cap), key_hash);
+ }
+ }
/* denali-nand: */
if(read_boot_flashtype() == IF_TYPE_NAND)
{
@@ -234,6 +295,8 @@
/* console=ttyS1,115200 no_console_suspend */
sprintf((char *)bootargs_cmd, "console=ttyS1,921600 no_console_suspend");
+ sprintf((char *)bootargs_cmd + strlen(bootargs_cmd), " EnhancedSecurity=0");
+
/* denali-nand: */
if(read_boot_flashtype() == IF_TYPE_NAND)
{
@@ -385,23 +448,46 @@
+------------------------------------------------------------+
8k one page 10k
*/
-
- if(type == IF_TYPE_NAND || type == IF_TYPE_SPI_NAND)
+ if(g_nor_flag == 1)
{
- ret = flash->read_with_ecc(nand, (loff_t)8*1024, &table_size, g_table);
- if(ret)
+ if(type == IF_TYPE_NAND || type == IF_TYPE_SPI_NAND)
{
- BOOT_PRINTF(UBOOT_ERR, "read_no_ecc Failed! ret = %d.\n", ret);
- return -1;
+ ret = flash->read_with_ecc(nand, (loff_t)0x8000, &table_size, g_table);
+ if(ret)
+ {
+ BOOT_PRINTF(UBOOT_ERR, "read_no_ecc Failed! ret = %d.\n", ret);
+ return -1;
+ }
+ }
+ else if(type == IF_TYPE_NOR)
+ {
+ ret = nand_read(&(nor->nor[0].mtd), (loff_t)0x8000, &table_size, g_table);
+ if(ret)
+ {
+ BOOT_PRINTF(UBOOT_ERR, "nand_read error! ret = %d.\n", ret);
+ return -1;
+ }
}
}
- else if(type == IF_TYPE_NOR)
+ else
{
- ret = nand_read(&(nor->nor[0].mtd), (loff_t)8*1024, &table_size, g_table);
- if(ret)
+ if(type == IF_TYPE_NAND || type == IF_TYPE_SPI_NAND)
{
- BOOT_PRINTF(UBOOT_ERR, "nand_read error! ret = %d.\n", ret);
- return -1;
+ ret = flash->read_with_ecc(nand, (loff_t)8*1024, &table_size, g_table);
+ if(ret)
+ {
+ BOOT_PRINTF(UBOOT_ERR, "read_no_ecc Failed! ret = %d.\n", ret);
+ return -1;
+ }
+ }
+ else if(type == IF_TYPE_NOR)
+ {
+ ret = nand_read(&(nor->nor[0].mtd), (loff_t)8*1024, &table_size, g_table);
+ if(ret)
+ {
+ BOOT_PRINTF(UBOOT_ERR, "nand_read error! ret = %d.\n", ret);
+ return -1;
+ }
}
}
diff --git a/boot/common/src/uboot/drivers/mtd/spi-nor/nor_spifc.c b/boot/common/src/uboot/drivers/mtd/spi-nor/nor_spifc.c
old mode 100644
new mode 100755
index 11b84d8..5775e14
--- a/boot/common/src/uboot/drivers/mtd/spi-nor/nor_spifc.c
+++ b/boot/common/src/uboot/drivers/mtd/spi-nor/nor_spifc.c
@@ -25,7 +25,7 @@
#include <linux/mtd/nor_spifc.h>
#include <../drivers/dma/zx29_dma.h>
#include <nand.h>
-
+#include <secure_verify.h>
spinor_cmd_t nor_cmd_table[]=
@@ -51,7 +51,10 @@
{CMD_REMS, TX_DMA_DIS, RX_DMA_DIS, ADDR_TX_DIS, ADDR_WIDTH_24, DATA_TX_DIS, DATA_RX_EN, DUMY_TX_DIS, 0, 0, ADDR_MULTI_LINE_DIS, DATA_MULTI_LINE_DIS, TRANS_MOD_SINGLE, "read manufacture device id"},
{CMD_RDID, TX_DMA_DIS, RX_DMA_DIS, ADDR_TX_DIS, ADDR_WIDTH_24, DATA_TX_DIS, DATA_RX_EN, DUMY_TX_DIS, 0, 0, ADDR_MULTI_LINE_DIS, DATA_MULTI_LINE_DIS, TRANS_MOD_SINGLE, "read identification"},
{CMD_ENRESET, TX_DMA_DIS, RX_DMA_DIS, ADDR_TX_DIS, ADDR_WIDTH_24, DATA_TX_DIS, DATA_RX_DIS, DUMY_TX_DIS, 0, 0, ADDR_MULTI_LINE_DIS, DATA_MULTI_LINE_DIS, TRANS_MOD_SINGLE, "reset enable"},
- {CMD_RESET, TX_DMA_DIS, RX_DMA_DIS, ADDR_TX_DIS, ADDR_WIDTH_24, DATA_TX_DIS, DATA_RX_DIS, DUMY_TX_DIS, 0, 0, ADDR_MULTI_LINE_DIS, DATA_MULTI_LINE_DIS, TRANS_MOD_SINGLE, "reset"},
+ {CMD_RESET, TX_DMA_DIS, RX_DMA_DIS, ADDR_TX_DIS, ADDR_WIDTH_24, DATA_TX_DIS, DATA_RX_DIS, DUMY_TX_DIS, 0, 0, ADDR_MULTI_LINE_DIS, DATA_MULTI_LINE_DIS, TRANS_MOD_SINGLE, "reset"},
+ {CMD_ESR, TX_DMA_DIS, RX_DMA_DIS, ADDR_TX_EN, ADDR_WIDTH_24, DATA_TX_DIS, DATA_RX_DIS, DUMY_TX_DIS, 0, 0, ADDR_MULTI_LINE_DIS, DATA_MULTI_LINE_DIS, TRANS_MOD_SINGLE, "erase security registers"},
+ {CMD_PSR, TX_DMA_DIS, RX_DMA_DIS, ADDR_TX_EN, ADDR_WIDTH_24, DATA_TX_EN, DATA_RX_DIS, DUMY_TX_DIS, 0, 0, ADDR_MULTI_LINE_DIS, DATA_MULTI_LINE_DIS, TRANS_MOD_SINGLE, "program security registers"},
+ {CMD_RSR, TX_DMA_DIS, RX_DMA_DIS, ADDR_TX_EN, ADDR_WIDTH_24, DATA_TX_DIS, DATA_RX_EN, DUMY_TX_EN, 1, 0, ADDR_MULTI_LINE_DIS, DATA_MULTI_LINE_DIS, TRANS_MOD_SINGLE, "read security registers"},
{0}
};
@@ -639,13 +642,209 @@
return 0;
}
+ int nor_write_security_register(struct spi_nor *nor, loff_t to,
+ size_t len, size_t *retlen, const u_char *buf)
+ {
+ int ret;
+ int nor_status = 0;
+ struct fsl_qspi *q = nor->priv;
+ spinor_cmd_t *cmd = NULL;
+
+ cmd = cmd_seek(CMD_PSR);
+ if(cmd == NULL)
+ {
+ printf("cmd_seek unkown cmd = 0x%x error.\n", nor->program_opcode);
+ return -1;
+ }
+
+#if TRANS_USE_DMA
+ cmd->tx_dma_en = TX_DMA_EN;
+#else
+ cmd->tx_dma_en = TX_DMA_DIS;
+#endif
+ spifc_setup_cmd(q, cmd, to, len);
+
+
+#if TRANS_USE_DMA
+ spifc_config_dma(buf, len, FC_DMA_TX);
+ spifc_start(q);
+#else
+ spifc_start(q);
+ ret = spifc_write_data(q, buf, len);
+ if(ret < 0)
+ {
+ printf("spifc_write_fifo error.\n");
+ return ret;
+ }
+#endif
+
+ ret = spifc_wait_cmd_end(q);
+ if(ret != 0)
+ {
+ printf("spifc_wait_cmd_end error.\n");
+ return ret;
+ }
+
+#if TRANS_USE_DMA
+ spifc_wait_dma_done(FC_DMA_TX);
+#endif
+
+ do{
+ ret = fsl_qspi_read_reg(nor, CMD_RDSR0, &nor_status, 1);
+ if(ret != 0)
+ {
+ printf("read WIP fail.\n");
+ }
+ }while(nor_status & 0x1);
+
+ return 0;
+ }
+
+ int fsl_qspi_write_security_register(struct spi_nor *nor, loff_t to,
+ size_t len, size_t *retlen, const u_char *buf)
+ {
+ int ret = 0;
+ struct fsl_qspi *q = NULL;
+
+ if((nor == NULL) || (nor->priv == NULL) || (retlen == NULL) || (buf == NULL))
+ {
+ printk("fsl_qspi_write_security_register is error.\n");
+ return -1;
+ }
+ q = nor->priv;
+ memcpy((void*)q->buf.buf, buf, len);
+
+ ret = nor_write_security_register(nor, to, len, retlen, q->buf.dma_buf);
+ if(ret != 0)
+ {
+ printk("nor_write_otp error.\n");
+ return -1;
+ }
+ *retlen += len;
+
+ return 0;
+
+ }
+
+int nor_read_security_register(struct spi_nor *nor, loff_t from,
+ size_t len, size_t *retlen, u_char *buf)
+{
+ int ret;
+ struct fsl_qspi *q = nor->priv;
+ spinor_cmd_t *cmd = NULL;
+
+ cmd = cmd_seek(CMD_RSR);
+ if(cmd == NULL)
+ {
+ printf("cmd_seek unkown cmd = 0x%x error.\n", nor->read_opcode);
+ return -1;
+ }
+
+#if TRANS_USE_DMA
+ cmd->rx_dma_en = RX_DMA_EN;
+#else
+ cmd->rx_dma_en = RX_DMA_DIS;
+#endif
+ spifc_setup_cmd(q, cmd, from, len);
+
+#if TRANS_USE_DMA
+ spifc_config_dma(buf, len, FC_DMA_RX);
+ spifc_start(q);
+#else
+ spifc_start(q);
+ ret = spifc_read_fifo(q, buf, len);
+ if(ret < 0)
+ {
+ printf("spifc_read_fifo error.\n");
+ return ret;
+ }
+#endif
+
+ ret = spifc_wait_cmd_end(q);
+ if(ret != 0)
+ {
+ printf("spifc_wait_cmd_end error.\n");
+ return ret;
+ }
+
+#if TRANS_USE_DMA
+ spifc_wait_dma_done(FC_DMA_RX);
+#endif
+
+ return 0;
+}
+
+int fsl_qspi_read_security_register(struct spi_nor *nor, loff_t from,
+ size_t len, size_t *retlen, u_char *buf)
+{
+ int ret = 0;
+ struct fsl_qspi *q = NULL;
+ loff_t from_alligned = 0;
+
+ if((nor == NULL) || (nor->priv == NULL) || (retlen == NULL) || (buf == NULL))
+ {
+ printk("fsl_qspi_read security register is error.\n");
+ return -1;
+ }
+ from_alligned = from&(~(nor->page_size - 1));
+ q = nor->priv;
+
+ ret = nor_read_security_register(nor, from_alligned, nor->page_size, retlen, q->buf.dma_buf);
+ if(ret != 0)
+ {
+ printk("nor_read_security_register error.\n");
+ return -1;
+ }
+
+ memcpy(buf, (void*)q->buf.buf + (from&(nor->page_size - 1)), len);
+ *retlen += len;
+
+ return 0;
+}
+
+ int fsl_qspi_erase_security_register(struct spi_nor *nor, loff_t offs)
+{
+ int ret;
+ int nor_status = 0;
+ struct fsl_qspi *q = nor->priv;
+ spinor_cmd_t *cmd = NULL;
+
+ cmd = cmd_seek(CMD_ESR);
+ if(cmd == NULL)
+ {
+ printf("cmd_seek unkown cmd = 0x%x error.\n", nor->read_opcode);
+ return -1;
+ }
+ spifc_setup_cmd(q, cmd, offs, 0);
+
+ spifc_start(q);
+ ret = spifc_wait_cmd_end(q);
+ if(ret != 0)
+ {
+ printf("spifc_wait_cmd_end error.\n");
+ return ret;
+ }
+
+ do{
+ ret = fsl_qspi_read_reg(nor, CMD_RDSR0, &nor_status, 1);
+ if(ret != 0)
+ {
+ printf("read WIP fail.\n");
+ }
+ }while(nor_status & 0x1);
+
+ return 0;
+}
+
int fsl_qspi_probe(void)
{
struct fsl_qspi *q;
struct spi_nor *nor;
struct mtd_info *mtd;
int ret, i = 0;
-
+ int32_t offset = 0x1000;
+ uint32_t len = sizeof(otpInfo);
+
q = &spi_nor_flash;
spifc_hwinit();
@@ -674,6 +873,9 @@
nor->read = fsl_qspi_read;
nor->write = fsl_qspi_write;
nor->erase = fsl_qspi_erase;
+ nor->read_security_register = fsl_qspi_read_security_register;
+ nor->write_security_register = fsl_qspi_write_security_register;
+ nor->erase_security_register = fsl_qspi_erase_security_register;
nor->prepare = NULL;
nor->unprepare = NULL;
@@ -687,6 +889,14 @@
return ret;
}
+ /*¶ÁÈ¡OTPÇøÓòÊý¾Ý*/
+ ret = fsl_qspi_read_security_register(nor, offset, len, (size_t *)len, &otpInfo);
+ if(ret !=0){
+ printf("read otp error.\n");
+ }else{
+ printf("otp secure_flag is 0x%x,puk hash is 0x%x.\n",otpInfo.secure_flag,otpInfo.puk_hash[0]);
+ }
+
return 0;
}
diff --git a/boot/common/src/uboot/drivers/mtd/spi-nor/spi-nor.c b/boot/common/src/uboot/drivers/mtd/spi-nor/spi-nor.c
index 131625a..23f612c 100755
--- a/boot/common/src/uboot/drivers/mtd/spi-nor/spi-nor.c
+++ b/boot/common/src/uboot/drivers/mtd/spi-nor/spi-nor.c
@@ -624,6 +624,8 @@
static const struct flash_info spi_nor_ids[] = {
/* GigaDevice */
{"gd25q128", INFO(0xc86018, 0, 32 * 1024, 512, SPI_NOR_QUAD_READ)},
+ {"gd25ld10c", INFO(0xc86011, 0, 32 * 1024, 4, SPI_NOR_DUAL_READ)},
+ {"gd25ld20e", INFO(0xc86012, 0, 32 * 1024, 8, SPI_NOR_DUAL_READ)},
/* Winbond -- w25x "blocks" are 64K, "sectors" are 4KiB */
{"w25q128fw", INFO(0xef6018, 0, 32 * 1024, 512, SPI_NOR_QUAD_READ)},
/* dosilicon */
@@ -648,6 +650,8 @@
static const struct flash_info spi_nor_ids[] = {
/* GigaDevice */
{"gd25q128", INFO(0xc86018, 0, 64 * 1024, 256, SPI_NOR_QUAD_READ)},
+ {"gd25ld10c", INFO(0xc86011, 0, 64 * 1024, 2, SPI_NOR_DUAL_READ)},
+ {"gd25ld20e", INFO(0xc86012, 0, 64 * 1024, 4, SPI_NOR_DUAL_READ)},
/* Winbond -- w25x "blocks" are 64K, "sectors" are 4KiB */
{"w25q128fw", INFO(0xef6018, 0, 64 * 1024, 256, SPI_NOR_QUAD_READ)},
/* dosilicon */
diff --git a/boot/common/src/uboot/include/boot_mode.h b/boot/common/src/uboot/include/boot_mode.h
old mode 100644
new mode 100755
index d1fdc26..6d8ea1a
--- a/boot/common/src/uboot/include/boot_mode.h
+++ b/boot/common/src/uboot/include/boot_mode.h
@@ -7,6 +7,8 @@
#ifndef __BOOT_MODE__
#define __BOOT_MODE__
+extern unsigned char g_nor_flag;
+
typedef enum
{
TLOAD_MODE = 1,
diff --git a/boot/common/src/uboot/include/configs/zx297520v3.h b/boot/common/src/uboot/include/configs/zx297520v3.h
index e218408..ea771fa 100755
--- a/boot/common/src/uboot/include/configs/zx297520v3.h
+++ b/boot/common/src/uboot/include/configs/zx297520v3.h
@@ -131,6 +131,7 @@
#define CONFIG_SYS_SDRAM_IMAGEFS_BASE 0x25000000
#define CONFIG_SYS_SDRAM_IMAGEFS_END 0x27000000
#define CONFIG_SYS_SDRAM_IMAGEFS_SIZE (CONFIG_SYS_SDRAM_IMAGEFS_END - CONFIG_SYS_SDRAM_IMAGEFS_BASE)
+
#else
#define PHYS_SDRAM_1_SIZE 0x02000000 /* 32MB */
#define CONFIG_SYS_SDRAM_SIZE 0x02000000 /* 32MB in DDR */
@@ -141,6 +142,7 @@
#define CONFIG_SYS_SDRAM_TEMP_BASE 0x21400000 /* ddrÊý¾Ý°æ±¾ÁÙʱ»º´æµØÖ· */
#define CONFIG_SYS_SDRAM_TEMP_LZMA 0X21600000 /* »º´æµØÖ·£¬ÓÃÓÚ½âѹ°æ±¾Ê±Ê¹Óà */
+#define CONFIG_SYS_SDRAM_ROOTFS_BASE 0x25000000
#define CONFIG_SYS_SDRAM_UPDATE_ALIGNED_OFFSET 0x5000000 /* 80MB for LocalUpdate Use. */
diff --git a/boot/common/src/uboot/include/linux/mtd/nand.h b/boot/common/src/uboot/include/linux/mtd/nand.h
index efdfb54..f1c4aa1 100755
--- a/boot/common/src/uboot/include/linux/mtd/nand.h
+++ b/boot/common/src/uboot/include/linux/mtd/nand.h
@@ -519,10 +519,11 @@
#define NAND_MFR_ZETTA 0xBA
#define NAND_MFR_DOSILICON 0xE5
#define NAND_MFR_FUDANWEI 0xA1
-#define NAND_MFR_HOSIN 0xD6
-#define NAND_MFR_EMST 0xC8
-#define NAND_MFR_FORESEE 0xCD
+#define NAND_MFR_HOSIN 0xD6
+#define NAND_MFR_EMST 0xC8
+#define NAND_MFR_FORESEE 0xCD
#define NAND_MFR_XTX 0x0B
+#define NAND_MFR_UNIM 0xB0
#define NAND_DEVID_GD5F1GQ5R_1G 0x41
diff --git a/boot/common/src/uboot/include/linux/mtd/spi-nor.h b/boot/common/src/uboot/include/linux/mtd/spi-nor.h
index b3cef24..310dbb1 100755
--- a/boot/common/src/uboot/include/linux/mtd/spi-nor.h
+++ b/boot/common/src/uboot/include/linux/mtd/spi-nor.h
@@ -191,8 +191,14 @@
void (*write)(struct spi_nor *nor, loff_t to,
size_t len, size_t *retlen, const u_char *write_buf);
int (*erase)(struct spi_nor *nor, loff_t offs);
-
- int (*flash_lock)(struct spi_nor *nor, loff_t ofs, uint64_t len);
+
+ int (*read_security_register)(struct spi_nor *nor, loff_t from,
+ size_t len, size_t *retlen, u_char *read_buf);
+ void (*write_security_register)(struct spi_nor *nor, loff_t to,
+ size_t len, size_t *retlen, const u_char *write_buf);
+ int (*erase_security_register)(struct spi_nor *nor, loff_t offs);
+
+ int (*flash_lock)(struct spi_nor *nor, loff_t ofs, uint64_t len);
int (*flash_unlock)(struct spi_nor *nor, loff_t ofs, uint64_t len);
int (*flash_is_locked)(struct spi_nor *nor, loff_t ofs, uint64_t len);
diff --git a/boot/common/src/uboot/include/secure_verify.h b/boot/common/src/uboot/include/secure_verify.h
old mode 100644
new mode 100755
index 34c2ce5..2132a03
--- a/boot/common/src/uboot/include/secure_verify.h
+++ b/boot/common/src/uboot/include/secure_verify.h
@@ -51,6 +51,13 @@
u32 dev_id[3];
} efuse_struct;
+typedef volatile struct
+{
+ u32 secure_flag;
+ u32 puk_hash[8];
+ u32 dev_id[3];
+} otp_struct;
+
typedef struct
{
u32 uiPubKeyRsaE[32];
@@ -58,9 +65,24 @@
u32 uiHashY[32];
} sImageHeader;
+typedef struct
+{
+ uint16_t signtype;
+ uint16_t hashtype;
+ uint32_t uiPubKeyRsaELen;
+ uint32_t uiPubKeyRsaNLen;
+ uint8_t uiPubKeyRsaE[4];
+ uint8_t uiPubKeyRsaN[256];
+ uint8_t reserve[112]; //380 bytes
+ uint8_t uiHashY[256]; //256 bytes
+} sImageNewHeader;
+
+extern otp_struct otpInfo;
+
static void get_efuse_data(void);
static u32 SMALL2BIG(u32 *puiArrIn, u32 *puiArrOut, u32 uiLen);
u8 secure_verify(u32 addr);
+u8 rootfs_secure_verify(u32 addr);
static u8 data_cmp_word(u32* src, u32* dst, u32 cnt);
int efuse_init(void);
void efuse_get_devinfo(efuse_struct *efuse_info);
diff --git a/boot/prj/zx297520v3/bootrom/dl_off/z-load b/boot/prj/zx297520v3/bootrom/dl_off/z-load
new file mode 100755
index 0000000..03ab4e0
--- /dev/null
+++ b/boot/prj/zx297520v3/bootrom/dl_off/z-load
Binary files differ
diff --git a/boot/prj/zx297520v3/bootrom/dl_off/z-load.map b/boot/prj/zx297520v3/bootrom/dl_off/z-load.map
new file mode 100755
index 0000000..620baa6
--- /dev/null
+++ b/boot/prj/zx297520v3/bootrom/dl_off/z-load.map
@@ -0,0 +1,439 @@
+Archive member included because of file (symbol)
+
+lib/libarm.a(board.o) cpu/m0/start.o (copy_to_iram1)
+lib/libarm.a(string.o) lib/libarm.a(board.o) (memcpy)
+drivers/libdrivers.a(ddr.o) lib/libarm.a(board.o) (ddr_init)
+drivers/libdrivers.a(uart.o) lib/libarm.a(board.o) (uart_init)
+drivers/libdrivers.a(image.o)
+ lib/libarm.a(board.o) (read_zloader_image)
+drivers/libdrivers.a(efuse.o)
+ lib/libarm.a(board.o) (efuse_init)
+drivers/libdrivers.a(secure_verify.o)
+ drivers/libdrivers.a(image.o) (secure_verify_zloader)
+drivers/libdrivers.a(nor.o) lib/libarm.a(board.o) (board_flash_init)
+drivers/libdrivers.a(drv_hash.o)
+ drivers/libdrivers.a(secure_verify.o) (Hash_Calculate)
+drivers/libdrivers.a(drv_rsa.o)
+ drivers/libdrivers.a(secure_verify.o) (Rsa_Calculate)
+drivers/libdrivers.a(flash.o)
+ drivers/libdrivers.a(nor.o) (get_boot_mode)
+cpu/m0/libm0.a(cpu.o) lib/libarm.a(board.o) (timer_init)
+cpu/m0/libm0.a(clk.o) lib/libarm.a(board.o) (clk_init)
+
+内存配置
+
+名称 来源 长度 属性
+*default* 0x0000000000000000 0xffffffffffffffff
+
+链结器命令稿和内存映射
+
+ 0x0000000000000000 . = 0x0
+ 0x0000000000000000 . = ALIGN (0x4)
+
+.text 0x0000000000100000 0x18d4
+ cpu/m0/start.o(.text)
+ .text 0x0000000000100000 0x248 cpu/m0/start.o
+ 0x00000000001001a4 _bss_start
+ 0x00000000001001ac _bss_end
+ 0x00000000001001b0 _para_start
+ 0x00000000001001b4 _para_end
+ 0x00000000001001b8 _start
+ 0x0000000000100216 run_at
+ *(.text)
+ .text 0x0000000000100248 0x144 lib/libarm.a(board.o)
+ 0x0000000000100248 print_info
+ 0x0000000000100258 copy_to_iram1
+ 0x0000000000100278 clear_iram
+ 0x0000000000100290 write_loader_mode
+ 0x000000000010029c hang
+ 0x000000000010029e usb_apcore_poweroff
+ 0x00000000001002f8 start_armboot
+ .text 0x000000000010038c 0x80 lib/libarm.a(string.o)
+ 0x000000000010038c strlen
+ 0x000000000010039c memset
+ 0x00000000001003de memcmp
+ 0x00000000001003fa memcpy
+ .text 0x000000000010040c 0x810 drivers/libdrivers.a(ddr.o)
+ 0x000000000010040c nsdelay
+ 0x0000000000100426 ddr_clk_init
+ 0x000000000010043c ddr_phy_init
+ 0x0000000000100538 ddr_ctrl_init
+ 0x00000000001008d8 ddr_prio_init
+ 0x00000000001009fc ddr_init
+ .text 0x0000000000100c1c 0x138 drivers/libdrivers.a(uart.o)
+ 0x0000000000100c1c uart_init
+ 0x0000000000100c9c uart_putc
+ 0x0000000000100cc4 uart_puts
+ 0x0000000000100cd8 uart_getc
+ 0x0000000000100cf4 uart_tstc
+ 0x0000000000100d04 UART_Read
+ 0x0000000000100d20 UART_Write
+ 0x0000000000100d3c UART_Check_Sync
+ .text 0x0000000000100d54 0x10c drivers/libdrivers.a(image.o)
+ 0x0000000000100d54 page_align
+ 0x0000000000100d6c find_partition_para
+ 0x0000000000100d9c read_image_part_offset
+ 0x0000000000100df0 read_flags_image
+ 0x0000000000100df4 read_uboot_image
+ 0x0000000000100df8 nand_read_m0
+ 0x0000000000100dfc read_zloader_image
+ .text 0x0000000000100e60 0x1a0 drivers/libdrivers.a(efuse.o)
+ 0x0000000000100e60 efuse_init
+ 0x0000000000100e84 get_ddr_flag
+ 0x0000000000100f88 get_secure_verify_status
+ 0x0000000000100fcc get_otp_secure_verify_status
+ .text 0x0000000000101000 0x198 drivers/libdrivers.a(secure_verify.o)
+ 0x0000000000101000 BIG2SMALL
+ 0x0000000000101030 bin2hex
+ 0x000000000010107c secure_verify_zloader
+ 0x0000000000101194 SecureVerify
+ .text 0x0000000000101198 0x424 drivers/libdrivers.a(nor.o)
+ 0x0000000000101198 spifc_enable
+ 0x00000000001011c8 spifc_disable
+ 0x00000000001011ec spifc_setup_cmd
+ 0x0000000000101270 spifc_wait_cmd_end
+ 0x000000000010129c spifc_read_fifo
+ 0x00000000001012d8 spifc_start
+ 0x00000000001012e8 cmd_seek
+ 0x0000000000101308 nor_read_reg
+ 0x0000000000101368 nor_read_id
+ 0x00000000001013d0 spi_nor_read
+ 0x000000000010142c nor_read
+ 0x0000000000101480 spi_nor_read_security_register
+ 0x00000000001014dc nor_read_security_register
+ 0x0000000000101530 nor_init
+ 0x0000000000101580 board_flash_init
+ .text 0x00000000001015bc 0xa4 drivers/libdrivers.a(drv_hash.o)
+ 0x00000000001015bc Hash_Calculate
+ .text 0x0000000000101660 0x174 drivers/libdrivers.a(drv_rsa.o)
+ 0x000000000010167a Rsa_Calculate
+ .text 0x00000000001017d4 0x28 drivers/libdrivers.a(flash.o)
+ 0x00000000001017d4 get_boot_mode
+ .text 0x00000000001017fc 0x54 cpu/m0/libm0.a(cpu.o)
+ 0x00000000001017fc timer_init
+ 0x0000000000101814 usdelay
+ .text 0x0000000000101850 0x84 cpu/m0/libm0.a(clk.o)
+ 0x0000000000101850 clk_init
+
+.glue_7 0x00000000001018d4 0x0
+ .glue_7 0x0000000000000000 0x0 linker stubs
+
+.glue_7t 0x00000000001018d4 0x0
+ .glue_7t 0x0000000000000000 0x0 linker stubs
+
+.vfp11_veneer 0x00000000001018d4 0x0
+ .vfp11_veneer 0x0000000000000000 0x0 linker stubs
+
+.v4_bx 0x00000000001018d4 0x0
+ .v4_bx 0x0000000000000000 0x0 linker stubs
+
+.iplt 0x00000000001018d4 0x0
+ .iplt 0x0000000000000000 0x0 cpu/m0/start.o
+ 0x00000000001018d4 . = ALIGN (0x4)
+
+.rodata 0x00000000001018d4 0x16c
+ *(.rodata)
+ .rodata 0x00000000001018d4 0x16c drivers/libdrivers.a(nor.o)
+
+.rodata.str1.1 0x0000000000101a40 0x1cd
+ .rodata.str1.1
+ 0x0000000000101a40 0x2d lib/libarm.a(board.o)
+ .rodata.str1.1
+ 0x0000000000101a6d 0x2a drivers/libdrivers.a(image.o)
+ .rodata.str1.1
+ 0x0000000000101a97 0x17 drivers/libdrivers.a(efuse.o)
+ .rodata.str1.1
+ 0x0000000000101aae 0x3 drivers/libdrivers.a(secure_verify.o)
+ .rodata.str1.1
+ 0x0000000000101ab1 0x15c drivers/libdrivers.a(nor.o)
+
+.rel.dyn 0x0000000000101c10 0x0
+ .rel.iplt 0x0000000000000000 0x0 cpu/m0/start.o
+ 0x0000000000101c10 . = ALIGN (0x4)
+
+.data 0x0000000000101c10 0x50
+ *(.data)
+ .data 0x0000000000101c10 0x0 cpu/m0/start.o
+ .data 0x0000000000101c10 0x0 lib/libarm.a(board.o)
+ .data 0x0000000000101c10 0x0 lib/libarm.a(string.o)
+ .data 0x0000000000101c10 0x0 drivers/libdrivers.a(ddr.o)
+ .data 0x0000000000101c10 0x0 drivers/libdrivers.a(uart.o)
+ .data 0x0000000000101c10 0x0 drivers/libdrivers.a(image.o)
+ .data 0x0000000000101c10 0x0 drivers/libdrivers.a(efuse.o)
+ .data 0x0000000000101c10 0x0 drivers/libdrivers.a(secure_verify.o)
+ .data 0x0000000000101c10 0x50 drivers/libdrivers.a(nor.o)
+ 0x0000000000101c10 nor_cmd_table
+ .data 0x0000000000101c60 0x0 drivers/libdrivers.a(drv_hash.o)
+ .data 0x0000000000101c60 0x0 drivers/libdrivers.a(drv_rsa.o)
+ .data 0x0000000000101c60 0x0 drivers/libdrivers.a(flash.o)
+ .data 0x0000000000101c60 0x0 cpu/m0/libm0.a(cpu.o)
+ .data 0x0000000000101c60 0x0 cpu/m0/libm0.a(clk.o)
+
+.igot.plt 0x0000000000101c60 0x0
+ .igot.plt 0x0000000000000000 0x0 cpu/m0/start.o
+ 0x0000000000101c60 . = ALIGN (0x4)
+
+.got
+ *(.got)
+ 0x0000000000101c60 . = ALIGN (0x4)
+ 0x0000000000101c60 __bss_start = .
+
+.bss 0x0000000000101c60 0x164
+ *(.bss)
+ .bss 0x0000000000101c60 0x0 cpu/m0/start.o
+ .bss 0x0000000000101c60 0x4 lib/libarm.a(board.o)
+ 0x0000000000101c60 zloader_entry_point
+ .bss 0x0000000000101c64 0x0 lib/libarm.a(string.o)
+ .bss 0x0000000000101c64 0x0 drivers/libdrivers.a(ddr.o)
+ .bss 0x0000000000101c64 0x0 drivers/libdrivers.a(uart.o)
+ .bss 0x0000000000101c64 0x0 drivers/libdrivers.a(image.o)
+ .bss 0x0000000000101c64 0x0 drivers/libdrivers.a(efuse.o)
+ .bss 0x0000000000101c64 0x104 drivers/libdrivers.a(secure_verify.o)
+ 0x0000000000101c64 result
+ .bss 0x0000000000101d68 0x28 drivers/libdrivers.a(nor.o)
+ 0x0000000000101d68 spi_nor_flash
+ 0x0000000000101d6c otp_data
+ .bss 0x0000000000101d90 0x0 drivers/libdrivers.a(drv_hash.o)
+ .bss 0x0000000000101d90 0x0 drivers/libdrivers.a(drv_rsa.o)
+ .bss 0x0000000000101d90 0x24 drivers/libdrivers.a(flash.o)
+ 0x0000000000101d90 flash
+ .bss 0x0000000000101db4 0x10 cpu/m0/libm0.a(cpu.o)
+ 0x0000000000101db4 g_tick
+ .bss 0x0000000000101dc4 0x0 cpu/m0/libm0.a(clk.o)
+ 0x0000000000101dc4 __bss_end = .
+ 0x0000000000101dc4 . = ALIGN (0x4)
+
+.para 0x0000000082000000 0x0 加载地址 0x0000000000101dc4
+ 0x0000000082000000 __para_start = .
+ *(.para)
+ 0x0000000082000000 __para_end = .
+ 0x0000000082000000 __end = .
+段 .text 的地址设置为 0x100000
+LOAD cpu/m0/start.o
+START GROUP
+LOAD board/zx297520v3/libzx297520v3.a
+LOAD cpu/m0/libm0.a
+LOAD lib/libarm.a
+LOAD drivers/libdrivers.a
+END GROUP
+OUTPUT(z-load elf32-littlearm)
+
+.ARM.attributes
+ 0x0000000000000000 0x10
+ .ARM.attributes
+ 0x0000000000000000 0x10 cpu/m0/start.o
+ .ARM.attributes
+ 0x0000000000000010 0x10 lib/libarm.a(board.o)
+ .ARM.attributes
+ 0x0000000000000020 0x10 lib/libarm.a(string.o)
+ .ARM.attributes
+ 0x0000000000000030 0x10 drivers/libdrivers.a(ddr.o)
+ .ARM.attributes
+ 0x0000000000000040 0x10 drivers/libdrivers.a(uart.o)
+ .ARM.attributes
+ 0x0000000000000050 0x10 drivers/libdrivers.a(image.o)
+ .ARM.attributes
+ 0x0000000000000060 0x10 drivers/libdrivers.a(efuse.o)
+ .ARM.attributes
+ 0x0000000000000070 0x10 drivers/libdrivers.a(secure_verify.o)
+ .ARM.attributes
+ 0x0000000000000080 0x10 drivers/libdrivers.a(nor.o)
+ .ARM.attributes
+ 0x0000000000000090 0x10 drivers/libdrivers.a(drv_hash.o)
+ .ARM.attributes
+ 0x00000000000000a0 0x10 drivers/libdrivers.a(drv_rsa.o)
+ .ARM.attributes
+ 0x00000000000000b0 0x10 drivers/libdrivers.a(flash.o)
+ .ARM.attributes
+ 0x00000000000000c0 0x10 cpu/m0/libm0.a(cpu.o)
+ .ARM.attributes
+ 0x00000000000000d0 0x10 cpu/m0/libm0.a(clk.o)
+
+.comment 0x0000000000000000 0x29
+ .comment 0x0000000000000000 0x29 lib/libarm.a(board.o)
+ 0x2a (松开之前的大小)
+ .comment 0x0000000000000000 0x2a lib/libarm.a(string.o)
+ .comment 0x0000000000000000 0x2a drivers/libdrivers.a(ddr.o)
+ .comment 0x0000000000000000 0x2a drivers/libdrivers.a(uart.o)
+ .comment 0x0000000000000000 0x2a drivers/libdrivers.a(image.o)
+ .comment 0x0000000000000000 0x2a drivers/libdrivers.a(efuse.o)
+ .comment 0x0000000000000000 0x2a drivers/libdrivers.a(secure_verify.o)
+ .comment 0x0000000000000000 0x2a drivers/libdrivers.a(nor.o)
+ .comment 0x0000000000000000 0x2a drivers/libdrivers.a(drv_hash.o)
+ .comment 0x0000000000000000 0x2a drivers/libdrivers.a(drv_rsa.o)
+ .comment 0x0000000000000000 0x2a drivers/libdrivers.a(flash.o)
+ .comment 0x0000000000000000 0x2a cpu/m0/libm0.a(cpu.o)
+ .comment 0x0000000000000000 0x2a cpu/m0/libm0.a(clk.o)
+
+.note.GNU-stack
+ 0x0000000000000000 0x0
+ .note.GNU-stack
+ 0x0000000000000000 0x0 lib/libarm.a(board.o)
+ .note.GNU-stack
+ 0x0000000000000000 0x0 lib/libarm.a(string.o)
+ .note.GNU-stack
+ 0x0000000000000000 0x0 drivers/libdrivers.a(ddr.o)
+ .note.GNU-stack
+ 0x0000000000000000 0x0 drivers/libdrivers.a(uart.o)
+ .note.GNU-stack
+ 0x0000000000000000 0x0 drivers/libdrivers.a(image.o)
+ .note.GNU-stack
+ 0x0000000000000000 0x0 drivers/libdrivers.a(efuse.o)
+ .note.GNU-stack
+ 0x0000000000000000 0x0 drivers/libdrivers.a(secure_verify.o)
+ .note.GNU-stack
+ 0x0000000000000000 0x0 drivers/libdrivers.a(nor.o)
+ .note.GNU-stack
+ 0x0000000000000000 0x0 drivers/libdrivers.a(drv_hash.o)
+ .note.GNU-stack
+ 0x0000000000000000 0x0 drivers/libdrivers.a(drv_rsa.o)
+ .note.GNU-stack
+ 0x0000000000000000 0x0 drivers/libdrivers.a(flash.o)
+ .note.GNU-stack
+ 0x0000000000000000 0x0 cpu/m0/libm0.a(cpu.o)
+ .note.GNU-stack
+ 0x0000000000000000 0x0 cpu/m0/libm0.a(clk.o)
+
+.stab 0x0000000000000000 0x27c
+ .stab 0x0000000000000000 0x27c cpu/m0/start.o
+
+.stabstr 0x0000000000000000 0x67
+ .stabstr 0x0000000000000000 0x67 cpu/m0/start.o
+
+.debug_info 0x0000000000000000 0x33aa
+ .debug_info 0x0000000000000000 0x5e3 lib/libarm.a(board.o)
+ .debug_info 0x00000000000005e3 0x22b lib/libarm.a(string.o)
+ .debug_info 0x000000000000080e 0x329 drivers/libdrivers.a(ddr.o)
+ .debug_info 0x0000000000000b37 0x2a0 drivers/libdrivers.a(uart.o)
+ .debug_info 0x0000000000000dd7 0x6d3 drivers/libdrivers.a(image.o)
+ .debug_info 0x00000000000014aa 0x1c3 drivers/libdrivers.a(efuse.o)
+ .debug_info 0x000000000000166d 0x62d drivers/libdrivers.a(secure_verify.o)
+ .debug_info 0x0000000000001c9a 0xd5f drivers/libdrivers.a(nor.o)
+ .debug_info 0x00000000000029f9 0x1e8 drivers/libdrivers.a(drv_hash.o)
+ .debug_info 0x0000000000002be1 0x3b4 drivers/libdrivers.a(drv_rsa.o)
+ .debug_info 0x0000000000002f95 0x20f drivers/libdrivers.a(flash.o)
+ .debug_info 0x00000000000031a4 0x17b cpu/m0/libm0.a(cpu.o)
+ .debug_info 0x000000000000331f 0x8b cpu/m0/libm0.a(clk.o)
+
+.debug_abbrev 0x0000000000000000 0x1281
+ .debug_abbrev 0x0000000000000000 0x277 lib/libarm.a(board.o)
+ .debug_abbrev 0x0000000000000277 0xb7 lib/libarm.a(string.o)
+ .debug_abbrev 0x000000000000032e 0x12f drivers/libdrivers.a(ddr.o)
+ .debug_abbrev 0x000000000000045d 0x19e drivers/libdrivers.a(uart.o)
+ .debug_abbrev 0x00000000000005fb 0x212 drivers/libdrivers.a(image.o)
+ .debug_abbrev 0x000000000000080d 0x11d drivers/libdrivers.a(efuse.o)
+ .debug_abbrev 0x000000000000092a 0x258 drivers/libdrivers.a(secure_verify.o)
+ .debug_abbrev 0x0000000000000b82 0x280 drivers/libdrivers.a(nor.o)
+ .debug_abbrev 0x0000000000000e02 0xde drivers/libdrivers.a(drv_hash.o)
+ .debug_abbrev 0x0000000000000ee0 0x1e2 drivers/libdrivers.a(drv_rsa.o)
+ .debug_abbrev 0x00000000000010c2 0xb5 drivers/libdrivers.a(flash.o)
+ .debug_abbrev 0x0000000000001177 0xc8 cpu/m0/libm0.a(cpu.o)
+ .debug_abbrev 0x000000000000123f 0x42 cpu/m0/libm0.a(clk.o)
+
+.debug_loc 0x0000000000000000 0x1c6c
+ .debug_loc 0x0000000000000000 0xcc lib/libarm.a(board.o)
+ .debug_loc 0x00000000000000cc 0x29d lib/libarm.a(string.o)
+ .debug_loc 0x0000000000000369 0x2d8 drivers/libdrivers.a(ddr.o)
+ .debug_loc 0x0000000000000641 0x228 drivers/libdrivers.a(uart.o)
+ .debug_loc 0x0000000000000869 0x2ab drivers/libdrivers.a(image.o)
+ .debug_loc 0x0000000000000b14 0xab drivers/libdrivers.a(efuse.o)
+ .debug_loc 0x0000000000000bbf 0x3ea drivers/libdrivers.a(secure_verify.o)
+ .debug_loc 0x0000000000000fa9 0x80a drivers/libdrivers.a(nor.o)
+ .debug_loc 0x00000000000017b3 0x1b8 drivers/libdrivers.a(drv_hash.o)
+ .debug_loc 0x000000000000196b 0x238 drivers/libdrivers.a(drv_rsa.o)
+ .debug_loc 0x0000000000001ba3 0x1f drivers/libdrivers.a(flash.o)
+ .debug_loc 0x0000000000001bc2 0xaa cpu/m0/libm0.a(cpu.o)
+
+.debug_aranges 0x0000000000000000 0x1a0
+ .debug_aranges
+ 0x0000000000000000 0x20 lib/libarm.a(board.o)
+ .debug_aranges
+ 0x0000000000000020 0x20 lib/libarm.a(string.o)
+ .debug_aranges
+ 0x0000000000000040 0x20 drivers/libdrivers.a(ddr.o)
+ .debug_aranges
+ 0x0000000000000060 0x20 drivers/libdrivers.a(uart.o)
+ .debug_aranges
+ 0x0000000000000080 0x20 drivers/libdrivers.a(image.o)
+ .debug_aranges
+ 0x00000000000000a0 0x20 drivers/libdrivers.a(efuse.o)
+ .debug_aranges
+ 0x00000000000000c0 0x20 drivers/libdrivers.a(secure_verify.o)
+ .debug_aranges
+ 0x00000000000000e0 0x20 drivers/libdrivers.a(nor.o)
+ .debug_aranges
+ 0x0000000000000100 0x20 drivers/libdrivers.a(drv_hash.o)
+ .debug_aranges
+ 0x0000000000000120 0x20 drivers/libdrivers.a(drv_rsa.o)
+ .debug_aranges
+ 0x0000000000000140 0x20 drivers/libdrivers.a(flash.o)
+ .debug_aranges
+ 0x0000000000000160 0x20 cpu/m0/libm0.a(cpu.o)
+ .debug_aranges
+ 0x0000000000000180 0x20 cpu/m0/libm0.a(clk.o)
+
+.debug_ranges 0x0000000000000000 0xc8
+ .debug_ranges 0x0000000000000000 0x18 lib/libarm.a(board.o)
+ .debug_ranges 0x0000000000000018 0x18 drivers/libdrivers.a(ddr.o)
+ .debug_ranges 0x0000000000000030 0x18 drivers/libdrivers.a(uart.o)
+ .debug_ranges 0x0000000000000048 0x20 drivers/libdrivers.a(nor.o)
+ .debug_ranges 0x0000000000000068 0x28 drivers/libdrivers.a(drv_hash.o)
+ .debug_ranges 0x0000000000000090 0x38 drivers/libdrivers.a(drv_rsa.o)
+
+.debug_line 0x0000000000000000 0x1413
+ .debug_line 0x0000000000000000 0x2df lib/libarm.a(board.o)
+ .debug_line 0x00000000000002df 0x152 lib/libarm.a(string.o)
+ .debug_line 0x0000000000000431 0x290 drivers/libdrivers.a(ddr.o)
+ .debug_line 0x00000000000006c1 0x112 drivers/libdrivers.a(uart.o)
+ .debug_line 0x00000000000007d3 0x228 drivers/libdrivers.a(image.o)
+ .debug_line 0x00000000000009fb 0x118 drivers/libdrivers.a(efuse.o)
+ .debug_line 0x0000000000000b13 0x2ad drivers/libdrivers.a(secure_verify.o)
+ .debug_line 0x0000000000000dc0 0x2a2 drivers/libdrivers.a(nor.o)
+ .debug_line 0x0000000000001062 0x88 drivers/libdrivers.a(drv_hash.o)
+ .debug_line 0x00000000000010ea 0x117 drivers/libdrivers.a(drv_rsa.o)
+ .debug_line 0x0000000000001201 0x10a drivers/libdrivers.a(flash.o)
+ .debug_line 0x000000000000130b 0xa7 cpu/m0/libm0.a(cpu.o)
+ .debug_line 0x00000000000013b2 0x61 cpu/m0/libm0.a(clk.o)
+
+.debug_str 0x0000000000000000 0xe2b
+ .debug_str 0x0000000000000000 0x445 lib/libarm.a(board.o)
+ 0x4b8 (松开之前的大小)
+ .debug_str 0x0000000000000445 0x4c lib/libarm.a(string.o)
+ 0x214 (松开之前的大小)
+ .debug_str 0x0000000000000491 0xa1 drivers/libdrivers.a(ddr.o)
+ 0x216 (松开之前的大小)
+ .debug_str 0x0000000000000532 0x8a drivers/libdrivers.a(uart.o)
+ 0x253 (松开之前的大小)
+ .debug_str 0x00000000000005bc 0x229 drivers/libdrivers.a(image.o)
+ 0x4a0 (松开之前的大小)
+ .debug_str 0x00000000000007e5 0x7b drivers/libdrivers.a(efuse.o)
+ 0x255 (松开之前的大小)
+ .debug_str 0x0000000000000860 0x177 drivers/libdrivers.a(secure_verify.o)
+ 0x407 (松开之前的大小)
+ .debug_str 0x00000000000009d7 0x2c3 drivers/libdrivers.a(nor.o)
+ 0x5f3 (松开之前的大小)
+ .debug_str 0x0000000000000c9a 0x87 drivers/libdrivers.a(drv_hash.o)
+ 0x25a (松开之前的大小)
+ .debug_str 0x0000000000000d21 0x79 drivers/libdrivers.a(drv_rsa.o)
+ 0x29c (松开之前的大小)
+ .debug_str 0x0000000000000d9a 0x12 drivers/libdrivers.a(flash.o)
+ 0x2a8 (松开之前的大小)
+ .debug_str 0x0000000000000dac 0x79 cpu/m0/libm0.a(cpu.o)
+ 0x1f8 (松开之前的大小)
+ .debug_str 0x0000000000000e25 0x6 cpu/m0/libm0.a(clk.o)
+ 0x1bd (松开之前的大小)
+
+.debug_frame 0x0000000000000000 0x6a0
+ .debug_frame 0x0000000000000000 0xa4 lib/libarm.a(board.o)
+ .debug_frame 0x00000000000000a4 0x68 lib/libarm.a(string.o)
+ .debug_frame 0x000000000000010c 0xac drivers/libdrivers.a(ddr.o)
+ .debug_frame 0x00000000000001b8 0xc0 drivers/libdrivers.a(uart.o)
+ .debug_frame 0x0000000000000278 0xa4 drivers/libdrivers.a(image.o)
+ .debug_frame 0x000000000000031c 0x60 drivers/libdrivers.a(efuse.o)
+ .debug_frame 0x000000000000037c 0x80 drivers/libdrivers.a(secure_verify.o)
+ .debug_frame 0x00000000000003fc 0x1b0 drivers/libdrivers.a(nor.o)
+ .debug_frame 0x00000000000005ac 0x2c drivers/libdrivers.a(drv_hash.o)
+ .debug_frame 0x00000000000005d8 0x4c drivers/libdrivers.a(drv_rsa.o)
+ .debug_frame 0x0000000000000624 0x20 drivers/libdrivers.a(flash.o)
+ .debug_frame 0x0000000000000644 0x30 cpu/m0/libm0.a(cpu.o)
+ .debug_frame 0x0000000000000674 0x2c cpu/m0/libm0.a(clk.o)
diff --git a/boot/prj/zx297520v3/bootrom/dl_off/zloader.bin b/boot/prj/zx297520v3/bootrom/dl_off/zloader.bin
new file mode 100755
index 0000000..71a0cdf
--- /dev/null
+++ b/boot/prj/zx297520v3/bootrom/dl_off/zloader.bin
Binary files differ
diff --git a/boot/prj/zx297520v3/bootrom/dl_on/z-load b/boot/prj/zx297520v3/bootrom/dl_on/z-load
new file mode 100755
index 0000000..f768275
--- /dev/null
+++ b/boot/prj/zx297520v3/bootrom/dl_on/z-load
Binary files differ
diff --git a/boot/prj/zx297520v3/bootrom/dl_on/z-load.map b/boot/prj/zx297520v3/bootrom/dl_on/z-load.map
new file mode 100755
index 0000000..620baa6
--- /dev/null
+++ b/boot/prj/zx297520v3/bootrom/dl_on/z-load.map
@@ -0,0 +1,439 @@
+Archive member included because of file (symbol)
+
+lib/libarm.a(board.o) cpu/m0/start.o (copy_to_iram1)
+lib/libarm.a(string.o) lib/libarm.a(board.o) (memcpy)
+drivers/libdrivers.a(ddr.o) lib/libarm.a(board.o) (ddr_init)
+drivers/libdrivers.a(uart.o) lib/libarm.a(board.o) (uart_init)
+drivers/libdrivers.a(image.o)
+ lib/libarm.a(board.o) (read_zloader_image)
+drivers/libdrivers.a(efuse.o)
+ lib/libarm.a(board.o) (efuse_init)
+drivers/libdrivers.a(secure_verify.o)
+ drivers/libdrivers.a(image.o) (secure_verify_zloader)
+drivers/libdrivers.a(nor.o) lib/libarm.a(board.o) (board_flash_init)
+drivers/libdrivers.a(drv_hash.o)
+ drivers/libdrivers.a(secure_verify.o) (Hash_Calculate)
+drivers/libdrivers.a(drv_rsa.o)
+ drivers/libdrivers.a(secure_verify.o) (Rsa_Calculate)
+drivers/libdrivers.a(flash.o)
+ drivers/libdrivers.a(nor.o) (get_boot_mode)
+cpu/m0/libm0.a(cpu.o) lib/libarm.a(board.o) (timer_init)
+cpu/m0/libm0.a(clk.o) lib/libarm.a(board.o) (clk_init)
+
+内存配置
+
+名称 来源 长度 属性
+*default* 0x0000000000000000 0xffffffffffffffff
+
+链结器命令稿和内存映射
+
+ 0x0000000000000000 . = 0x0
+ 0x0000000000000000 . = ALIGN (0x4)
+
+.text 0x0000000000100000 0x18d4
+ cpu/m0/start.o(.text)
+ .text 0x0000000000100000 0x248 cpu/m0/start.o
+ 0x00000000001001a4 _bss_start
+ 0x00000000001001ac _bss_end
+ 0x00000000001001b0 _para_start
+ 0x00000000001001b4 _para_end
+ 0x00000000001001b8 _start
+ 0x0000000000100216 run_at
+ *(.text)
+ .text 0x0000000000100248 0x144 lib/libarm.a(board.o)
+ 0x0000000000100248 print_info
+ 0x0000000000100258 copy_to_iram1
+ 0x0000000000100278 clear_iram
+ 0x0000000000100290 write_loader_mode
+ 0x000000000010029c hang
+ 0x000000000010029e usb_apcore_poweroff
+ 0x00000000001002f8 start_armboot
+ .text 0x000000000010038c 0x80 lib/libarm.a(string.o)
+ 0x000000000010038c strlen
+ 0x000000000010039c memset
+ 0x00000000001003de memcmp
+ 0x00000000001003fa memcpy
+ .text 0x000000000010040c 0x810 drivers/libdrivers.a(ddr.o)
+ 0x000000000010040c nsdelay
+ 0x0000000000100426 ddr_clk_init
+ 0x000000000010043c ddr_phy_init
+ 0x0000000000100538 ddr_ctrl_init
+ 0x00000000001008d8 ddr_prio_init
+ 0x00000000001009fc ddr_init
+ .text 0x0000000000100c1c 0x138 drivers/libdrivers.a(uart.o)
+ 0x0000000000100c1c uart_init
+ 0x0000000000100c9c uart_putc
+ 0x0000000000100cc4 uart_puts
+ 0x0000000000100cd8 uart_getc
+ 0x0000000000100cf4 uart_tstc
+ 0x0000000000100d04 UART_Read
+ 0x0000000000100d20 UART_Write
+ 0x0000000000100d3c UART_Check_Sync
+ .text 0x0000000000100d54 0x10c drivers/libdrivers.a(image.o)
+ 0x0000000000100d54 page_align
+ 0x0000000000100d6c find_partition_para
+ 0x0000000000100d9c read_image_part_offset
+ 0x0000000000100df0 read_flags_image
+ 0x0000000000100df4 read_uboot_image
+ 0x0000000000100df8 nand_read_m0
+ 0x0000000000100dfc read_zloader_image
+ .text 0x0000000000100e60 0x1a0 drivers/libdrivers.a(efuse.o)
+ 0x0000000000100e60 efuse_init
+ 0x0000000000100e84 get_ddr_flag
+ 0x0000000000100f88 get_secure_verify_status
+ 0x0000000000100fcc get_otp_secure_verify_status
+ .text 0x0000000000101000 0x198 drivers/libdrivers.a(secure_verify.o)
+ 0x0000000000101000 BIG2SMALL
+ 0x0000000000101030 bin2hex
+ 0x000000000010107c secure_verify_zloader
+ 0x0000000000101194 SecureVerify
+ .text 0x0000000000101198 0x424 drivers/libdrivers.a(nor.o)
+ 0x0000000000101198 spifc_enable
+ 0x00000000001011c8 spifc_disable
+ 0x00000000001011ec spifc_setup_cmd
+ 0x0000000000101270 spifc_wait_cmd_end
+ 0x000000000010129c spifc_read_fifo
+ 0x00000000001012d8 spifc_start
+ 0x00000000001012e8 cmd_seek
+ 0x0000000000101308 nor_read_reg
+ 0x0000000000101368 nor_read_id
+ 0x00000000001013d0 spi_nor_read
+ 0x000000000010142c nor_read
+ 0x0000000000101480 spi_nor_read_security_register
+ 0x00000000001014dc nor_read_security_register
+ 0x0000000000101530 nor_init
+ 0x0000000000101580 board_flash_init
+ .text 0x00000000001015bc 0xa4 drivers/libdrivers.a(drv_hash.o)
+ 0x00000000001015bc Hash_Calculate
+ .text 0x0000000000101660 0x174 drivers/libdrivers.a(drv_rsa.o)
+ 0x000000000010167a Rsa_Calculate
+ .text 0x00000000001017d4 0x28 drivers/libdrivers.a(flash.o)
+ 0x00000000001017d4 get_boot_mode
+ .text 0x00000000001017fc 0x54 cpu/m0/libm0.a(cpu.o)
+ 0x00000000001017fc timer_init
+ 0x0000000000101814 usdelay
+ .text 0x0000000000101850 0x84 cpu/m0/libm0.a(clk.o)
+ 0x0000000000101850 clk_init
+
+.glue_7 0x00000000001018d4 0x0
+ .glue_7 0x0000000000000000 0x0 linker stubs
+
+.glue_7t 0x00000000001018d4 0x0
+ .glue_7t 0x0000000000000000 0x0 linker stubs
+
+.vfp11_veneer 0x00000000001018d4 0x0
+ .vfp11_veneer 0x0000000000000000 0x0 linker stubs
+
+.v4_bx 0x00000000001018d4 0x0
+ .v4_bx 0x0000000000000000 0x0 linker stubs
+
+.iplt 0x00000000001018d4 0x0
+ .iplt 0x0000000000000000 0x0 cpu/m0/start.o
+ 0x00000000001018d4 . = ALIGN (0x4)
+
+.rodata 0x00000000001018d4 0x16c
+ *(.rodata)
+ .rodata 0x00000000001018d4 0x16c drivers/libdrivers.a(nor.o)
+
+.rodata.str1.1 0x0000000000101a40 0x1cd
+ .rodata.str1.1
+ 0x0000000000101a40 0x2d lib/libarm.a(board.o)
+ .rodata.str1.1
+ 0x0000000000101a6d 0x2a drivers/libdrivers.a(image.o)
+ .rodata.str1.1
+ 0x0000000000101a97 0x17 drivers/libdrivers.a(efuse.o)
+ .rodata.str1.1
+ 0x0000000000101aae 0x3 drivers/libdrivers.a(secure_verify.o)
+ .rodata.str1.1
+ 0x0000000000101ab1 0x15c drivers/libdrivers.a(nor.o)
+
+.rel.dyn 0x0000000000101c10 0x0
+ .rel.iplt 0x0000000000000000 0x0 cpu/m0/start.o
+ 0x0000000000101c10 . = ALIGN (0x4)
+
+.data 0x0000000000101c10 0x50
+ *(.data)
+ .data 0x0000000000101c10 0x0 cpu/m0/start.o
+ .data 0x0000000000101c10 0x0 lib/libarm.a(board.o)
+ .data 0x0000000000101c10 0x0 lib/libarm.a(string.o)
+ .data 0x0000000000101c10 0x0 drivers/libdrivers.a(ddr.o)
+ .data 0x0000000000101c10 0x0 drivers/libdrivers.a(uart.o)
+ .data 0x0000000000101c10 0x0 drivers/libdrivers.a(image.o)
+ .data 0x0000000000101c10 0x0 drivers/libdrivers.a(efuse.o)
+ .data 0x0000000000101c10 0x0 drivers/libdrivers.a(secure_verify.o)
+ .data 0x0000000000101c10 0x50 drivers/libdrivers.a(nor.o)
+ 0x0000000000101c10 nor_cmd_table
+ .data 0x0000000000101c60 0x0 drivers/libdrivers.a(drv_hash.o)
+ .data 0x0000000000101c60 0x0 drivers/libdrivers.a(drv_rsa.o)
+ .data 0x0000000000101c60 0x0 drivers/libdrivers.a(flash.o)
+ .data 0x0000000000101c60 0x0 cpu/m0/libm0.a(cpu.o)
+ .data 0x0000000000101c60 0x0 cpu/m0/libm0.a(clk.o)
+
+.igot.plt 0x0000000000101c60 0x0
+ .igot.plt 0x0000000000000000 0x0 cpu/m0/start.o
+ 0x0000000000101c60 . = ALIGN (0x4)
+
+.got
+ *(.got)
+ 0x0000000000101c60 . = ALIGN (0x4)
+ 0x0000000000101c60 __bss_start = .
+
+.bss 0x0000000000101c60 0x164
+ *(.bss)
+ .bss 0x0000000000101c60 0x0 cpu/m0/start.o
+ .bss 0x0000000000101c60 0x4 lib/libarm.a(board.o)
+ 0x0000000000101c60 zloader_entry_point
+ .bss 0x0000000000101c64 0x0 lib/libarm.a(string.o)
+ .bss 0x0000000000101c64 0x0 drivers/libdrivers.a(ddr.o)
+ .bss 0x0000000000101c64 0x0 drivers/libdrivers.a(uart.o)
+ .bss 0x0000000000101c64 0x0 drivers/libdrivers.a(image.o)
+ .bss 0x0000000000101c64 0x0 drivers/libdrivers.a(efuse.o)
+ .bss 0x0000000000101c64 0x104 drivers/libdrivers.a(secure_verify.o)
+ 0x0000000000101c64 result
+ .bss 0x0000000000101d68 0x28 drivers/libdrivers.a(nor.o)
+ 0x0000000000101d68 spi_nor_flash
+ 0x0000000000101d6c otp_data
+ .bss 0x0000000000101d90 0x0 drivers/libdrivers.a(drv_hash.o)
+ .bss 0x0000000000101d90 0x0 drivers/libdrivers.a(drv_rsa.o)
+ .bss 0x0000000000101d90 0x24 drivers/libdrivers.a(flash.o)
+ 0x0000000000101d90 flash
+ .bss 0x0000000000101db4 0x10 cpu/m0/libm0.a(cpu.o)
+ 0x0000000000101db4 g_tick
+ .bss 0x0000000000101dc4 0x0 cpu/m0/libm0.a(clk.o)
+ 0x0000000000101dc4 __bss_end = .
+ 0x0000000000101dc4 . = ALIGN (0x4)
+
+.para 0x0000000082000000 0x0 加载地址 0x0000000000101dc4
+ 0x0000000082000000 __para_start = .
+ *(.para)
+ 0x0000000082000000 __para_end = .
+ 0x0000000082000000 __end = .
+段 .text 的地址设置为 0x100000
+LOAD cpu/m0/start.o
+START GROUP
+LOAD board/zx297520v3/libzx297520v3.a
+LOAD cpu/m0/libm0.a
+LOAD lib/libarm.a
+LOAD drivers/libdrivers.a
+END GROUP
+OUTPUT(z-load elf32-littlearm)
+
+.ARM.attributes
+ 0x0000000000000000 0x10
+ .ARM.attributes
+ 0x0000000000000000 0x10 cpu/m0/start.o
+ .ARM.attributes
+ 0x0000000000000010 0x10 lib/libarm.a(board.o)
+ .ARM.attributes
+ 0x0000000000000020 0x10 lib/libarm.a(string.o)
+ .ARM.attributes
+ 0x0000000000000030 0x10 drivers/libdrivers.a(ddr.o)
+ .ARM.attributes
+ 0x0000000000000040 0x10 drivers/libdrivers.a(uart.o)
+ .ARM.attributes
+ 0x0000000000000050 0x10 drivers/libdrivers.a(image.o)
+ .ARM.attributes
+ 0x0000000000000060 0x10 drivers/libdrivers.a(efuse.o)
+ .ARM.attributes
+ 0x0000000000000070 0x10 drivers/libdrivers.a(secure_verify.o)
+ .ARM.attributes
+ 0x0000000000000080 0x10 drivers/libdrivers.a(nor.o)
+ .ARM.attributes
+ 0x0000000000000090 0x10 drivers/libdrivers.a(drv_hash.o)
+ .ARM.attributes
+ 0x00000000000000a0 0x10 drivers/libdrivers.a(drv_rsa.o)
+ .ARM.attributes
+ 0x00000000000000b0 0x10 drivers/libdrivers.a(flash.o)
+ .ARM.attributes
+ 0x00000000000000c0 0x10 cpu/m0/libm0.a(cpu.o)
+ .ARM.attributes
+ 0x00000000000000d0 0x10 cpu/m0/libm0.a(clk.o)
+
+.comment 0x0000000000000000 0x29
+ .comment 0x0000000000000000 0x29 lib/libarm.a(board.o)
+ 0x2a (松开之前的大小)
+ .comment 0x0000000000000000 0x2a lib/libarm.a(string.o)
+ .comment 0x0000000000000000 0x2a drivers/libdrivers.a(ddr.o)
+ .comment 0x0000000000000000 0x2a drivers/libdrivers.a(uart.o)
+ .comment 0x0000000000000000 0x2a drivers/libdrivers.a(image.o)
+ .comment 0x0000000000000000 0x2a drivers/libdrivers.a(efuse.o)
+ .comment 0x0000000000000000 0x2a drivers/libdrivers.a(secure_verify.o)
+ .comment 0x0000000000000000 0x2a drivers/libdrivers.a(nor.o)
+ .comment 0x0000000000000000 0x2a drivers/libdrivers.a(drv_hash.o)
+ .comment 0x0000000000000000 0x2a drivers/libdrivers.a(drv_rsa.o)
+ .comment 0x0000000000000000 0x2a drivers/libdrivers.a(flash.o)
+ .comment 0x0000000000000000 0x2a cpu/m0/libm0.a(cpu.o)
+ .comment 0x0000000000000000 0x2a cpu/m0/libm0.a(clk.o)
+
+.note.GNU-stack
+ 0x0000000000000000 0x0
+ .note.GNU-stack
+ 0x0000000000000000 0x0 lib/libarm.a(board.o)
+ .note.GNU-stack
+ 0x0000000000000000 0x0 lib/libarm.a(string.o)
+ .note.GNU-stack
+ 0x0000000000000000 0x0 drivers/libdrivers.a(ddr.o)
+ .note.GNU-stack
+ 0x0000000000000000 0x0 drivers/libdrivers.a(uart.o)
+ .note.GNU-stack
+ 0x0000000000000000 0x0 drivers/libdrivers.a(image.o)
+ .note.GNU-stack
+ 0x0000000000000000 0x0 drivers/libdrivers.a(efuse.o)
+ .note.GNU-stack
+ 0x0000000000000000 0x0 drivers/libdrivers.a(secure_verify.o)
+ .note.GNU-stack
+ 0x0000000000000000 0x0 drivers/libdrivers.a(nor.o)
+ .note.GNU-stack
+ 0x0000000000000000 0x0 drivers/libdrivers.a(drv_hash.o)
+ .note.GNU-stack
+ 0x0000000000000000 0x0 drivers/libdrivers.a(drv_rsa.o)
+ .note.GNU-stack
+ 0x0000000000000000 0x0 drivers/libdrivers.a(flash.o)
+ .note.GNU-stack
+ 0x0000000000000000 0x0 cpu/m0/libm0.a(cpu.o)
+ .note.GNU-stack
+ 0x0000000000000000 0x0 cpu/m0/libm0.a(clk.o)
+
+.stab 0x0000000000000000 0x27c
+ .stab 0x0000000000000000 0x27c cpu/m0/start.o
+
+.stabstr 0x0000000000000000 0x67
+ .stabstr 0x0000000000000000 0x67 cpu/m0/start.o
+
+.debug_info 0x0000000000000000 0x33aa
+ .debug_info 0x0000000000000000 0x5e3 lib/libarm.a(board.o)
+ .debug_info 0x00000000000005e3 0x22b lib/libarm.a(string.o)
+ .debug_info 0x000000000000080e 0x329 drivers/libdrivers.a(ddr.o)
+ .debug_info 0x0000000000000b37 0x2a0 drivers/libdrivers.a(uart.o)
+ .debug_info 0x0000000000000dd7 0x6d3 drivers/libdrivers.a(image.o)
+ .debug_info 0x00000000000014aa 0x1c3 drivers/libdrivers.a(efuse.o)
+ .debug_info 0x000000000000166d 0x62d drivers/libdrivers.a(secure_verify.o)
+ .debug_info 0x0000000000001c9a 0xd5f drivers/libdrivers.a(nor.o)
+ .debug_info 0x00000000000029f9 0x1e8 drivers/libdrivers.a(drv_hash.o)
+ .debug_info 0x0000000000002be1 0x3b4 drivers/libdrivers.a(drv_rsa.o)
+ .debug_info 0x0000000000002f95 0x20f drivers/libdrivers.a(flash.o)
+ .debug_info 0x00000000000031a4 0x17b cpu/m0/libm0.a(cpu.o)
+ .debug_info 0x000000000000331f 0x8b cpu/m0/libm0.a(clk.o)
+
+.debug_abbrev 0x0000000000000000 0x1281
+ .debug_abbrev 0x0000000000000000 0x277 lib/libarm.a(board.o)
+ .debug_abbrev 0x0000000000000277 0xb7 lib/libarm.a(string.o)
+ .debug_abbrev 0x000000000000032e 0x12f drivers/libdrivers.a(ddr.o)
+ .debug_abbrev 0x000000000000045d 0x19e drivers/libdrivers.a(uart.o)
+ .debug_abbrev 0x00000000000005fb 0x212 drivers/libdrivers.a(image.o)
+ .debug_abbrev 0x000000000000080d 0x11d drivers/libdrivers.a(efuse.o)
+ .debug_abbrev 0x000000000000092a 0x258 drivers/libdrivers.a(secure_verify.o)
+ .debug_abbrev 0x0000000000000b82 0x280 drivers/libdrivers.a(nor.o)
+ .debug_abbrev 0x0000000000000e02 0xde drivers/libdrivers.a(drv_hash.o)
+ .debug_abbrev 0x0000000000000ee0 0x1e2 drivers/libdrivers.a(drv_rsa.o)
+ .debug_abbrev 0x00000000000010c2 0xb5 drivers/libdrivers.a(flash.o)
+ .debug_abbrev 0x0000000000001177 0xc8 cpu/m0/libm0.a(cpu.o)
+ .debug_abbrev 0x000000000000123f 0x42 cpu/m0/libm0.a(clk.o)
+
+.debug_loc 0x0000000000000000 0x1c6c
+ .debug_loc 0x0000000000000000 0xcc lib/libarm.a(board.o)
+ .debug_loc 0x00000000000000cc 0x29d lib/libarm.a(string.o)
+ .debug_loc 0x0000000000000369 0x2d8 drivers/libdrivers.a(ddr.o)
+ .debug_loc 0x0000000000000641 0x228 drivers/libdrivers.a(uart.o)
+ .debug_loc 0x0000000000000869 0x2ab drivers/libdrivers.a(image.o)
+ .debug_loc 0x0000000000000b14 0xab drivers/libdrivers.a(efuse.o)
+ .debug_loc 0x0000000000000bbf 0x3ea drivers/libdrivers.a(secure_verify.o)
+ .debug_loc 0x0000000000000fa9 0x80a drivers/libdrivers.a(nor.o)
+ .debug_loc 0x00000000000017b3 0x1b8 drivers/libdrivers.a(drv_hash.o)
+ .debug_loc 0x000000000000196b 0x238 drivers/libdrivers.a(drv_rsa.o)
+ .debug_loc 0x0000000000001ba3 0x1f drivers/libdrivers.a(flash.o)
+ .debug_loc 0x0000000000001bc2 0xaa cpu/m0/libm0.a(cpu.o)
+
+.debug_aranges 0x0000000000000000 0x1a0
+ .debug_aranges
+ 0x0000000000000000 0x20 lib/libarm.a(board.o)
+ .debug_aranges
+ 0x0000000000000020 0x20 lib/libarm.a(string.o)
+ .debug_aranges
+ 0x0000000000000040 0x20 drivers/libdrivers.a(ddr.o)
+ .debug_aranges
+ 0x0000000000000060 0x20 drivers/libdrivers.a(uart.o)
+ .debug_aranges
+ 0x0000000000000080 0x20 drivers/libdrivers.a(image.o)
+ .debug_aranges
+ 0x00000000000000a0 0x20 drivers/libdrivers.a(efuse.o)
+ .debug_aranges
+ 0x00000000000000c0 0x20 drivers/libdrivers.a(secure_verify.o)
+ .debug_aranges
+ 0x00000000000000e0 0x20 drivers/libdrivers.a(nor.o)
+ .debug_aranges
+ 0x0000000000000100 0x20 drivers/libdrivers.a(drv_hash.o)
+ .debug_aranges
+ 0x0000000000000120 0x20 drivers/libdrivers.a(drv_rsa.o)
+ .debug_aranges
+ 0x0000000000000140 0x20 drivers/libdrivers.a(flash.o)
+ .debug_aranges
+ 0x0000000000000160 0x20 cpu/m0/libm0.a(cpu.o)
+ .debug_aranges
+ 0x0000000000000180 0x20 cpu/m0/libm0.a(clk.o)
+
+.debug_ranges 0x0000000000000000 0xc8
+ .debug_ranges 0x0000000000000000 0x18 lib/libarm.a(board.o)
+ .debug_ranges 0x0000000000000018 0x18 drivers/libdrivers.a(ddr.o)
+ .debug_ranges 0x0000000000000030 0x18 drivers/libdrivers.a(uart.o)
+ .debug_ranges 0x0000000000000048 0x20 drivers/libdrivers.a(nor.o)
+ .debug_ranges 0x0000000000000068 0x28 drivers/libdrivers.a(drv_hash.o)
+ .debug_ranges 0x0000000000000090 0x38 drivers/libdrivers.a(drv_rsa.o)
+
+.debug_line 0x0000000000000000 0x1413
+ .debug_line 0x0000000000000000 0x2df lib/libarm.a(board.o)
+ .debug_line 0x00000000000002df 0x152 lib/libarm.a(string.o)
+ .debug_line 0x0000000000000431 0x290 drivers/libdrivers.a(ddr.o)
+ .debug_line 0x00000000000006c1 0x112 drivers/libdrivers.a(uart.o)
+ .debug_line 0x00000000000007d3 0x228 drivers/libdrivers.a(image.o)
+ .debug_line 0x00000000000009fb 0x118 drivers/libdrivers.a(efuse.o)
+ .debug_line 0x0000000000000b13 0x2ad drivers/libdrivers.a(secure_verify.o)
+ .debug_line 0x0000000000000dc0 0x2a2 drivers/libdrivers.a(nor.o)
+ .debug_line 0x0000000000001062 0x88 drivers/libdrivers.a(drv_hash.o)
+ .debug_line 0x00000000000010ea 0x117 drivers/libdrivers.a(drv_rsa.o)
+ .debug_line 0x0000000000001201 0x10a drivers/libdrivers.a(flash.o)
+ .debug_line 0x000000000000130b 0xa7 cpu/m0/libm0.a(cpu.o)
+ .debug_line 0x00000000000013b2 0x61 cpu/m0/libm0.a(clk.o)
+
+.debug_str 0x0000000000000000 0xe2b
+ .debug_str 0x0000000000000000 0x445 lib/libarm.a(board.o)
+ 0x4b8 (松开之前的大小)
+ .debug_str 0x0000000000000445 0x4c lib/libarm.a(string.o)
+ 0x214 (松开之前的大小)
+ .debug_str 0x0000000000000491 0xa1 drivers/libdrivers.a(ddr.o)
+ 0x216 (松开之前的大小)
+ .debug_str 0x0000000000000532 0x8a drivers/libdrivers.a(uart.o)
+ 0x253 (松开之前的大小)
+ .debug_str 0x00000000000005bc 0x229 drivers/libdrivers.a(image.o)
+ 0x4a0 (松开之前的大小)
+ .debug_str 0x00000000000007e5 0x7b drivers/libdrivers.a(efuse.o)
+ 0x255 (松开之前的大小)
+ .debug_str 0x0000000000000860 0x177 drivers/libdrivers.a(secure_verify.o)
+ 0x407 (松开之前的大小)
+ .debug_str 0x00000000000009d7 0x2c3 drivers/libdrivers.a(nor.o)
+ 0x5f3 (松开之前的大小)
+ .debug_str 0x0000000000000c9a 0x87 drivers/libdrivers.a(drv_hash.o)
+ 0x25a (松开之前的大小)
+ .debug_str 0x0000000000000d21 0x79 drivers/libdrivers.a(drv_rsa.o)
+ 0x29c (松开之前的大小)
+ .debug_str 0x0000000000000d9a 0x12 drivers/libdrivers.a(flash.o)
+ 0x2a8 (松开之前的大小)
+ .debug_str 0x0000000000000dac 0x79 cpu/m0/libm0.a(cpu.o)
+ 0x1f8 (松开之前的大小)
+ .debug_str 0x0000000000000e25 0x6 cpu/m0/libm0.a(clk.o)
+ 0x1bd (松开之前的大小)
+
+.debug_frame 0x0000000000000000 0x6a0
+ .debug_frame 0x0000000000000000 0xa4 lib/libarm.a(board.o)
+ .debug_frame 0x00000000000000a4 0x68 lib/libarm.a(string.o)
+ .debug_frame 0x000000000000010c 0xac drivers/libdrivers.a(ddr.o)
+ .debug_frame 0x00000000000001b8 0xc0 drivers/libdrivers.a(uart.o)
+ .debug_frame 0x0000000000000278 0xa4 drivers/libdrivers.a(image.o)
+ .debug_frame 0x000000000000031c 0x60 drivers/libdrivers.a(efuse.o)
+ .debug_frame 0x000000000000037c 0x80 drivers/libdrivers.a(secure_verify.o)
+ .debug_frame 0x00000000000003fc 0x1b0 drivers/libdrivers.a(nor.o)
+ .debug_frame 0x00000000000005ac 0x2c drivers/libdrivers.a(drv_hash.o)
+ .debug_frame 0x00000000000005d8 0x4c drivers/libdrivers.a(drv_rsa.o)
+ .debug_frame 0x0000000000000624 0x20 drivers/libdrivers.a(flash.o)
+ .debug_frame 0x0000000000000644 0x30 cpu/m0/libm0.a(cpu.o)
+ .debug_frame 0x0000000000000674 0x2c cpu/m0/libm0.a(clk.o)
diff --git a/boot/prj/zx297520v3/bootrom/dl_on/zloader.bin b/boot/prj/zx297520v3/bootrom/dl_on/zloader.bin
new file mode 100755
index 0000000..ba5e394
--- /dev/null
+++ b/boot/prj/zx297520v3/bootrom/dl_on/zloader.bin
Binary files differ
diff --git a/boot/prj/zx297520v3/bootrom/loader2.bin b/boot/prj/zx297520v3/bootrom/loader2.bin
new file mode 100755
index 0000000..ad811f3
--- /dev/null
+++ b/boot/prj/zx297520v3/bootrom/loader2.bin
Binary files differ
diff --git a/boot/prj/zx297520v3/bootrom/merge_boorom.sh b/boot/prj/zx297520v3/bootrom/merge_boorom.sh
new file mode 100755
index 0000000..b961cd1
--- /dev/null
+++ b/boot/prj/zx297520v3/bootrom/merge_boorom.sh
@@ -0,0 +1,40 @@
+#!/bin/bash
+
+CURR_DIR=`pwd`
+TOP_DIR=$CURR_DIR/../../../..
+
+rm $TOP_DIR/boot/prj/zx297520v3/bootrom/dl_on/zloader_tmp.bin
+rm $TOP_DIR/boot/prj/zx297520v3/bootrom/dl_off/zloader_tmp.bin
+rm $TOP_DIR/boot/prj/zx297520v3/bootrom/loader2_tmp.bin
+rm $TOP_DIR/boot/prj/zx297520v3/bootrom/dl_on/bootrom.bin
+rm $TOP_DIR/boot/prj/zx297520v3/bootrom/dl_off/bootrom.bin
+
+
+cp -rvf $TOP_DIR/boot/prj/zx297520v3/vehicle_dc/bin/dl_on/zloader_tmp.bin $TOP_DIR/boot/prj/zx297520v3/vehicle_dc/bin/dl_on/zloader.bin
+cp -rvf $TOP_DIR/boot/prj/zx297520v3/vehicle_dc/bin/dl_off/zloader_tmp.bin $TOP_DIR/boot/prj/zx297520v3/vehicle_dc/bin/dl_off/zloader.bin
+cp -rvf $TOP_DIR/boot/prj/zx297520v3/vehicle_dc_ref/bin/dl_on/zloader_tmp.bin $TOP_DIR/boot/prj/zx297520v3/vehicle_dc_ref/bin/dl_on/zloader.bin
+cp -rvf $TOP_DIR/boot/prj/zx297520v3/vehicle_dc_ref/bin/dl_off/zloader_tmp.bin $TOP_DIR/boot/prj/zx297520v3/vehicle_dc_ref/bin/dl_off/zloader.bin
+
+rm $TOP_DIR/boot/prj/zx297520v3/vehicle_dc/bin/dl_on/zloader_tmp.bin
+rm $TOP_DIR/boot/prj/zx297520v3/vehicle_dc_ref/bin/dl_on/zloader_tmp.bin
+rm $TOP_DIR/boot/prj/zx297520v3/vehicle_dc/bin/dl_off/zloader_tmp.bin
+rm $TOP_DIR/boot/prj/zx297520v3/vehicle_dc_ref/bin/dl_off/zloader_tmp.bin
+
+
+dd if=$TOP_DIR/boot/prj/zx297520v3/bootrom/dl_on/zloader.bin of=$TOP_DIR/boot/prj/zx297520v3/bootrom/dl_on/zloader_tmp.bin bs=8192 conv=sync
+dd if=$TOP_DIR/boot/prj/zx297520v3/bootrom/dl_off/zloader.bin of=$TOP_DIR/boot/prj/zx297520v3/bootrom/dl_off/zloader_tmp.bin bs=8192 conv=sync
+dd if=$TOP_DIR/boot/prj/zx297520v3/bootrom/loader2.bin of=$TOP_DIR/boot/prj/zx297520v3/bootrom/loader2_tmp.bin bs=24576 conv=sync
+dd if=$TOP_DIR/boot/prj/zx297520v3/vehicle_dc/bin/dl_on/zloader.bin of=$TOP_DIR/boot/prj/zx297520v3/vehicle_dc/bin/dl_on/zloader_tmp.bin bs=8192 conv=sync
+dd if=$TOP_DIR/boot/prj/zx297520v3/vehicle_dc_ref/bin/dl_on/zloader.bin of=$TOP_DIR/boot/prj/zx297520v3/vehicle_dc_ref/bin/dl_on/zloader_tmp.bin bs=8192 conv=sync
+dd if=$TOP_DIR/boot/prj/zx297520v3/vehicle_dc/bin/dl_off/zloader.bin of=$TOP_DIR/boot/prj/zx297520v3/vehicle_dc/bin/dl_off/zloader_tmp.bin bs=8192 conv=sync
+dd if=$TOP_DIR/boot/prj/zx297520v3/vehicle_dc_ref/bin/dl_off/zloader.bin of=$TOP_DIR/boot/prj/zx297520v3/vehicle_dc_ref/bin/dl_off/zloader_tmp.bin bs=8192 conv=sync
+
+
+cat $TOP_DIR/boot/prj/zx297520v3/bootrom/dl_on/zloader_tmp.bin $TOP_DIR/boot/prj/zx297520v3/bootrom/loader2_tmp.bin > $TOP_DIR/boot/prj/zx297520v3/bootrom/dl_on/bootrom.bin
+cat $TOP_DIR/boot/prj/zx297520v3/bootrom/dl_on/bootrom.bin $TOP_DIR/boot/prj/zx297520v3/vehicle_dc/bin/dl_on/zloader_tmp.bin > $TOP_DIR/boot/prj/zx297520v3/vehicle_dc/bin/dl_on/zloader.bin
+cat $TOP_DIR/boot/prj/zx297520v3/bootrom/dl_on/bootrom.bin $TOP_DIR/boot/prj/zx297520v3/vehicle_dc_ref/bin/dl_on/zloader_tmp.bin > $TOP_DIR/boot/prj/zx297520v3/vehicle_dc_ref/bin/dl_on/zloader.bin
+
+cat $TOP_DIR/boot/prj/zx297520v3/bootrom/dl_off/zloader_tmp.bin $TOP_DIR/boot/prj/zx297520v3/bootrom/loader2_tmp.bin > $TOP_DIR/boot/prj/zx297520v3/bootrom/dl_off/bootrom.bin
+cat $TOP_DIR/boot/prj/zx297520v3/bootrom/dl_off/bootrom.bin $TOP_DIR/boot/prj/zx297520v3/vehicle_dc/bin/dl_off/zloader_tmp.bin > $TOP_DIR/boot/prj/zx297520v3/vehicle_dc/bin/dl_off/zloader.bin
+cat $TOP_DIR/boot/prj/zx297520v3/bootrom/dl_off/bootrom.bin $TOP_DIR/boot/prj/zx297520v3/vehicle_dc_ref/bin/dl_off/zloader_tmp.bin > $TOP_DIR/boot/prj/zx297520v3/vehicle_dc_ref/bin/dl_off/zloader.bin
+
diff --git a/boot/prj/zx297520v3/bootrom/z-load2 b/boot/prj/zx297520v3/bootrom/z-load2
new file mode 100755
index 0000000..fcf3f7c
--- /dev/null
+++ b/boot/prj/zx297520v3/bootrom/z-load2
Binary files differ
diff --git a/boot/prj/zx297520v3/bootrom/z-load2.map b/boot/prj/zx297520v3/bootrom/z-load2.map
new file mode 100755
index 0000000..b848efa
--- /dev/null
+++ b/boot/prj/zx297520v3/bootrom/z-load2.map
@@ -0,0 +1,513 @@
+Archive member included because of file (symbol)
+
+lib/libarm.a(board.o) cpu/m0/start.o (start_armboot)
+lib/libarm.a(string.o) lib/libarm.a(board.o) (memcpy)
+drivers/libdrivers.a(uart.o) lib/libarm.a(board.o) (uart_puts)
+drivers/libdrivers.a(image.o)
+ lib/libarm.a(board.o) (read_flags_image)
+drivers/libdrivers.a(secure_verify.o)
+ drivers/libdrivers.a(image.o) (secure_verify_zloader)
+drivers/libdrivers.a(spifc_loader2.o)
+ lib/libarm.a(board.o) (zloader_flash_init)
+drivers/libdrivers.a(bbt.o) drivers/libdrivers.a(spifc_loader2.o) (nand_creat_ram_bbt)
+drivers/libdrivers.a(sha256.o)
+ drivers/libdrivers.a(secure_verify.o) (sha256_csum_wd)
+drivers/libdrivers.a(nor.o) lib/libarm.a(board.o) (nor_init)
+drivers/libdrivers.a(ddr.o) drivers/libdrivers.a(spifc_loader2.o) (nsdelay)
+drivers/libdrivers.a(drv_hash.o)
+ drivers/libdrivers.a(secure_verify.o) (Hash_Calculate)
+drivers/libdrivers.a(drv_rsa.o)
+ drivers/libdrivers.a(secure_verify.o) (Rsa_Calculate)
+drivers/libdrivers.a(flash.o)
+ drivers/libdrivers.a(nor.o) (get_boot_mode)
+drivers/libdrivers.a(efuse.o)
+ drivers/libdrivers.a(secure_verify.o) (get_secure_verify_status)
+cpu/m0/libm0.a(cpu.o) lib/libarm.a(board.o) (usdelay)
+
+内存配置
+
+名称 来源 长度 属性
+*default* 0x0000000000000000 0xffffffffffffffff
+
+链结器命令稿和内存映射
+
+ 0x0000000000000000 . = 0x0
+ 0x0000000000000000 . = ALIGN (0x4)
+
+.text 0x0000000020300000 0x4b10
+ cpu/m0/start.o(.text)
+ .text 0x0000000020300000 0x220 cpu/m0/start.o
+ 0x00000000203001a4 _bss_start
+ 0x00000000203001ac _bss_end
+ 0x00000000203001b0 _para_start
+ 0x00000000203001b4 _para_end
+ 0x00000000203001b8 _start
+ 0x00000000203001fe run_at
+ *(.text)
+ .text 0x0000000020300220 0x258 lib/libarm.a(board.o)
+ 0x0000000020300220 print_info
+ 0x0000000020300230 copy_to_iram1
+ 0x0000000020300250 clear_iram
+ 0x0000000020300268 write_loader_mode
+ 0x0000000020300274 hang
+ 0x0000000020300276 usb_apcore_poweroff
+ 0x00000000203002d0 start_armboot
+ .text 0x0000000020300478 0x80 lib/libarm.a(string.o)
+ 0x0000000020300478 strlen
+ 0x0000000020300488 memset
+ 0x00000000203004ca memcmp
+ 0x00000000203004e6 memcpy
+ .text 0x00000000203004f8 0x138 drivers/libdrivers.a(uart.o)
+ 0x00000000203004f8 uart_init
+ 0x0000000020300578 uart_putc
+ 0x00000000203005a0 uart_puts
+ 0x00000000203005b4 uart_getc
+ 0x00000000203005d0 uart_tstc
+ 0x00000000203005e0 UART_Read
+ 0x00000000203005fc UART_Write
+ 0x0000000020300618 UART_Check_Sync
+ .text 0x0000000020300630 0x338 drivers/libdrivers.a(image.o)
+ 0x0000000020300634 page_align
+ 0x000000002030064c find_partition_para
+ 0x000000002030067c read_image_part_offset
+ 0x00000000203006d0 read_flags_image
+ 0x00000000203007b8 read_uboot_image
+ 0x0000000020300898 nand_read_m0
+ 0x0000000020300904 read_zloader_image
+ .text 0x0000000020300968 0x2b0 drivers/libdrivers.a(secure_verify.o)
+ 0x0000000020300986 BIG2SMALL
+ 0x00000000203009b6 bin2hex
+ 0x0000000020300a00 secure_verify_zloader
+ 0x0000000020300af4 SecureVerify
+ .text 0x0000000020300c18 0x648 drivers/libdrivers.a(spifc_loader2.o)
+ 0x0000000020300d0c zDrvGpio_SetFunc
+ 0x0000000020300d44 zDrvGpio_SetDirection
+ 0x0000000020300d94 zDrvGpio_SetOutputValue
+ 0x0000000020300dd0 spi_nand_cs
+ 0x0000000020300e0c spifc_clear_fifo
+ 0x0000000020300e20 spifc_clear_int
+ 0x0000000020300f7c spifc_read_oob
+ 0x0000000020300fc0 spifc_read_page_raw
+ 0x0000000020300ffc spifc_read_page
+ 0x0000000020301078 spifc_read
+ 0x00000000203010bc read_data
+ 0x0000000020301110 read_id
+ 0x0000000020301194 spifc_init
+ 0x0000000020301218 zloader_flash_init
+ .text 0x0000000020301260 0x1c0 drivers/libdrivers.a(bbt.o)
+ 0x00000000203012c0 nand_creat_ram_bbt
+ 0x0000000020301304 nand_search_bbt
+ 0x0000000020301390 nand_creat_bbt
+ 0x000000002030140c nand_block_isbad
+ .text 0x0000000020301420 0x2688 drivers/libdrivers.a(sha256.o)
+ 0x0000000020303940 sha256_starts
+ 0x0000000020303988 sha256_update
+ 0x0000000020303994 sha256_finish
+ 0x0000000020303a80 sha256_csum_wd
+ .text 0x0000000020303aa8 0x424 drivers/libdrivers.a(nor.o)
+ 0x0000000020303aa8 spifc_enable
+ 0x0000000020303ad8 spifc_disable
+ 0x0000000020303afc spifc_setup_cmd
+ 0x0000000020303b80 spifc_wait_cmd_end
+ 0x0000000020303bac spifc_read_fifo
+ 0x0000000020303be8 spifc_start
+ 0x0000000020303bf8 cmd_seek
+ 0x0000000020303c18 nor_read_reg
+ 0x0000000020303c78 nor_read_id
+ 0x0000000020303ce0 spi_nor_read
+ 0x0000000020303d3c nor_read
+ 0x0000000020303d90 spi_nor_read_security_register
+ 0x0000000020303dec nor_read_security_register
+ 0x0000000020303e40 nor_init
+ 0x0000000020303e90 board_flash_init
+ .text 0x0000000020303ecc 0x810 drivers/libdrivers.a(ddr.o)
+ 0x0000000020303ecc nsdelay
+ 0x0000000020303ee6 ddr_clk_init
+ 0x0000000020303efc ddr_phy_init
+ 0x0000000020303ff8 ddr_ctrl_init
+ 0x0000000020304398 ddr_prio_init
+ 0x00000000203044bc ddr_init
+ .text 0x00000000203046dc 0xa4 drivers/libdrivers.a(drv_hash.o)
+ 0x00000000203046dc Hash_Calculate
+ .text 0x0000000020304780 0x174 drivers/libdrivers.a(drv_rsa.o)
+ 0x000000002030479a Rsa_Calculate
+ .text 0x00000000203048f4 0x28 drivers/libdrivers.a(flash.o)
+ 0x00000000203048f4 get_boot_mode
+ .text 0x000000002030491c 0x1a0 drivers/libdrivers.a(efuse.o)
+ 0x000000002030491c efuse_init
+ 0x0000000020304940 get_ddr_flag
+ 0x0000000020304a44 get_secure_verify_status
+ 0x0000000020304a88 get_otp_secure_verify_status
+ .text 0x0000000020304abc 0x54 cpu/m0/libm0.a(cpu.o)
+ 0x0000000020304abc timer_init
+ 0x0000000020304ad4 usdelay
+
+.glue_7 0x0000000020304b10 0x0
+ .glue_7 0x0000000000000000 0x0 linker stubs
+
+.glue_7t 0x0000000020304b10 0x0
+ .glue_7t 0x0000000000000000 0x0 linker stubs
+
+.vfp11_veneer 0x0000000020304b10 0x0
+ .vfp11_veneer 0x0000000000000000 0x0 linker stubs
+
+.v4_bx 0x0000000020304b10 0x0
+ .v4_bx 0x0000000000000000 0x0 linker stubs
+
+.iplt 0x0000000020304b10 0x0
+ .iplt 0x0000000000000000 0x0 cpu/m0/start.o
+ 0x0000000020304b10 . = ALIGN (0x4)
+
+.rodata 0x0000000020304b10 0x3f0
+ *(.rodata)
+ .rodata 0x0000000020304b10 0x270 drivers/libdrivers.a(spifc_loader2.o)
+ .rodata 0x0000000020304d80 0x13 drivers/libdrivers.a(sha256.o)
+ 0x0000000020304d80 sha256_der_prefix
+ *fill* 0x0000000020304d93 0x1
+ .rodata 0x0000000020304d94 0x16c drivers/libdrivers.a(nor.o)
+
+.rodata.str1.1 0x0000000020304f00 0x46f
+ .rodata.str1.1
+ 0x0000000020304f00 0x16c lib/libarm.a(board.o)
+ 0x185 (松开之前的大小)
+ .rodata.str1.1
+ 0x000000002030506c 0xef drivers/libdrivers.a(image.o)
+ 0x115 (松开之前的大小)
+ .rodata.str1.1
+ 0x000000002030515b 0x5b drivers/libdrivers.a(secure_verify.o)
+ 0x5d (松开之前的大小)
+ .rodata.str1.1
+ 0x00000000203051b6 0x3d drivers/libdrivers.a(spifc_loader2.o)
+ 0x4a (松开之前的大小)
+ .rodata.str1.1
+ 0x00000000203051f3 0x9 drivers/libdrivers.a(bbt.o)
+ .rodata.str1.1
+ 0x00000000203051fc 0x15c drivers/libdrivers.a(nor.o)
+ .rodata.str1.1
+ 0x0000000020305358 0x17 drivers/libdrivers.a(efuse.o)
+
+.rel.dyn 0x0000000020305370 0x0
+ .rel.iplt 0x0000000000000000 0x0 cpu/m0/start.o
+ 0x0000000020305370 . = ALIGN (0x4)
+
+.data 0x0000000020305370 0xd0
+ *(.data)
+ .data 0x0000000020305370 0x0 cpu/m0/start.o
+ .data 0x0000000020305370 0x0 lib/libarm.a(board.o)
+ .data 0x0000000020305370 0x0 lib/libarm.a(string.o)
+ .data 0x0000000020305370 0x0 drivers/libdrivers.a(uart.o)
+ .data 0x0000000020305370 0x0 drivers/libdrivers.a(image.o)
+ .data 0x0000000020305370 0x0 drivers/libdrivers.a(secure_verify.o)
+ .data 0x0000000020305370 0x0 drivers/libdrivers.a(spifc_loader2.o)
+ .data 0x0000000020305370 0x40 drivers/libdrivers.a(bbt.o)
+ .data 0x00000000203053b0 0x40 drivers/libdrivers.a(sha256.o)
+ .data 0x00000000203053f0 0x50 drivers/libdrivers.a(nor.o)
+ 0x00000000203053f0 nor_cmd_table
+ .data 0x0000000020305440 0x0 drivers/libdrivers.a(ddr.o)
+ .data 0x0000000020305440 0x0 drivers/libdrivers.a(drv_hash.o)
+ .data 0x0000000020305440 0x0 drivers/libdrivers.a(drv_rsa.o)
+ .data 0x0000000020305440 0x0 drivers/libdrivers.a(flash.o)
+ .data 0x0000000020305440 0x0 drivers/libdrivers.a(efuse.o)
+ .data 0x0000000020305440 0x0 cpu/m0/libm0.a(cpu.o)
+
+.igot.plt 0x0000000020305440 0x0
+ .igot.plt 0x0000000000000000 0x0 cpu/m0/start.o
+ 0x0000000020305440 . = ALIGN (0x4)
+
+.got
+ *(.got)
+ 0x0000000020305440 . = ALIGN (0x4)
+ 0x0000000020305440 __bss_start = .
+
+.bss 0x0000000020305440 0x1e8
+ *(.bss)
+ .bss 0x0000000020305440 0x0 cpu/m0/start.o
+ .bss 0x0000000020305440 0x4 lib/libarm.a(board.o)
+ 0x0000000020305440 zloader_entry_point
+ .bss 0x0000000020305444 0x0 lib/libarm.a(string.o)
+ .bss 0x0000000020305444 0x0 drivers/libdrivers.a(uart.o)
+ .bss 0x0000000020305444 0x0 drivers/libdrivers.a(image.o)
+ .bss 0x0000000020305444 0x104 drivers/libdrivers.a(secure_verify.o)
+ 0x0000000020305444 result
+ .bss 0x0000000020305548 0x4 drivers/libdrivers.a(spifc_loader2.o)
+ .bss 0x000000002030554c 0x80 drivers/libdrivers.a(bbt.o)
+ .bss 0x00000000203055cc 0x0 drivers/libdrivers.a(sha256.o)
+ .bss 0x00000000203055cc 0x28 drivers/libdrivers.a(nor.o)
+ 0x00000000203055cc spi_nor_flash
+ 0x00000000203055d0 otp_data
+ .bss 0x00000000203055f4 0x0 drivers/libdrivers.a(ddr.o)
+ .bss 0x00000000203055f4 0x0 drivers/libdrivers.a(drv_hash.o)
+ .bss 0x00000000203055f4 0x0 drivers/libdrivers.a(drv_rsa.o)
+ .bss 0x00000000203055f4 0x24 drivers/libdrivers.a(flash.o)
+ 0x00000000203055f4 flash
+ .bss 0x0000000020305618 0x0 drivers/libdrivers.a(efuse.o)
+ .bss 0x0000000020305618 0x10 cpu/m0/libm0.a(cpu.o)
+ 0x0000000020305618 g_tick
+ 0x0000000020305628 __bss_end = .
+ 0x0000000020305628 . = ALIGN (0x4)
+
+.para 0x0000000082000000 0x0 加载地址 0x0000000020305628
+ 0x0000000082000000 __para_start = .
+ *(.para)
+ 0x0000000082000000 __para_end = .
+ 0x0000000082000000 __end = .
+段 .text 的地址设置为 0x20300000
+LOAD cpu/m0/start.o
+START GROUP
+LOAD board/zx297520v3/libzx297520v3.a
+LOAD cpu/m0/libm0.a
+LOAD lib/libarm.a
+LOAD drivers/libdrivers.a
+END GROUP
+OUTPUT(z-load elf32-littlearm)
+
+.ARM.attributes
+ 0x0000000000000000 0x10
+ .ARM.attributes
+ 0x0000000000000000 0x10 cpu/m0/start.o
+ .ARM.attributes
+ 0x0000000000000010 0x10 lib/libarm.a(board.o)
+ .ARM.attributes
+ 0x0000000000000020 0x10 lib/libarm.a(string.o)
+ .ARM.attributes
+ 0x0000000000000030 0x10 drivers/libdrivers.a(uart.o)
+ .ARM.attributes
+ 0x0000000000000040 0x10 drivers/libdrivers.a(image.o)
+ .ARM.attributes
+ 0x0000000000000050 0x10 drivers/libdrivers.a(secure_verify.o)
+ .ARM.attributes
+ 0x0000000000000060 0x10 drivers/libdrivers.a(spifc_loader2.o)
+ .ARM.attributes
+ 0x0000000000000070 0x10 drivers/libdrivers.a(bbt.o)
+ .ARM.attributes
+ 0x0000000000000080 0x10 drivers/libdrivers.a(sha256.o)
+ .ARM.attributes
+ 0x0000000000000090 0x10 drivers/libdrivers.a(nor.o)
+ .ARM.attributes
+ 0x00000000000000a0 0x10 drivers/libdrivers.a(ddr.o)
+ .ARM.attributes
+ 0x00000000000000b0 0x10 drivers/libdrivers.a(drv_hash.o)
+ .ARM.attributes
+ 0x00000000000000c0 0x10 drivers/libdrivers.a(drv_rsa.o)
+ .ARM.attributes
+ 0x00000000000000d0 0x10 drivers/libdrivers.a(flash.o)
+ .ARM.attributes
+ 0x00000000000000e0 0x10 drivers/libdrivers.a(efuse.o)
+ .ARM.attributes
+ 0x00000000000000f0 0x10 cpu/m0/libm0.a(cpu.o)
+
+.comment 0x0000000000000000 0x29
+ .comment 0x0000000000000000 0x29 lib/libarm.a(board.o)
+ 0x2a (松开之前的大小)
+ .comment 0x0000000000000000 0x2a lib/libarm.a(string.o)
+ .comment 0x0000000000000000 0x2a drivers/libdrivers.a(uart.o)
+ .comment 0x0000000000000000 0x2a drivers/libdrivers.a(image.o)
+ .comment 0x0000000000000000 0x2a drivers/libdrivers.a(secure_verify.o)
+ .comment 0x0000000000000000 0x2a drivers/libdrivers.a(spifc_loader2.o)
+ .comment 0x0000000000000000 0x2a drivers/libdrivers.a(bbt.o)
+ .comment 0x0000000000000000 0x2a drivers/libdrivers.a(sha256.o)
+ .comment 0x0000000000000000 0x2a drivers/libdrivers.a(nor.o)
+ .comment 0x0000000000000000 0x2a drivers/libdrivers.a(ddr.o)
+ .comment 0x0000000000000000 0x2a drivers/libdrivers.a(drv_hash.o)
+ .comment 0x0000000000000000 0x2a drivers/libdrivers.a(drv_rsa.o)
+ .comment 0x0000000000000000 0x2a drivers/libdrivers.a(flash.o)
+ .comment 0x0000000000000000 0x2a drivers/libdrivers.a(efuse.o)
+ .comment 0x0000000000000000 0x2a cpu/m0/libm0.a(cpu.o)
+
+.note.GNU-stack
+ 0x0000000000000000 0x0
+ .note.GNU-stack
+ 0x0000000000000000 0x0 lib/libarm.a(board.o)
+ .note.GNU-stack
+ 0x0000000000000000 0x0 lib/libarm.a(string.o)
+ .note.GNU-stack
+ 0x0000000000000000 0x0 drivers/libdrivers.a(uart.o)
+ .note.GNU-stack
+ 0x0000000000000000 0x0 drivers/libdrivers.a(image.o)
+ .note.GNU-stack
+ 0x0000000000000000 0x0 drivers/libdrivers.a(secure_verify.o)
+ .note.GNU-stack
+ 0x0000000000000000 0x0 drivers/libdrivers.a(spifc_loader2.o)
+ .note.GNU-stack
+ 0x0000000000000000 0x0 drivers/libdrivers.a(bbt.o)
+ .note.GNU-stack
+ 0x0000000000000000 0x0 drivers/libdrivers.a(sha256.o)
+ .note.GNU-stack
+ 0x0000000000000000 0x0 drivers/libdrivers.a(nor.o)
+ .note.GNU-stack
+ 0x0000000000000000 0x0 drivers/libdrivers.a(ddr.o)
+ .note.GNU-stack
+ 0x0000000000000000 0x0 drivers/libdrivers.a(drv_hash.o)
+ .note.GNU-stack
+ 0x0000000000000000 0x0 drivers/libdrivers.a(drv_rsa.o)
+ .note.GNU-stack
+ 0x0000000000000000 0x0 drivers/libdrivers.a(flash.o)
+ .note.GNU-stack
+ 0x0000000000000000 0x0 drivers/libdrivers.a(efuse.o)
+ .note.GNU-stack
+ 0x0000000000000000 0x0 cpu/m0/libm0.a(cpu.o)
+
+.stab 0x0000000000000000 0x204
+ .stab 0x0000000000000000 0x204 cpu/m0/start.o
+
+.stabstr 0x0000000000000000 0x67
+ .stabstr 0x0000000000000000 0x67 cpu/m0/start.o
+
+.debug_info 0x0000000000000000 0x6225
+ .debug_info 0x0000000000000000 0x719 lib/libarm.a(board.o)
+ .debug_info 0x0000000000000719 0x22b lib/libarm.a(string.o)
+ .debug_info 0x0000000000000944 0x2a0 drivers/libdrivers.a(uart.o)
+ .debug_info 0x0000000000000be4 0xcd9 drivers/libdrivers.a(image.o)
+ .debug_info 0x00000000000018bd 0xb01 drivers/libdrivers.a(secure_verify.o)
+ .debug_info 0x00000000000023be 0x1661 drivers/libdrivers.a(spifc_loader2.o)
+ .debug_info 0x0000000000003a1f 0x70f drivers/libdrivers.a(bbt.o)
+ .debug_info 0x000000000000412e 0x586 drivers/libdrivers.a(sha256.o)
+ .debug_info 0x00000000000046b4 0xd5f drivers/libdrivers.a(nor.o)
+ .debug_info 0x0000000000005413 0x329 drivers/libdrivers.a(ddr.o)
+ .debug_info 0x000000000000573c 0x1e8 drivers/libdrivers.a(drv_hash.o)
+ .debug_info 0x0000000000005924 0x3b4 drivers/libdrivers.a(drv_rsa.o)
+ .debug_info 0x0000000000005cd8 0x20f drivers/libdrivers.a(flash.o)
+ .debug_info 0x0000000000005ee7 0x1c3 drivers/libdrivers.a(efuse.o)
+ .debug_info 0x00000000000060aa 0x17b cpu/m0/libm0.a(cpu.o)
+
+.debug_abbrev 0x0000000000000000 0x1c41
+ .debug_abbrev 0x0000000000000000 0x2ba lib/libarm.a(board.o)
+ .debug_abbrev 0x00000000000002ba 0xb7 lib/libarm.a(string.o)
+ .debug_abbrev 0x0000000000000371 0x19e drivers/libdrivers.a(uart.o)
+ .debug_abbrev 0x000000000000050f 0x298 drivers/libdrivers.a(image.o)
+ .debug_abbrev 0x00000000000007a7 0x274 drivers/libdrivers.a(secure_verify.o)
+ .debug_abbrev 0x0000000000000a1b 0x48e drivers/libdrivers.a(spifc_loader2.o)
+ .debug_abbrev 0x0000000000000ea9 0x281 drivers/libdrivers.a(bbt.o)
+ .debug_abbrev 0x000000000000112a 0x20e drivers/libdrivers.a(sha256.o)
+ .debug_abbrev 0x0000000000001338 0x280 drivers/libdrivers.a(nor.o)
+ .debug_abbrev 0x00000000000015b8 0x12f drivers/libdrivers.a(ddr.o)
+ .debug_abbrev 0x00000000000016e7 0xde drivers/libdrivers.a(drv_hash.o)
+ .debug_abbrev 0x00000000000017c5 0x1e2 drivers/libdrivers.a(drv_rsa.o)
+ .debug_abbrev 0x00000000000019a7 0xb5 drivers/libdrivers.a(flash.o)
+ .debug_abbrev 0x0000000000001a5c 0x11d drivers/libdrivers.a(efuse.o)
+ .debug_abbrev 0x0000000000001b79 0xc8 cpu/m0/libm0.a(cpu.o)
+
+.debug_loc 0x0000000000000000 0x956d
+ .debug_loc 0x0000000000000000 0x17b lib/libarm.a(board.o)
+ .debug_loc 0x000000000000017b 0x29d lib/libarm.a(string.o)
+ .debug_loc 0x0000000000000418 0x228 drivers/libdrivers.a(uart.o)
+ .debug_loc 0x0000000000000640 0x6a2 drivers/libdrivers.a(image.o)
+ .debug_loc 0x0000000000000ce2 0x790 drivers/libdrivers.a(secure_verify.o)
+ .debug_loc 0x0000000000001472 0xef4 drivers/libdrivers.a(spifc_loader2.o)
+ .debug_loc 0x0000000000002366 0x282 drivers/libdrivers.a(bbt.o)
+ .debug_loc 0x00000000000025e8 0x5f3f drivers/libdrivers.a(sha256.o)
+ .debug_loc 0x0000000000008527 0x80a drivers/libdrivers.a(nor.o)
+ .debug_loc 0x0000000000008d31 0x2d8 drivers/libdrivers.a(ddr.o)
+ .debug_loc 0x0000000000009009 0x1b8 drivers/libdrivers.a(drv_hash.o)
+ .debug_loc 0x00000000000091c1 0x238 drivers/libdrivers.a(drv_rsa.o)
+ .debug_loc 0x00000000000093f9 0x1f drivers/libdrivers.a(flash.o)
+ .debug_loc 0x0000000000009418 0xab drivers/libdrivers.a(efuse.o)
+ .debug_loc 0x00000000000094c3 0xaa cpu/m0/libm0.a(cpu.o)
+
+.debug_aranges 0x0000000000000000 0x1e0
+ .debug_aranges
+ 0x0000000000000000 0x20 lib/libarm.a(board.o)
+ .debug_aranges
+ 0x0000000000000020 0x20 lib/libarm.a(string.o)
+ .debug_aranges
+ 0x0000000000000040 0x20 drivers/libdrivers.a(uart.o)
+ .debug_aranges
+ 0x0000000000000060 0x20 drivers/libdrivers.a(image.o)
+ .debug_aranges
+ 0x0000000000000080 0x20 drivers/libdrivers.a(secure_verify.o)
+ .debug_aranges
+ 0x00000000000000a0 0x20 drivers/libdrivers.a(spifc_loader2.o)
+ .debug_aranges
+ 0x00000000000000c0 0x20 drivers/libdrivers.a(bbt.o)
+ .debug_aranges
+ 0x00000000000000e0 0x20 drivers/libdrivers.a(sha256.o)
+ .debug_aranges
+ 0x0000000000000100 0x20 drivers/libdrivers.a(nor.o)
+ .debug_aranges
+ 0x0000000000000120 0x20 drivers/libdrivers.a(ddr.o)
+ .debug_aranges
+ 0x0000000000000140 0x20 drivers/libdrivers.a(drv_hash.o)
+ .debug_aranges
+ 0x0000000000000160 0x20 drivers/libdrivers.a(drv_rsa.o)
+ .debug_aranges
+ 0x0000000000000180 0x20 drivers/libdrivers.a(flash.o)
+ .debug_aranges
+ 0x00000000000001a0 0x20 drivers/libdrivers.a(efuse.o)
+ .debug_aranges
+ 0x00000000000001c0 0x20 cpu/m0/libm0.a(cpu.o)
+
+.debug_ranges 0x0000000000000000 0x238
+ .debug_ranges 0x0000000000000000 0x18 lib/libarm.a(board.o)
+ .debug_ranges 0x0000000000000018 0x18 drivers/libdrivers.a(uart.o)
+ .debug_ranges 0x0000000000000030 0x140 drivers/libdrivers.a(spifc_loader2.o)
+ .debug_ranges 0x0000000000000170 0x30 drivers/libdrivers.a(bbt.o)
+ .debug_ranges 0x00000000000001a0 0x20 drivers/libdrivers.a(nor.o)
+ .debug_ranges 0x00000000000001c0 0x18 drivers/libdrivers.a(ddr.o)
+ .debug_ranges 0x00000000000001d8 0x28 drivers/libdrivers.a(drv_hash.o)
+ .debug_ranges 0x0000000000000200 0x38 drivers/libdrivers.a(drv_rsa.o)
+
+.debug_line 0x0000000000000000 0x1f96
+ .debug_line 0x0000000000000000 0x304 lib/libarm.a(board.o)
+ .debug_line 0x0000000000000304 0x152 lib/libarm.a(string.o)
+ .debug_line 0x0000000000000456 0x112 drivers/libdrivers.a(uart.o)
+ .debug_line 0x0000000000000568 0x3b8 drivers/libdrivers.a(image.o)
+ .debug_line 0x0000000000000920 0x38e drivers/libdrivers.a(secure_verify.o)
+ .debug_line 0x0000000000000cae 0x442 drivers/libdrivers.a(spifc_loader2.o)
+ .debug_line 0x00000000000010f0 0x251 drivers/libdrivers.a(bbt.o)
+ .debug_line 0x0000000000001341 0x2bb drivers/libdrivers.a(sha256.o)
+ .debug_line 0x00000000000015fc 0x2a2 drivers/libdrivers.a(nor.o)
+ .debug_line 0x000000000000189e 0x290 drivers/libdrivers.a(ddr.o)
+ .debug_line 0x0000000000001b2e 0x88 drivers/libdrivers.a(drv_hash.o)
+ .debug_line 0x0000000000001bb6 0x117 drivers/libdrivers.a(drv_rsa.o)
+ .debug_line 0x0000000000001ccd 0x10a drivers/libdrivers.a(flash.o)
+ .debug_line 0x0000000000001dd7 0x118 drivers/libdrivers.a(efuse.o)
+ .debug_line 0x0000000000001eef 0xa7 cpu/m0/libm0.a(cpu.o)
+
+.debug_str 0x0000000000000000 0x152e
+ .debug_str 0x0000000000000000 0x470 lib/libarm.a(board.o)
+ 0x4da (松开之前的大小)
+ .debug_str 0x0000000000000470 0x3f lib/libarm.a(string.o)
+ 0x214 (松开之前的大小)
+ .debug_str 0x00000000000004af 0xe2 drivers/libdrivers.a(uart.o)
+ 0x253 (松开之前的大小)
+ .debug_str 0x0000000000000591 0x35b drivers/libdrivers.a(image.o)
+ 0x7ca (松开之前的大小)
+ .debug_str 0x00000000000008ec 0x2f9 drivers/libdrivers.a(secure_verify.o)
+ 0x61f (松开之前的大小)
+ .debug_str 0x0000000000000be5 0x3cc drivers/libdrivers.a(spifc_loader2.o)
+ 0x6c1 (松开之前的大小)
+ .debug_str 0x0000000000000fb1 0x103 drivers/libdrivers.a(bbt.o)
+ 0x3fe (松开之前的大小)
+ .debug_str 0x00000000000010b4 0xc3 drivers/libdrivers.a(sha256.o)
+ 0x2b7 (松开之前的大小)
+ .debug_str 0x0000000000001177 0x1ad drivers/libdrivers.a(nor.o)
+ 0x5f3 (松开之前的大小)
+ .debug_str 0x0000000000001324 0x54 drivers/libdrivers.a(ddr.o)
+ 0x216 (松开之前的大小)
+ .debug_str 0x0000000000001378 0x87 drivers/libdrivers.a(drv_hash.o)
+ 0x25a (松开之前的大小)
+ .debug_str 0x00000000000013ff 0x79 drivers/libdrivers.a(drv_rsa.o)
+ 0x29c (松开之前的大小)
+ .debug_str 0x0000000000001478 0x12 drivers/libdrivers.a(flash.o)
+ 0x2a8 (松开之前的大小)
+ .debug_str 0x000000000000148a 0x20 drivers/libdrivers.a(efuse.o)
+ 0x255 (松开之前的大小)
+ .debug_str 0x00000000000014aa 0x84 cpu/m0/libm0.a(cpu.o)
+ 0x1f8 (松开之前的大小)
+
+.debug_frame 0x0000000000000000 0xa90
+ .debug_frame 0x0000000000000000 0xb0 lib/libarm.a(board.o)
+ .debug_frame 0x00000000000000b0 0x68 lib/libarm.a(string.o)
+ .debug_frame 0x0000000000000118 0xc0 drivers/libdrivers.a(uart.o)
+ .debug_frame 0x00000000000001d8 0xec drivers/libdrivers.a(image.o)
+ .debug_frame 0x00000000000002c4 0xb0 drivers/libdrivers.a(secure_verify.o)
+ .debug_frame 0x0000000000000374 0x23c drivers/libdrivers.a(spifc_loader2.o)
+ .debug_frame 0x00000000000005b0 0xa0 drivers/libdrivers.a(bbt.o)
+ .debug_frame 0x0000000000000650 0xbc drivers/libdrivers.a(sha256.o)
+ .debug_frame 0x000000000000070c 0x1b0 drivers/libdrivers.a(nor.o)
+ .debug_frame 0x00000000000008bc 0xac drivers/libdrivers.a(ddr.o)
+ .debug_frame 0x0000000000000968 0x2c drivers/libdrivers.a(drv_hash.o)
+ .debug_frame 0x0000000000000994 0x4c drivers/libdrivers.a(drv_rsa.o)
+ .debug_frame 0x00000000000009e0 0x20 drivers/libdrivers.a(flash.o)
+ .debug_frame 0x0000000000000a00 0x60 drivers/libdrivers.a(efuse.o)
+ .debug_frame 0x0000000000000a60 0x30 cpu/m0/libm0.a(cpu.o)