//term.c_iflag&=~(IXON|IXOFF|IXANY|INLCR|ICRNL);
term.c_iflag&=~(INLCR|ICRNL|IXANY);
term.c_iflag|=(IXON|IXOFF);
+
+ // output options
+
+ term.c_oflag=0;
// more control options -> timeout / flow control
}
/* act according to type */
switch(type) {
- case 0x03:
- /* get cs and ip */
- break;
+ //case 0x03:
+ // /* get cs and ip */
+ // break;
case 0x00:
write_to_ram(lpc,buf,addr,len);
break;
+ case 0x01:
+ write_to_ram(lpc,buf,addr,len);
+ break;
default:
printf("fw to ram: unknown type %02x\n",type);
return -1;
t_lpc lpc;
int i;
+ u8 buf[BUFSIZE];
+ int ret;
/*
* initial ...
if(open_serial_device(&lpc)<0)
goto end;
- /* open firmware file */
- if(open_firmware(&lpc)<0)
- goto end;
-
/* boot loader init */
printf("boot loader init ...\n");
if(bl_init(&lpc)<0)
return -1;
+ /* quit if there is no hex file to process */
+ if(!(lpc.info&FIRMWARE)) {
+ printf("no firmware -> aborting\n");
+ goto end;
+ }
+
+ /* open firmware file */
+ if(open_firmware(&lpc)<0)
+ goto end;
+
/* parse intel hex file and write to ram */
printf("write firmware to ram ...\n");
firmware_to_ram(&lpc);
/* go! */
printf("go ...\n");
go(&lpc);
- printf("\n");
+
+ printf("\n\n");
+ printf("the above error might be due to the jump!\n");
+ printf("\n\n");
+
+ printf("sleeping for 5 seconds ...\n\n");
+ sleep(5);
+
+ printf("continue listening on the serial port. ctrl+c to quit!\n\n");
+
+ /* testing */
+
+ ret=1;
+ while(ret) {
+ ret=read(lpc.sfd,buf,BUFSIZE);
+ printf("\rread %d bytes: ",ret);
+ for(i=0;i<ret;i++)
+ printf("%02x ",buf[i]);
+ }
end:
close(lpc.sfd);