mirror of
git://projects.qi-hardware.com/openwrt-xburst.git
synced 2025-04-21 12:27:27 +03:00
Cleanups on romboot and u-boot.
Conditionally apply ldd and ldconfig support on at91 platform git-svn-id: svn://svn.openwrt.org/openwrt/trunk@6862 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
@@ -503,387 +503,387 @@ diff -urN romboot.old/init.cpp romboot/init.cpp
|
||||
--- 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 @@
|
||||
//*----------------------------------------------------------------------------
|
||||
void AT91F_SpuriousHandler()
|
||||
{
|
||||
- AT91F_DBGU_Printk("-F- Spurious Interrupt detected\n\r");
|
||||
+ AT91F_DBGU_Printk("ISI");
|
||||
while (1);
|
||||
}
|
||||
|
||||
//*----------------------------------------------------------------------------
|
||||
void AT91F_SpuriousHandler()
|
||||
{
|
||||
- AT91F_DBGU_Printk("-F- Spurious Interrupt detected\n\r");
|
||||
+ AT91F_DBGU_Printk("ISI");
|
||||
while (1);
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
//*----------------------------------------------------------------------------
|
||||
void AT91F_DataAbort()
|
||||
{
|
||||
- AT91F_DBGU_Printk("-F- Data Abort detected\n\r");
|
||||
+ AT91F_DBGU_Printk("IDA");
|
||||
while (1);
|
||||
}
|
||||
|
||||
//*----------------------------------------------------------------------------
|
||||
void AT91F_DataAbort()
|
||||
{
|
||||
- AT91F_DBGU_Printk("-F- Data Abort detected\n\r");
|
||||
+ AT91F_DBGU_Printk("IDA");
|
||||
while (1);
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
//*----------------------------------------------------------------------------
|
||||
void AT91F_FetchAbort()
|
||||
{
|
||||
- AT91F_DBGU_Printk("-F- Prefetch Abort detected\n\r");
|
||||
+ AT91F_DBGU_Printk("IPA");
|
||||
while (1);
|
||||
}
|
||||
|
||||
//*----------------------------------------------------------------------------
|
||||
void AT91F_FetchAbort()
|
||||
{
|
||||
- AT91F_DBGU_Printk("-F- Prefetch Abort detected\n\r");
|
||||
+ AT91F_DBGU_Printk("IPA");
|
||||
while (1);
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@
|
||||
//*----------------------------------------------------------------------------
|
||||
void AT91F_Undef()
|
||||
{
|
||||
- AT91F_DBGU_Printk("-F- Undef detected\n\r");
|
||||
+ AT91F_DBGU_Printk("IUD");
|
||||
while (1);
|
||||
}
|
||||
|
||||
//*----------------------------------------------------------------------------
|
||||
void AT91F_Undef()
|
||||
{
|
||||
- AT91F_DBGU_Printk("-F- Undef detected\n\r");
|
||||
+ AT91F_DBGU_Printk("IUD");
|
||||
while (1);
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@
|
||||
//*----------------------------------------------------------------------------
|
||||
void AT91F_UndefHandler()
|
||||
{
|
||||
- AT91F_DBGU_Printk("-F- Undef detected\n\r");
|
||||
+ AT91F_DBGU_Printk("IUD");
|
||||
while (1);
|
||||
}
|
||||
|
||||
//*----------------------------------------------------------------------------
|
||||
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
|
||||
#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
|
||||
#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 @@
|
||||
//*-----------------------------------------------------------------------------
|
||||
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);
|
||||
}
|
||||
|
||||
//*-----------------------------------------------------------------------------
|
||||
//*-----------------------------------------------------------------------------
|
||||
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 @@
|
||||
}
|
||||
|
||||
|
||||
+#ifndef COMPACT
|
||||
//*-----------------------------------------------------------------------------
|
||||
//* Function Name : AT91F_MemoryDisplay()
|
||||
//* Object : Display the content of the dataflash
|
||||
}
|
||||
|
||||
|
||||
+#ifndef COMPACT
|
||||
//*-----------------------------------------------------------------------------
|
||||
//* Function Name : AT91F_MemoryDisplay()
|
||||
//* Object : Display the content of the dataflash
|
||||
@@ -244,7 +249,7 @@
|
||||
} while (nbytes > 0);
|
||||
return 0;
|
||||
}
|
||||
-
|
||||
+#endif
|
||||
|
||||
//*--------------------------------------------------------------------------------------
|
||||
//* Function Name : AT91F_SetPLL
|
||||
} while (nbytes > 0);
|
||||
return 0;
|
||||
}
|
||||
-
|
||||
+#endif
|
||||
|
||||
//*--------------------------------------------------------------------------------------
|
||||
//* Function Name : AT91F_SetPLL
|
||||
@@ -306,7 +311,7 @@
|
||||
AT91F_SetPLL();
|
||||
}
|
||||
|
||||
-void LedCode(void)
|
||||
+/*void LedCode(void)
|
||||
{
|
||||
int *pRegister;
|
||||
pRegister = (int *)0xFFFFF800; // Enable port C peripheral reg
|
||||
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
|
||||
*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);
|
||||
}
|
||||
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
|
||||
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();
|
||||
- }
|
||||
-}
|
||||
// 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 @@
|
||||
|
||||
#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
|
||||
|
||||
#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
|
||||
|
||||
Reference in New Issue
Block a user