1
0
mirror of git://projects.qi-hardware.com/nn-usb-fpga.git synced 2025-01-10 23:00:15 +02:00
nn-usb-fpga/lm32/logic/sakc/firmware/loader_cain/main.c

56 lines
1.2 KiB
C
Raw Normal View History

2010-10-12 17:05:52 +03:00
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#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);
}