mirror of
git://projects.qi-hardware.com/nn-usb-fpga.git
synced 2025-01-10 14:20:14 +02:00
56 lines
1.2 KiB
C
56 lines
1.2 KiB
C
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||
|
|
||
|
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||
|
|
||
|
|
||
|
#include "soc-hw.h"
|
||
|
#define RAM_BASE 0x1000
|
||
|
|
||
|
unsigned int i, j,k; // Loop counter.
|
||
|
|
||
|
|
||
|
int main() {
|
||
|
int key, len, autoboot = 1, dispmenu = 1;
|
||
|
|
||
|
uart_init();
|
||
|
uart_putstr("Cain's bootloader!!! \n");
|
||
|
|
||
|
while(1){ /* loop forever until u-boot gets booted or the board is reset */
|
||
|
if(dispmenu){
|
||
|
uart_putstr("\n1: Upload program to RAM\n");
|
||
|
// uart_putstr("2: Upload u-boot to Dataflash\n");
|
||
|
// uart_putstr("3: Upload Kernel to Dataflash\n");
|
||
|
// uart_putstr("4: Start u-boot\n");
|
||
|
// uart_putstr("5: Upload Filesystem image\n");
|
||
|
// uart_putstr("6: Memory test\n");
|
||
|
dispmenu = 0;
|
||
|
}
|
||
|
key = uart_getchar();
|
||
|
autoboot = 0;
|
||
|
|
||
|
if(key == '1'){
|
||
|
len = rxmodem((char *)0x1000);
|
||
|
uart_putstr("Received ");
|
||
|
hexprint(len);
|
||
|
uart_putstr(" bytes\n");
|
||
|
jump(RAM_BASE);
|
||
|
// dispmenu = 1;
|
||
|
}
|
||
|
else if(key == '2'){
|
||
|
dispmenu = 1;
|
||
|
}
|
||
|
else{
|
||
|
uart_putstr("Invalid input\n");
|
||
|
dispmenu = 1;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
while(1){ asm("nop;"); }
|
||
|
|
||
|
|
||
|
return (0);
|
||
|
|
||
|
|
||
|
}
|