2010-10-12 09:05:52 -05:00
|
|
|
#include "soc-hw.h"
|
|
|
|
|
|
|
|
unsigned int i, j,k; // Loop counter.
|
|
|
|
|
|
|
|
|
|
|
|
int main() {
|
2010-10-13 08:49:36 -05:00
|
|
|
int key, len, autoboot = 1, dispmenu = 1;
|
2010-10-12 09:05:52 -05:00
|
|
|
|
2010-10-13 08:49:36 -05:00
|
|
|
uart_putstr("Cain's bootloader!!! \r\n");
|
2010-10-12 09:05:52 -05:00
|
|
|
|
|
|
|
while(1){ /* loop forever until u-boot gets booted or the board is reset */
|
|
|
|
if(dispmenu){
|
2010-10-13 08:49:36 -05:00
|
|
|
uart_putstr("\n1: Upload program to RAM\r\n");
|
|
|
|
// uart_putstr("2: Upload u-boot to Dataflash\r\n");
|
|
|
|
// uart_putstr("3: Upload Kernel to Dataflash\r\n");
|
|
|
|
// uart_putstr("4: Start u-boot\r\n");
|
|
|
|
// uart_putstr("5: Upload Filesystem image\r\n");
|
|
|
|
// uart_putstr("6: Memory test\r\n");
|
2010-10-12 09:05:52 -05:00
|
|
|
dispmenu = 0;
|
|
|
|
}
|
|
|
|
key = uart_getchar();
|
|
|
|
autoboot = 0;
|
|
|
|
|
|
|
|
if(key == '1'){
|
2010-10-13 08:49:36 -05:00
|
|
|
len = rxmodem((unsigned char *)0x1000);
|
2010-10-12 09:05:52 -05:00
|
|
|
uart_putstr("Received ");
|
|
|
|
hexprint(len);
|
2010-10-13 08:49:36 -05:00
|
|
|
uart_putstr(" bytes\r\n");
|
|
|
|
// jump(RAM_BASE);
|
2010-10-12 09:05:52 -05:00
|
|
|
dispmenu = 1;
|
|
|
|
}
|
|
|
|
else{
|
2010-10-13 08:49:36 -05:00
|
|
|
uart_putstr("Invalid input\r\n");
|
2010-10-12 09:05:52 -05:00
|
|
|
dispmenu = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-10-13 08:49:36 -05:00
|
|
|
while(1){ asm("nop;"); }
|
2010-10-12 09:05:52 -05:00
|
|
|
|
2010-10-13 08:49:36 -05:00
|
|
|
return (0);
|
2010-10-12 09:05:52 -05:00
|
|
|
}
|