comparison packages/redboot/current/src/flash.c @ 1627:1bf3513602bc

Fix CRC checking on load
author gthomas
date Wed, 05 May 2004 10:44:30 +0000
parents 43a89c18d005
children b548ac5af76c
comparison
equal deleted inserted replaced
1626:08e81f0c1712 1627:1bf3513602bc
981 struct fis_image_desc *img; 981 struct fis_image_desc *img;
982 CYG_ADDRESS mem_addr; 982 CYG_ADDRESS mem_addr;
983 bool mem_addr_set = false; 983 bool mem_addr_set = false;
984 bool show_cksum = false; 984 bool show_cksum = false;
985 struct option_info opts[3]; 985 struct option_info opts[3];
986 #ifdef CYGPKG_REDBOOT_FIS_CRC_CHECK 986 #if defined(CYGSEM_REDBOOT_FIS_CRC_CHECK)
987 unsigned long cksum; 987 unsigned long cksum;
988 #endif 988 #endif
989 int num_options; 989 int num_options;
990 #ifdef CYGPRI_REDBOOT_ZLIB_FLASH 990 #if defined(CYGPRI_REDBOOT_ZLIB_FLASH) || defined(CYGSEM_REDBOOT_FIS_CRC_CHECK)
991 bool decompress = false; 991 bool decompress = false;
992 #endif 992 #endif
993 void *err_addr; 993 void *err_addr;
994 994
995 init_opts(&opts[0], 'b', true, OPTION_ARG_TYPE_NUM, 995 init_opts(&opts[0], 'b', true, OPTION_ARG_TYPE_NUM,
1064 load_address = mem_addr; 1064 load_address = mem_addr;
1065 load_address_end = mem_addr + img->data_length; 1065 load_address_end = mem_addr + img->data_length;
1066 } 1066 }
1067 entry_address = (unsigned long)img->entry_point; 1067 entry_address = (unsigned long)img->entry_point;
1068 1068
1069 #ifdef CYGPKG_REDBOOT_FIS_CRC_CHECK 1069 #ifdef CYGSEM_REDBOOT_FIS_CRC_CHECK
1070 cksum = cyg_crc32((unsigned char *)mem_addr, img->data_length); 1070 cksum = cyg_crc32((unsigned char *)mem_addr, img->data_length);
1071 if (show_cksum) { 1071 if (show_cksum) {
1072 diag_printf("Checksum: 0x%08lx\n", cksum); 1072 diag_printf("Checksum: 0x%08lx\n", cksum);
1073 } 1073 }
1074 // When decompressing, leave CRC checking to decompressor 1074 // When decompressing, leave CRC checking to decompressor