--- romboot.old/init.cpp 2004-07-06 13:01:55.000000000 +0200
+++ romboot/init.cpp 2007-03-21 12:43:39.000000000 +0100
@@ -35,7 +35,7 @@
- //*----------------------------------------------------------------------------\r
- void AT91F_SpuriousHandler() \r
- {\r
-- AT91F_DBGU_Printk("-F- Spurious Interrupt detected\n\r");\r
-+ AT91F_DBGU_Printk("ISI");\r
- while (1);\r
- }\r
- \r
+ //*----------------------------------------------------------------------------
+ void AT91F_SpuriousHandler()
+ {
+- AT91F_DBGU_Printk("-F- Spurious Interrupt detected\n\r");
++ AT91F_DBGU_Printk("ISI");
+ while (1);
+ }
+
@@ -46,7 +46,7 @@
- //*----------------------------------------------------------------------------\r
- void AT91F_DataAbort() \r
- {\r
-- AT91F_DBGU_Printk("-F- Data Abort detected\n\r");\r
-+ AT91F_DBGU_Printk("IDA");\r
- while (1);\r
- }\r
- \r
+ //*----------------------------------------------------------------------------
+ void AT91F_DataAbort()
+ {
+- AT91F_DBGU_Printk("-F- Data Abort detected\n\r");
++ AT91F_DBGU_Printk("IDA");
+ while (1);
+ }
+
@@ -56,7 +56,7 @@
- //*----------------------------------------------------------------------------\r
- void AT91F_FetchAbort()\r
- {\r
-- AT91F_DBGU_Printk("-F- Prefetch Abort detected\n\r");\r
-+ AT91F_DBGU_Printk("IPA");\r
- while (1);\r
- }\r
- \r
+ //*----------------------------------------------------------------------------
+ void AT91F_FetchAbort()
+ {
+- AT91F_DBGU_Printk("-F- Prefetch Abort detected\n\r");
++ AT91F_DBGU_Printk("IPA");
+ while (1);
+ }
+
@@ -66,7 +66,7 @@
- //*----------------------------------------------------------------------------\r
- void AT91F_Undef() \r
- {\r
-- AT91F_DBGU_Printk("-F- Undef detected\n\r");\r
-+ AT91F_DBGU_Printk("IUD");\r
- while (1);\r
- }\r
- \r
+ //*----------------------------------------------------------------------------
+ void AT91F_Undef()
+ {
+- AT91F_DBGU_Printk("-F- Undef detected\n\r");
++ AT91F_DBGU_Printk("IUD");
+ while (1);
+ }
+
@@ -76,7 +76,7 @@
- //*----------------------------------------------------------------------------\r
- void AT91F_UndefHandler() \r
- {\r
-- AT91F_DBGU_Printk("-F- Undef detected\n\r");\r
-+ AT91F_DBGU_Printk("IUD");\r
- while (1);\r
- }\r
- \r
+ //*----------------------------------------------------------------------------
+ void AT91F_UndefHandler()
+ {
+- AT91F_DBGU_Printk("-F- Undef detected\n\r");
++ AT91F_DBGU_Printk("IUD");
+ while (1);
+ }
+
diff -urN romboot.old/main.cpp romboot/main.cpp
--- romboot.old/main.cpp 2007-03-19 12:44:03.000000000 +0100
+++ romboot/main.cpp 2007-03-21 19:23:41.000000000 +0100
@@ -33,18 +33,22 @@
- #define DELAY_MAIN_FREQ 1000\r
- #define DISP_LINE_LEN 16\r
- \r
-+#define COMPACT 1\r
-+\r
- //* prototypes\r
- extern void AT91F_DBGU_Printk(char *);\r
- extern "C" void AT91F_ST_ASM_Handler(void);\r
- extern "C" void Jump(unsigned int addr);\r
-+extern int mci_main(void);\r
- \r
--const char *menu_separ = "*----------------------------------------*\n\r";\r
-+//const char *menu_separ = "*----------------------------------------*\n\r";\r
- \r
- const char *menu_dataflash = {\r
-- "1: Download Dataflash [addr]\n\r"\r
-- "2: Read Dataflash [addr]\n\r"\r
-- "3: Start U-BOOT\n\r"\r
-- "4: Clear bootloader section in Dataflash\n\r"\r
-+ "1: DL DF [ad]\n\r"\r
-+ "2: RD DF [ad]\n\r"\r
-+ "3: CP SD\n\r"\r
-+ "4: U-BOOT\n\r"\r
-+ "5: RM BL in DF\n\r"\r
- };\r
- \r
- //* Globales variables \r
+ #define DELAY_MAIN_FREQ 1000
+ #define DISP_LINE_LEN 16
+
++#define COMPACT 1
++
+ //* prototypes
+ extern void AT91F_DBGU_Printk(char *);
+ extern "C" void AT91F_ST_ASM_Handler(void);
+ extern "C" void Jump(unsigned int addr);
++extern int mci_main(void);
+
+-const char *menu_separ = "*----------------------------------------*\n\r";
++//const char *menu_separ = "*----------------------------------------*\n\r";
+
+ const char *menu_dataflash = {
+- "1: Download Dataflash [addr]\n\r"
+- "2: Read Dataflash [addr]\n\r"
+- "3: Start U-BOOT\n\r"
+- "4: Clear bootloader section in Dataflash\n\r"
++ "1: DL DF [ad]\n\r"
++ "2: RD DF [ad]\n\r"
++ "3: CP SD\n\r"
++ "4: U-BOOT\n\r"
++ "5: RM BL in DF\n\r"
+ };
+
+ //* Globales variables
@@ -151,12 +155,12 @@
- //*-----------------------------------------------------------------------------\r
- void AT91F_DisplayMenu(void)\r
- {\r
-- printf("\n\rFDL LOADER %s %s %s\n\r", AT91C_VERSION, __DATE__, __TIME__);\r
-- printf(menu_separ); \r
-+ printf("\n\rFDL SD-Card LOADER %s %s %s\n\r", AT91C_VERSION, __DATE__, __TIME__);\r
-+// printf(menu_separ); \r
- AT91F_DataflashPrintInfo();\r
-- printf(menu_separ); \r
-+// printf(menu_separ); \r
- printf(menu_dataflash); \r
-- printf(menu_separ); \r
-+// printf(menu_separ); \r
- } \r
- \r
- //*-----------------------------------------------------------------------------\r
+ //*-----------------------------------------------------------------------------
+ void AT91F_DisplayMenu(void)
+ {
+- printf("\n\rFDL LOADER %s %s %s\n\r", AT91C_VERSION, __DATE__, __TIME__);
+- printf(menu_separ);
++ printf("\n\rFDL SD-Card LOADER %s %s %s\n\r", AT91C_VERSION, __DATE__, __TIME__);
++// printf(menu_separ);
+ AT91F_DataflashPrintInfo();
+- printf(menu_separ);
++// printf(menu_separ);
+ printf(menu_dataflash);
+- printf(menu_separ);
++// printf(menu_separ);
+ }
+
+ //*-----------------------------------------------------------------------------
@@ -194,6 +198,7 @@
- }\r
- \r
- \r
-+#ifndef COMPACT\r
- //*-----------------------------------------------------------------------------\r
- //* Function Name : AT91F_MemoryDisplay()\r
- //* Object : Display the content of the dataflash\r
+ }
+
+
++#ifndef COMPACT
+ //*-----------------------------------------------------------------------------
+ //* Function Name : AT91F_MemoryDisplay()
+ //* Object : Display the content of the dataflash
@@ -244,7 +249,7 @@
- } while (nbytes > 0);\r
- return 0;\r
- }\r
--\r
-+#endif\r
- \r
- //*--------------------------------------------------------------------------------------\r
- //* Function Name : AT91F_SetPLL\r
+ } while (nbytes > 0);
+ return 0;
+ }
+-
++#endif
+
+ //*--------------------------------------------------------------------------------------
+ //* Function Name : AT91F_SetPLL
@@ -306,7 +311,7 @@
- AT91F_SetPLL();\r
- }\r
- \r
--void LedCode(void)\r
-+/*void LedCode(void)\r
- {\r
- int *pRegister;\r
- pRegister = (int *)0xFFFFF800; // Enable port C peripheral reg\r
+ AT91F_SetPLL();
+ }
+
+-void LedCode(void)
++/*void LedCode(void)
+ {
+ int *pRegister;
+ pRegister = (int *)0xFFFFF800; // Enable port C peripheral reg
@@ -318,15 +323,16 @@
- pRegister = (int *)0xFFFFF834; // Clear bits\r
- *pRegister = 0x2800;\r
- }\r
-+*/\r
- \r
- void AT91F_StartUboot(unsigned int dummy, void *pvoid)\r
- {\r
-- printf("Load U-BOOT from dataflash[%x] to SDRAM[%x]\n\r", AT91C_UBOOT_DATAFLASH_ADDR, AT91C_UBOOT_ADDR);\r
-+ //printf("Load U-BOOT from dataflash[%x] to SDRAM[%x]\n\r", AT91C_UBOOT_DATAFLASH_ADDR, AT91C_UBOOT_ADDR);\r
- read_dataflash(AT91C_UBOOT_DATAFLASH_ADDR, AT91C_UBOOT_SIZE, (char *)(AT91C_UBOOT_ADDR));\r
-- printf("Set PLLA to 180Mhz and Master clock to 60Mhz and start U-BOOT\n\r");\r
-+ //printf("Set PLLA to 180Mhz and Master clock to 60Mhz and start U-BOOT\n\r");\r
- //* Reset registers\r
- AT91F_ResetRegisters();\r
-- LedCode();\r
-+// LedCode();\r
- Jump(AT91C_UBOOT_ADDR);\r
- while(1);\r
- }\r
+ pRegister = (int *)0xFFFFF834; // Clear bits
+ *pRegister = 0x2800;
+ }
++*/
+
+ void AT91F_StartUboot(unsigned int dummy, void *pvoid)
+ {
+- printf("Load U-BOOT from dataflash[%x] to SDRAM[%x]\n\r", AT91C_UBOOT_DATAFLASH_ADDR, AT91C_UBOOT_ADDR);
++ //printf("Load U-BOOT from dataflash[%x] to SDRAM[%x]\n\r", AT91C_UBOOT_DATAFLASH_ADDR, AT91C_UBOOT_ADDR);
+ read_dataflash(AT91C_UBOOT_DATAFLASH_ADDR, AT91C_UBOOT_SIZE, (char *)(AT91C_UBOOT_ADDR));
+- printf("Set PLLA to 180Mhz and Master clock to 60Mhz and start U-BOOT\n\r");
++ //printf("Set PLLA to 180Mhz and Master clock to 60Mhz and start U-BOOT\n\r");
+ //* Reset registers
+ AT91F_ResetRegisters();
+- LedCode();
++// LedCode();
+ Jump(AT91C_UBOOT_ADDR);
+ while(1);
+ }
@@ -385,120 +391,124 @@
- // start tempo to start Uboot in a delay of 1 sec if no key pressed\r
- svcUbootTempo.Start(&svcUbootTempo, 1000, 0, AT91F_StartUboot, (void *)0);\r
- \r
-- printf("press any key to enter bootloader\n\r");\r
-+ printf("press key\n\r");\r
- getc();\r
- \r
- // stop tempo\r
- svcUbootTempo.Stop(&svcUbootTempo);\r
- \r
-- while(1)\r
-- {\r
-- while(command == 0)\r
-- {\r
-- AddressToDownload = AT91C_DOWNLOAD_BASE_ADDRESS;\r
-- SizeToDownload = AT91C_DOWNLOAD_MAX_SIZE;\r
-- DeviceAddress = 0;\r
-+ while(1) {\r
-+ while(command == 0) {\r
-+ AddressToDownload = AT91C_DOWNLOAD_BASE_ADDRESS;\r
-+ SizeToDownload = AT91C_DOWNLOAD_MAX_SIZE;\r
-+ DeviceAddress = 0;\r
- \r
-- AT91F_DisplayMenu();\r
-- message[0] = 0;\r
-- message[2] = 0;\r
-- AT91F_ReadLine("Enter: ", message);\r
-+ AT91F_DisplayMenu();\r
-+ message[0] = 0;\r
-+ message[2] = 0;\r
-+ AT91F_ReadLine("Enter: ", message);\r
- \r
-- command = message[0];\r
-- if(command == '1' || command == '2')\r
-- if(AsciiToHex(&message[2], &DeviceAddress) == 0)\r
-- command = 0;\r
--\r
-- switch(command)\r
-- {\r
-- case '1': \r
-- printf("Download Dataflash [0x%x]\n\r", DeviceAddress);\r
-- \r
-- switch(DeviceAddress & 0xFF000000)\r
-- {\r
-- case CFG_DATAFLASH_LOGIC_ADDR_CS0:\r
-- device = 0;\r
-- break;\r
-+ command = message[0];\r
-+ if(command == '1' || command == '2')\r
-+ if(AsciiToHex(&message[2], &DeviceAddress) == 0)\r
-+ command = 0;\r
-+\r
-+ switch(command) {\r
-+ case '1': \r
-+ printf("DL DF [0x%x]\n\r", DeviceAddress);\r
-+\r
-+ switch(DeviceAddress & 0xFF000000) {\r
-+ case CFG_DATAFLASH_LOGIC_ADDR_CS0:\r
-+ device = 0;\r
-+ break;\r
- \r
-- case CFG_DATAFLASH_LOGIC_ADDR_CS3:\r
-- device = 1;\r
-- break;\r
-+ case CFG_DATAFLASH_LOGIC_ADDR_CS3:\r
-+ device = 1;\r
-+ break;\r
- \r
-- default:\r
-- command = 0;\r
-- break;\r
-- }\r
-- break;\r
-- \r
-- case '2':\r
-- do \r
-- {\r
-- AT91F_MemoryDisplay(DeviceAddress, 4, 64);\r
-- AT91F_ReadLine ((char *)0, message);\r
-- DeviceAddress += 0x100;\r
-+ default:\r
-+ command = 0;\r
-+ break;\r
-+ }\r
-+ break;\r
-+\r
-+#ifndef COMPACT\r
-+ case '2':\r
-+ do {\r
-+ AT91F_MemoryDisplay(DeviceAddress, 4, 64);\r
-+ AT91F_ReadLine ((char *)0, message);\r
-+ DeviceAddress += 0x100;\r
-+ } while(message[0] == '\0');\r
-+ command = 0;\r
-+ break;\r
-+#endif\r
-+ \r
-+ case '3':\r
-+ mci_main();\r
-+ command=0;\r
-+ break;\r
-+\r
-+ case '4':\r
-+ AT91F_StartUboot(0, (void *)0);\r
-+ command = 0;\r
-+ break;\r
-+\r
-+ case '5':\r
-+ {\r
-+ int *i;\r
-+ \r
-+ for(i = (int *)0x20000000; i < (int *)0x20004000; i++)\r
-+ *i = 0;\r
-+ }\r
-+ write_dataflash(0xc0000000, 0x20000000, 0x4000);\r
-+ printf("BL CLR\r\n");\r
-+ command = 0;\r
-+ break;\r
-+ \r
-+ default:\r
-+ command = 0;\r
-+ break;\r
-+ } // switch(command)\r
-+ } // while(command == 0)\r
-+ \r
-+ xmodemPipe.Read(&xmodemPipe, (char *)AddressToDownload, SizeToDownload, XmodemProtocol, 0); \r
-+ while(XmodemComplete !=1);\r
-+ SizeToDownload = (unsigned int)(svcXmodem.pData) - (unsigned int)AddressToDownload; \r
-+ \r
-+ // Modification of vector 6\r
-+ NbPage = 0;\r
-+ i = dataflash_info[device].Device.pages_number;\r
-+ while(i >>= 1)\r
-+ NbPage++;\r
-+ i = (SizeToDownload / 512) + 1 + (NbPage << 13) + (dataflash_info[device].Device.pages_size << 17);\r
-+ *(int *)(AddressToDownload + AT91C_OFFSET_VECT6) = i;\r
-+ \r
-+// printf("\n\rModification of Arm Vector 6 :%x\n\r", i);\r
-+\r
-+ printf("\n\rWR %d in DF [0x%x]\n\r",SizeToDownload, DeviceAddress);\r
-+ crc1 = 0;\r
-+ pAT91->CRC32((const unsigned char *)AddressToDownload, SizeToDownload , &crc1);\r
-+\r
-+ // write the dataflash\r
-+ write_dataflash (DeviceAddress, AddressToDownload, SizeToDownload);\r
-+ // clear the buffer before read\r
-+ for(i=0; i < SizeToDownload; i++)\r
-+ *(unsigned char *)(AddressToDownload + i) = 0;\r
-+ \r
-+ //* Read dataflash page in TestBuffer\r
-+ read_dataflash (DeviceAddress, SizeToDownload, (char *)(AddressToDownload));\r
-+\r
-+ printf("Vfy DF: "); \r
-+ crc2 = 0;\r
-+\r
-+ pAT91->CRC32((const unsigned char *)AddressToDownload, SizeToDownload , &crc2);\r
-+ if (crc1 != crc2)\r
-+ printf("Fail\r\n"); \r
-+ else\r
-+ printf("OK\r\n"); \r
-+ \r
-+ command = 0;\r
-+ XmodemComplete = 0;\r
-+ AT91F_WaitKeyPressed();\r
- }\r
-- while(message[0] == '\0');\r
-- command = 0;\r
-- break;\r
-- \r
-- case '3':\r
-- AT91F_StartUboot(0, (void *)0);\r
-- command = 0;\r
-- break;\r
-- case '4':\r
-- {\r
-- int *i;\r
-- for(i = (int *)0x20000000; i < (int *)0x20004000; i++)\r
-- *i = 0;\r
-- }\r
-- write_dataflash(0xc0000000, 0x20000000, 0x4000);\r
-- printf("Bootsection cleared\r\n");\r
-- command = 0;\r
-- break;\r
-- default:\r
-- command = 0;\r
-- break;\r
-- }\r
- }\r
-- \r
-- xmodemPipe.Read(&xmodemPipe, (char *)AddressToDownload, SizeToDownload, XmodemProtocol, 0); \r
-- while(XmodemComplete !=1);\r
-- SizeToDownload = (unsigned int)(svcXmodem.pData) - (unsigned int)AddressToDownload; \r
-- \r
-- // Modification of vector 6\r
-- NbPage = 0;\r
-- i = dataflash_info[device].Device.pages_number;\r
-- while(i >>= 1)\r
-- NbPage++;\r
-- i = (SizeToDownload / 512) + 1 + (NbPage << 13) + (dataflash_info[device].Device.pages_size << 17);\r
-- *(int *)(AddressToDownload + AT91C_OFFSET_VECT6) = i;\r
-- \r
-- printf("\n\rModification of Arm Vector 6 :%x\n\r", i);\r
-- \r
-- printf("\n\rWrite %d bytes in DataFlash [0x%x]\n\r",SizeToDownload, DeviceAddress);\r
-- crc1 = 0;\r
-- pAT91->CRC32((const unsigned char *)AddressToDownload, SizeToDownload , &crc1);\r
-- \r
-- // write the dataflash\r
-- write_dataflash (DeviceAddress, AddressToDownload, SizeToDownload);\r
-- // clear the buffer before read\r
-- for(i=0; i < SizeToDownload; i++)\r
-- *(unsigned char *)(AddressToDownload + i) = 0;\r
-- \r
-- //* Read dataflash page in TestBuffer\r
-- read_dataflash (DeviceAddress, SizeToDownload, (char *)(AddressToDownload));\r
-- \r
-- printf("Verify Dataflash: "); \r
-- crc2 = 0;\r
-- \r
-- pAT91->CRC32((const unsigned char *)AddressToDownload, SizeToDownload , &crc2);\r
-- if (crc1 != crc2)\r
-- printf("Failed\r\n"); \r
-- else\r
-- printf("OK\r\n"); \r
-- \r
-- command = 0;\r
-- XmodemComplete = 0;\r
-- AT91F_WaitKeyPressed();\r
-- }\r
--}\r
+ // start tempo to start Uboot in a delay of 1 sec if no key pressed
+ svcUbootTempo.Start(&svcUbootTempo, 1000, 0, AT91F_StartUboot, (void *)0);
+
+- printf("press any key to enter bootloader\n\r");
++ printf("press key\n\r");
+ getc();
+
+ // stop tempo
+ svcUbootTempo.Stop(&svcUbootTempo);
+
+- while(1)
+- {
+- while(command == 0)
+- {
+- AddressToDownload = AT91C_DOWNLOAD_BASE_ADDRESS;
+- SizeToDownload = AT91C_DOWNLOAD_MAX_SIZE;
+- DeviceAddress = 0;
++ while(1) {
++ while(command == 0) {
++ AddressToDownload = AT91C_DOWNLOAD_BASE_ADDRESS;
++ SizeToDownload = AT91C_DOWNLOAD_MAX_SIZE;
++ DeviceAddress = 0;
+
+- AT91F_DisplayMenu();
+- message[0] = 0;
+- message[2] = 0;
+- AT91F_ReadLine("Enter: ", message);
++ AT91F_DisplayMenu();
++ message[0] = 0;
++ message[2] = 0;
++ AT91F_ReadLine("Enter: ", message);
+
+- command = message[0];
+- if(command == '1' || command == '2')
+- if(AsciiToHex(&message[2], &DeviceAddress) == 0)
+- command = 0;
+-
+- switch(command)
+- {
+- case '1':
+- printf("Download Dataflash [0x%x]\n\r", DeviceAddress);
+-
+- switch(DeviceAddress & 0xFF000000)
+- {
+- case CFG_DATAFLASH_LOGIC_ADDR_CS0:
+- device = 0;
+- break;
++ command = message[0];
++ if(command == '1' || command == '2')
++ if(AsciiToHex(&message[2], &DeviceAddress) == 0)
++ command = 0;
++
++ switch(command) {
++ case '1':
++ printf("DL DF [0x%x]\n\r", DeviceAddress);
++
++ switch(DeviceAddress & 0xFF000000) {
++ case CFG_DATAFLASH_LOGIC_ADDR_CS0:
++ device = 0;
++ break;
+
+- case CFG_DATAFLASH_LOGIC_ADDR_CS3:
+- device = 1;
+- break;
++ case CFG_DATAFLASH_LOGIC_ADDR_CS3:
++ device = 1;
++ break;
+
+- default:
+- command = 0;
+- break;
+- }
+- break;
+-
+- case '2':
+- do
+- {
+- AT91F_MemoryDisplay(DeviceAddress, 4, 64);
+- AT91F_ReadLine ((char *)0, message);
+- DeviceAddress += 0x100;
++ default:
++ command = 0;
++ break;
++ }
++ break;
++
++#ifndef COMPACT
++ case '2':
++ do {
++ AT91F_MemoryDisplay(DeviceAddress, 4, 64);
++ AT91F_ReadLine ((char *)0, message);
++ DeviceAddress += 0x100;
++ } while(message[0] == '\0');
++ command = 0;
++ break;
++#endif
++
++ case '3':
++ mci_main();
++ command=0;
++ break;
++
++ case '4':
++ AT91F_StartUboot(0, (void *)0);
++ command = 0;
++ break;
++
++ case '5':
++ {
++ int *i;
++
++ for(i = (int *)0x20000000; i < (int *)0x20004000; i++)
++ *i = 0;
++ }
++ write_dataflash(0xc0000000, 0x20000000, 0x4000);
++ printf("BL CLR\r\n");
++ command = 0;
++ break;
++
++ default:
++ command = 0;
++ break;
++ } // switch(command)
++ } // while(command == 0)
++
++ xmodemPipe.Read(&xmodemPipe, (char *)AddressToDownload, SizeToDownload, XmodemProtocol, 0);
++ while(XmodemComplete !=1);
++ SizeToDownload = (unsigned int)(svcXmodem.pData) - (unsigned int)AddressToDownload;
++
++ // Modification of vector 6
++ NbPage = 0;
++ i = dataflash_info[device].Device.pages_number;
++ while(i >>= 1)
++ NbPage++;
++ i = (SizeToDownload / 512) + 1 + (NbPage << 13) + (dataflash_info[device].Device.pages_size << 17);
++ *(int *)(AddressToDownload + AT91C_OFFSET_VECT6) = i;
++
++// printf("\n\rModification of Arm Vector 6 :%x\n\r", i);
++
++ printf("\n\rWR %d in DF [0x%x]\n\r",SizeToDownload, DeviceAddress);
++ crc1 = 0;
++ pAT91->CRC32((const unsigned char *)AddressToDownload, SizeToDownload , &crc1);
++
++ // write the dataflash
++ write_dataflash (DeviceAddress, AddressToDownload, SizeToDownload);
++ // clear the buffer before read
++ for(i=0; i < SizeToDownload; i++)
++ *(unsigned char *)(AddressToDownload + i) = 0;
++
++ //* Read dataflash page in TestBuffer
++ read_dataflash (DeviceAddress, SizeToDownload, (char *)(AddressToDownload));
++
++ printf("Vfy DF: ");
++ crc2 = 0;
++
++ pAT91->CRC32((const unsigned char *)AddressToDownload, SizeToDownload , &crc2);
++ if (crc1 != crc2)
++ printf("Fail\r\n");
++ else
++ printf("OK\r\n");
++
++ command = 0;
++ XmodemComplete = 0;
++ AT91F_WaitKeyPressed();
+ }
+- while(message[0] == '\0');
+- command = 0;
+- break;
+-
+- case '3':
+- AT91F_StartUboot(0, (void *)0);
+- command = 0;
+- break;
+- case '4':
+- {
+- int *i;
+- for(i = (int *)0x20000000; i < (int *)0x20004000; i++)
+- *i = 0;
+- }
+- write_dataflash(0xc0000000, 0x20000000, 0x4000);
+- printf("Bootsection cleared\r\n");
+- command = 0;
+- break;
+- default:
+- command = 0;
+- break;
+- }
+ }
+-
+- xmodemPipe.Read(&xmodemPipe, (char *)AddressToDownload, SizeToDownload, XmodemProtocol, 0);
+- while(XmodemComplete !=1);
+- SizeToDownload = (unsigned int)(svcXmodem.pData) - (unsigned int)AddressToDownload;
+-
+- // Modification of vector 6
+- NbPage = 0;
+- i = dataflash_info[device].Device.pages_number;
+- while(i >>= 1)
+- NbPage++;
+- i = (SizeToDownload / 512) + 1 + (NbPage << 13) + (dataflash_info[device].Device.pages_size << 17);
+- *(int *)(AddressToDownload + AT91C_OFFSET_VECT6) = i;
+-
+- printf("\n\rModification of Arm Vector 6 :%x\n\r", i);
+-
+- printf("\n\rWrite %d bytes in DataFlash [0x%x]\n\r",SizeToDownload, DeviceAddress);
+- crc1 = 0;
+- pAT91->CRC32((const unsigned char *)AddressToDownload, SizeToDownload , &crc1);
+-
+- // write the dataflash
+- write_dataflash (DeviceAddress, AddressToDownload, SizeToDownload);
+- // clear the buffer before read
+- for(i=0; i < SizeToDownload; i++)
+- *(unsigned char *)(AddressToDownload + i) = 0;
+-
+- //* Read dataflash page in TestBuffer
+- read_dataflash (DeviceAddress, SizeToDownload, (char *)(AddressToDownload));
+-
+- printf("Verify Dataflash: ");
+- crc2 = 0;
+-
+- pAT91->CRC32((const unsigned char *)AddressToDownload, SizeToDownload , &crc2);
+- if (crc1 != crc2)
+- printf("Failed\r\n");
+- else
+- printf("OK\r\n");
+-
+- command = 0;
+- XmodemComplete = 0;
+- AT91F_WaitKeyPressed();
+- }
+-}
diff -urN romboot.old/main.h romboot/main.h
--- romboot.old/main.h 2004-07-03 17:41:14.000000000 +0200
+++ romboot/main.h 2007-03-21 21:48:52.000000000 +0100
@@ -27,7 +27,7 @@
- \r
- #define AT91C_OFFSET_VECT6 0x14 //* Offset for ARM vector 6\r
- \r
--#define AT91C_VERSION "VER 1.01"\r
-+#define AT91C_VERSION "VER 1.02"\r
- // Global variables and functions definition\r
- extern unsigned int GetTickCount(void);\r
- #endif\r
+
+ #define AT91C_OFFSET_VECT6 0x14 //* Offset for ARM vector 6
+
+-#define AT91C_VERSION "VER 1.01"
++#define AT91C_VERSION "VER 1.02"
+ // Global variables and functions definition
+ extern unsigned int GetTickCount(void);
+ #endif
diff -urN romboot.old/Makefile romboot/Makefile
--- romboot.old/Makefile 2007-03-19 12:44:03.000000000 +0100
+++ romboot/Makefile 2007-03-21 12:29:11.000000000 +0100